-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christian Boos wrote:
> On 7/5/2010 1:03 AM, Steffen Hoffmann wrote:
>> I figured out that using format_to_html() is a way, if not even the
>> preferred one, to transform wiki markup to HTML.
>>
>> Since I want to convert ticket descriptions into HTML that will added to
>> a plugins output inside a span tag, I am stuck right now: output is
>> always wrapped by p tag, but that is not allowed inside span tag, and no
>> way to switch this undesired wrapping off in format_to_html().
>>    
> 
> If you want to wrap the text in a <span>, you want "inline" HTML anyway,
> so not format_to_html but format_to_oneliner.

Right, this came to my mind as well and might be the easy option anyway.
However this will remove i.e. table markup without a trace, while  I
prefer to not just strip but replace preview-incompatible markup with
special code, so while still being a rough preview at least it shows
there actually is something.

preview-incompatible markup     replacement code

 <table ... /table>              [|||]
 <img ... />                     X
 <a ... >LABEL</a>               [LABEL]


sample output

This is some content.
[X]image description here
Well, that could be a problem for calendar presentation,<br/>
if not escaped properly. And this is [X] another image.

This is a bit tricky indeed, I know, but I'd really like to preserve
these additional bits of information in my previews.

As all p tags have to be stripped in this case, not only the surrounding
pair, I've done this is now with Python re. This solution is easy
enough, but I'm still looking to go with even less fiddling with
strings, if possible.

Anyway, thanks for taking care.

Steffen Hoffmann
(hasienda)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkwxpJwACgkQ31DJeiZFuHcbcwCfSHEXKnymELxVd+E34W4Gj0zx
vWsAn0WjjPyZrCchH/XzQtkmNhzFlF2r
=r76S
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to