[pmwiki-users] possible to generate a p or div tag within li with standard markup
Petko Yotov
5ko at 5ko.fr
Fri Aug 10 18:46:19 CDT 2012
shout at joshleepictures.com writes:
> In order to do some fancy css stuff without having to traverse the DOM with
> jQuery I would like to generate an <div></div> within a <li> by using
> standard markup.
>
> My preferred syntax would be something like this:
> * Attach:someImage.jpg \\
> (:div class="fancyTitleBox":)e. g. title of the picture(:divend:)
>
> Of course this does not work (because (:div:) has to be on the beginning of
> a line which previous line is not ended by \\).
This is not possible with standard markup, but you can add a custom markup.
Something like this in config.php:
Markup('ftbox', 'inline', "/\\(:ftbox:\\)(.*?)\\(:ftboxend:\\)/s",
'<div class="fancyTitleBox">$1</div>');
Then use
* Attach:someImage.jpg (:ftbox:)my title (:ftboxend:)
Note that this markup, in some cases, may produce invalid HTML and it can
potentially break some scripts. So, be carefull not to place the div element
inside inline elements like strong, em or span.
> so far the only thing I can
> generate with standard markup is a span, which is very restricted in terms
> of CSS. Span:
> * Attach:someImage.jpg \\
> %%fancyTitleBox%%e. g. title of the picture%%
It would be %fancyTitleBox% and not %%fancyTitleBox%% (single %'s).
A span is not more restricted than a div, neither in CSS, not in jQuery. If
you want a span to look like a div, apply to it display:block CSS.
If you use JavaScript, note that PmWiki has an out-of-the box way to add
standard title attributess to images, and you may find it easier to use them
than searching for div blocks:
Attach:someImage.jpg"This is the standard Title attribute"
OTOH if your div/span solution is CSS-only, it may be even easier and very
elegant.
Petko
More information about the pmwiki-users
mailing list