[pmwiki-users] CustomMarkup without <p>
Christian Schlatter
ch at schlatter.net
Wed Jun 1 05:37:55 CDT 2005
Patrick R. Michaud wrote:
> On Tue, May 31, 2005 at 06:00:23PM +0200, Christian Schlatter wrote:
>
>>Patrick R. Michaud wrote:
>>
>>>Actually, it'll be easier if you could tell us what your (:gallery:)
>>>Markup looks like, then I can tell you how to fix it. :-)
>>
>>OK, the Markup code looks like this:
>>
>>Markup("gallery", "directive", "/\(:gallery:\)/e", Keep(cs_gallery())");
>>
>>The function cs_gallery() uses the embed class of menalto gallery and
>>returns the gallery body content. When I write (:gallery:) into a
>>wikipage, the produced HTML looks something like:
>
>
> The problem is that PmWiki doesn't have any easy way to know that
> the Keep() result contains block markup. The easy way to fix this
> is probably to do:
>
> Markup("gallery", "directive",
> "/^\\(:gallery:\\)/e",
> "'<:block>'.Keep(cs_gallery())");
>
> where the '<:block>' tells PmWiki that the item that follows isn't
> paragraph text. Note that this restricts (:gallery:) to appearing
> at the beginning of a markup line.
>
> Another way to do this (without restriction to beginning of line)
> may be to move the <div> generated by cs_gallery outside of
> the Keep(), as in:
>
> Markup("gallery", "directive",
> "/\\(:gallery:\\)/e",
> "'<div id=\"gallery\">'.Keep(cs_gallery()).'</div>'");
>
> PmWiki will then see the <div> and know to not treat it as a
> paragraph. (I've thought about trying to make the block
> markup smart enough to "look inside" of Keep() text for block
> markupsi to prevent paragraph formatting, but that's a *lot*
> more difficult than what I have now.
>
> One last note -- keep in mind that the use of id="gallery" in
> the <div> tag will mean that only one (:gallery:) can be
> used in a page and still produce valid XHTML.
Cool! I went for the second solution, since I'm thinking of implementing
something like (:gallery photo_id="xy":), which includes only one
picture and so could be called inline too.
I also remarked that if the content starts with an HTML comment like
<!--G2_embeded-->, the <p>'s are here again. Maybe this could be changed
in the future, although this is a minor issue.
Thanks also for your note regarding id vs. class, I now use <div
class="gallery">.
Cheers,
Christian
More information about the pmwiki-users
mailing list