[pmwiki-users] Free markup character?
Patrick R. Michaud
pmichaud at pobox.com
Wed Apr 5 18:18:37 CDT 2006
On Thu, Apr 06, 2006 at 10:25:50AM +1200, Allister Jenks wrote:
> Help!
>
> I want to create a new markup that is very quick to type to style
> individual words (or occasionally a couple of words).
>
> I tried ;this; and it works fine, but breaks the >><< markup!! Looking at
> my keyboard I can't see any symbols that have not yet been used except for
> "?" (and I thought ";") and am too unfamiliar with regex to work out how
> to create a safe markup. I don't want any more than 2 characters either
> side of the word(s) because I will be using it all over the place. The
> goal is to style the words blue and italic.
>
By convention PmWiki has always explicitly reserved the '='
character for custom markup sequences.
> Can anybody educate me on why I broke >><< by defining ";", and/or suggest
> a suitable markup I could implement?
>
> I had Markup("", "inline", "/;(.*?);/", "<span style='font-style:italic;
> color:#0000c0;'>$1</span>");
It's probably not the semicolon that broke the markup...there
appear to be a couple of issues with the rule as written here:
1. Every markup needs a name; I don't know how PmWiki will
react to using "" as a markup name. (I suspect not well at all.)
2. Semicolons occur in lots of places other than markup text.
In particular, the string you're using to replace ";(.*?);"
contains a pair of semicolons itself. Since the replacement
string isn't escaped or preserved in any way, the semicolon
replacement pattern is probably being a bit over-eager and
adding <span> around any pair of semicolons it may happen to find --
even those that are coming from other HTML tags or other markups.
This last point is similar to the reason why it's difficult to do a
markup like /italic/ -- there are a lot of things that
have slashes in them that aren't intended to be italics,
such as urls (http://www.pmwiki.org/wiki/PmWiki), fractions (3/4),
and/or, closing HTML tags such as </b>, </span>, etc.
Pm
More information about the pmwiki-users
mailing list