[Pmwiki-users] Re: Re: new directive tag syntax (was: Pmwiki new version)
Christian Ridderström
chr
Sat Jun 12 12:48:06 CDT 2004
On Sat, 12 Jun 2004, Patrick R. Michaud wrote:
> On Sat, Jun 12, 2004 at 03:58:47PM +0200, Christian Ridderstr?m wrote:
> > Why don't you compare your example with:
> > (.search (.$Group.)/ text.)
> > where there is also a dollar sign in front of 'Group'.
>
> This works for me.
Ok.
> > Actually, why not simply introduce a directive that shows the value of
> > a variable. This directive could simply be a '$' like this:
> > (.$<variable-name>.)
>
> ...because I figure it's not a good idea from a security point of view
> to allow authors to be able to access arbitrary variables through the
> markup. In general it's probably okay, but some people may not want
> pathnames or the like to be availab.e
My fault, I wasn't clear enough. I didn't actually mean that *any*
variable could be extracted this way. The '<variable-name>' is only valid
if it matches some list of "variables". In fact, it might not even be a
variable that's accessed but rather a function that outputs some text.
When I think about it, that's what this is about -- a directive that
inserts/prints some text. When you look at it from that point of view the
'$' wouldn't make much sense to a normal user... What I mean conceptually
is a directive that looks like:
(.show <thing-to-show>.)
and an example whould be: (.show title.). So when writing (.$title.) it
should be interpreted as "show title" at this point. Some alternatives
could be:
(.print title.)
(.echo title.)
Or is that too much like programming to a normal user?
> > Another
> > alternative could be to simply allow:
> > [:search $Group/ text:]
> > but I guess that then we'd have to introduce quoting, i.e. if you
> > literally want to search for '$Group', you'd have to write:
> > [:search [=$=]Group/ text:]
>
> and this would be nasty, because I figure that $-phrases are more
> often taken literally than they are meant to be a substitution.
> That's certainly been the case in all of the PmWiki pages.
Ok, it surprises me but I'll take your word for it.
> > > nested directives with the same syntax can make the programming side of
> > > things *much* more complicated
> >
> > Do you mean that we'd need a recursive parser, or that the regular
> > expressions becomes complicated?
>
> The regexps become much more complicated, because they have to understand
> nested parenthesis and phrases (and there's not an easy way to say
> "any sequence of characters that doesn't include '.)'".
Ok. just checking really.
> > Or possibly one of the following
> >
> > Assigning title Extracting title
> > (.title := My page's title.) (.title.)
> > (.$title := My page's title.) (.$title.)
> > (.${title} := My Page's title.) (.${title}.)
> >
> > My point is that since we're assiging the title, we could simply make this
> > apparent from the syntax.
>
> Apparent to programmers maybe, but this is really likely to scare off
> authors because it *looks* like programming.
Good point... (although I don't think looking like programming would scare
off my LyX-users).
/Christian
--
Christian Ridderstr?m http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list