[pmwiki-users] markup expression output handling

Patrick R. Michaud pmichaud at pobox.com
Wed Jan 23 14:31:20 CST 2008


On Wed, Jan 23, 2008 at 05:28:56PM +0000, Hans wrote:
> Wednesday, January 23, 2008, 4:39:32 PM, Patrick R. Michaud wrote:
> > In case A, the <b> tag is being generated as part of the
> > page output at the time it is being rendered.  Thus a browser
> > sees it as a bold tag.
> 
> > In case B, the <b> tag is being saved as part of the page's markup,
> > exactly as if someone had written <b>Hello</b> in the markup text.
> > Then the angle brackets are converted to &lt; and &gt; when the
> > page is rendered.
> 
> Thank you! I understand it a bit better.
> But I would like both cases to behave similar.
> I am not too worried about a  HTML tag, but this impacts on how one
> can include an empty new line:
> 
> If you change the example to
> 
> $MarkupExpr['tagtest'] = 'TagTest()';
> function TagTest() {
>         return"Hello\n\nagain";
> }
> 
> in case A the output is
> 
> Hello
> again
> 
> and in case B the written output is
> 
> Hello
> 
> again
> 
> How can case A has the same result than case B, with an empty space?

It sounds as though you're trying to make a markup-on-save
pattern act exactly like a markup-on-render pattern.  But they
aren't the same.  Two newlines in markup form a paragraph (because
they are replaced with <vspace> tags), but two newlines in the HTML
output are just treated as a space.

Put another way, PmWiki generally mistrusts anything put in markup
(and thus disallows HTML), but trust things that are produced by
rendering recipes.

Your best best is to get TagTest() to always return PmWiki markup
that does what you want, and let the later markup rendering
handle it from there.  In the case of newlines, that probably means
generating \\\'s at the end of lines to produce the blank space
in the output:

    function TagTest() {
        return"Hello\\\\\\\nagain";
    }

Pm



More information about the pmwiki-users mailing list