[pmwiki-users] Re: Modified (:markup:)
chr at home.se
chr at home.se
Sun Mar 20 10:56:09 CST 2005
On Sun, 20 Mar 2005, Patrick R. Michaud wrote:
> > I think we should just swallow the pill and force a change of all
> > (:markup:) [=...=]
> > into
> > (:markup:) ... (:markupend:)
> I don't know how many people out there are using (:markup:) in their
> sites -- I'd hate to capriciously break that.
> As an interim, we could just say that we allow (:markup:) [= ... =]
> as long as the [= is on the same line is (:markup:), while all others require
> (:markupend:). This is how I've done all of my markups, even though
> (:markup:) currently allows the [=...=] to appear on a subsequent line.
Sounds good for now I guess, but I wonder if it isn't the original syntax
of (:markup:) that is partially to blame here. We've always used [=...=]
to "escape" something from being parsed. Now we are suddenly using [=...=]
as a grouping mechanism to pass arguments... Thinking that [=...=] simply
kept the '...' as a string, I thought (:markup:) merely took the remainder
of the "line" as it's argument. However, when testing I was surprised that
this doesn't work:
(:markup:)Here is a [[link]]
I had assumed that [=...=] was *only* used to escape the newlines and not
part of the formal syntax... OTOH, maybe it should then be written as
"(:markup Here is a link [[link]]:)"?
Something else that surprised me was that you could write the [=...=] on
the next line, probably because of my earlier assumption. So I think we
can conclude that the markup isn't very intuitive, at least not for me.
In addition, I'm very uncertain about how the whitespace is really
interpreted by (:markup:), i.e. what whitespace is really significant?
Btw, if we assume that the argument to (:markup:) should be given *inside*
the brackets, we could imagine writing
where the string received by markup() would look as follows:
Here's a more complicated example:
(:markup [=An escaped link directive, [=[[link]]=]=], cool?:)
resulting in the following string for markup():
"An escaped link directive, [=[[link]]=], cool?
I admit it's not very readable, but shouldn't it always work? I think the
reason it works is that we've separated the escape mechanism from the
token that indicates the end of the markup directive. It should therefore
work just as well with (:markup:)...(:markupend:). The only problem is
that it gets messy when you want to pass "[=...=]" as an argument.
Here's a relatively simple example...
(:markup:)You can use [=[==]...=] to escape things.(:markupend:)
------------ -- -----------------------
"You can use [=...=] to escape things."
How could we escape the entire string instead? Well, here's one way:
[=You can use [=...=]=][= to escape things.=]
----------------- -- ------------------
Btw, for all of us who finds it tricky to (un)escape a string, maybe it'd
be convenient with pmwiki function that helps us with it? Sort of like the
Somewhat related: If we would like to pass multiple arguments, we could
say that *whitespace* is used to separate the arguments and use [=...=] to
escape the whitespace is actaully part of an argument.
> Probably (:markup:) ... (:markupshows:) ... (:markupend:).
You're right, that looks better.
> > Personally, I'd very much appreciate [=...=] that can be nested...
> Oh, based on one of Neil's suggestions, and to borrow an idea from
> another markup language, how about if we allow more than one equals
> (or @) on either side? Thus:
> [== This is something that contains [=escaped markup=] ==]
I have a feeling this might conflict with earlier cases where I've written
similar text just in order to escape things properly... and in addition I
get the feeling we're opening a huge can of worms with this... might work
Hmm... what about becoming more verbose instead? What about something like
(:markup:) (:arg:) ...
whatever we like [= ...=]
although maybe it shouldn't be 'arg'-'argend', but perhaps 'begin'-'end'?
Could this be made to nest properly? We'd probably still have a problem
with [=...=] though, unless we give (:arg:)..(:argend:) higher priority.
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users