[pmwiki-users] Formatting numbers

john.rankin at affinity.co.nz john.rankin at affinity.co.nz
Thu Jan 22 02:39:43 CST 2009


> Date: Wed, 21 Jan 2009 03:21:53 +0100
> From: Marcus <prima at wordit.com>
>
>> Markup('fmtzero','inline','/([\d]+\.\d)(\s)/e',"'$1'.'0 '");
>
> Thanks John, but I can't figure out how to use this on a specific line,
> e.g. as
> (:fmtzero 1.5:)
> to generate the output "1.50".
>
>
> Marcus
>
It depends on precisely what you mean by "on a specific line".
You probably need to

- change 'inline' to '<name of the fmtzero markup rule'
   e.g. if you have Markup('myfmt', ...); then you need
   Markup('fmtzero', '<myfmt', ...);

- change the (\s) to (\s|:) so that (:fmtzero 1,5:) and
   (:fmtzero 1.5 :) both work

But if you mean I can write 1.5 and it displays 1.5, but if
I write (:fmtzero 1.5:) it displays 1.50, then the rule needs
to be tightened. But in that case, why not just write 1.50?

Perhaps you could describe what you are doing in more detail?

JR





More information about the pmwiki-users mailing list