[pmwiki-users] Fixme icon

Petko Yotov 5ko at 5ko.fr
Fri Jan 10 04:54:40 PST 2020


On 10/01/2020 13:07, Robert Riebisch wrote:
> Did you mean:
> 
> Put this to config.php:
> 
> 	Markup('FIXME', 'directives', '/\\(:FIXME:\\)/',
> "$PubDirUrl/fixme.gif\"FIXME\"");
> 
> *And* this to pub/css/local.css:
> 
> 	img[src$="fixme.gif"] { vertical-align: middle; }
> 
> ?

Yes.

> Is
> 	img[src$="fixme.gif"] { vertical-align: middle; }
> something special from PmWiki or is it a CSS feature?
> 
> I've never seen that syntax before?

It is a CSS feature, "img tags with attribute src ending with 
fixme.gif", see:

   https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

> No $PubDirUrl required?


> Is pub/css/local.css processed by the PmWiki engine and not just
> delivered to the browser?

If the file exists, a <link> to it is included in the skin, see

    https://www.pmwiki.org/wiki/PmWiki/LocalCustomizations#localcss

> Anyway, I couldn't get it work. :-(

This is in the "field" directory starting from where your index.php is, 
not necessarily where pmwiki.php is. So you would have something like:

/path/to/directory/index.php (it includes pmwiki.php wherever it is)
/path/to/directory/pub/css/local.css

>> If your markup produces line breaks that need to be processed again by
>> the markup engine (like the divend needs to be start-of-line to work),
>> you need to either do it before the "split" rule, or have a function
>> that calls the function PRR().
> 
> OK
> 
>> In your case the former is easy, instead of 'directives' use '<split' 
>> as
>> a second argument. For the latter, see PmWiki:CustomMarkup and
>> PmWiki:Functions or some existing addon.
> 
> I used '<split' like this:
> 	Markup('FIXME', '<split', '/\\(:FIXME:\\)/', "(:div
> class=icon:)$PubDirUrl/fixme.gif\"FIXME\"\n(:divend:)");
> 
> It works fine together with:
> 	img.icon { vertical-align: middle; }
> 
> But it breaks, when there's something else on the same line, e.g.,
> 	(:FIXME:) CPU, RAM, disk space, OS
> 
> HTML source code will become:
> 	<div class='icon' ><img src='https://{**snip**}/pub/fixme.gif'
> alt='FIXME' title='FIXME' />
> 	</div> CPU, RAM, disk space, OS
> and "CPU, RAM, disk space, OS" will be shown on a separate line, which
> is not, what I want (or how DokuWiki works).
> 
> 	Markup('FIXME', '<split', '/\\(:FIXME:\\)/', "(:div
> class=icon:)$PubDirUrl/fixme.gif\"FIXME\"\n(:divend:)\\");
> 
> produces:
> 	<div class='icon' ><img
> src='https://wiki.bttr-software.de/pub/fixme.gif' alt='FIXME'
> title='FIXME' />
> </div>\ CPU, RAM, disk space, OS

Well, you added a (:div:) division block which almost universally 
browsers separate from other elements with a line break:

   https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div

I thought that's what you wanted. :-)

You can probably use an inline span element like 
'%icon%$PubDirUrl/fixme.gif"FIXME"%%' .

Try to make your local.css work, it is a very useful feature (also 
assumed to work by many addons).

Petko



More information about the pmwiki-users mailing list