Since some preprocessor directives insert raw HTML, it would be good to
specify, per-format, how to pass HTML so that it goes through the format
OK. With Markdown we cross our fingers; with reST we use the "raw"
directive.
I added an extra named parameter to the htmlize hook, which feels sort of
wrong, since none of the other hooks take parameters. Let me know what
you think. --Ethan
Seems fairly reasonable, actually. Shouldn't the $type come from $page
instead of $destpage though? Only other obvious change is to make the
escape parameter optional, and only call it if set. --[[Joey]]
I couldn't figure out what to make it from, but thinking it through,
yeah, it should be $page. Revised patch follows. --Ethan
I've updated the patch some more, but I think it's incomplete. ikiwiki
emits raw html when expanding WikiLinks too, and it would need to escape
those. Assuming that escaping html embedded in the middle of a sentence
works.. --[[Joey]]
Revised again. I get around this by making another hook, htmlescapelink,
which is called to generate links in whatever language. In addition, it
doesn't (can't?) generate
spans, and it doesn't handle inlineable image links. If these were
desired, the approach to take would probably be to use substitution
definitions, which would require generating two bits of code for each
link/html snippet, and putting one at the end of the paragraph (or maybe
the document?).
To specify that (for example) Discussion links are meant to be HTML and
not rst or whatever, I added a "genhtml" parameter to htmllink. It seems
to work -- see http://ikidev.betacantrips.com/blah.html for an example.
--Ethan
Alternative solution
Here is a patch
largely inspired from the one below, which is up to date and written with
[[todo/multiple_output_formats]] in mind. "htmlize" hooks are generalized
to "convert" ones, which can be registered for any pair of filename
extensions.
Preprocessor directives are allowed to return the content to be inserted
as a hash, in any format they want, provided they provide htmlize hooks for it.
Pseudo filename extensions (such as "_link" ) can also be introduced,
which aren't used as real extensions but provide useful intermediate types.
--[[JeremieKoenig]]
Original patch
[[tag patch]]
|