[Pmwiki-users] Re: new directive tag syntax (was: Pmwiki new version)

Christian Ridderström chr
Sat Jun 12 07:58:54 CDT 2004


On Fri, 11 Jun 2004, Patrick R. Michaud wrote:

> On Thu, Jun 10, 2004 at 08:02:07AM -0700, Wayne Lee wrote:
> > 
> > why have separate syntax for values
> > and directives?
> 
> I think the biggest reason is that values sometimes need to appear
> within a directive, and the separate syntax becomes easier to read.
> For example, I think it's much easier for people to read and parse
> 
>    [:search {$Group}/ text:]
> 
> than it is to read
> 
>    [:search [:group:]/ text:]
>    {{search {{group}}/ text}}
>    (.search (.group.)/ text.)

Why don't you compare your example with:

	(.search (.$Group.)/ text.)

where there is also a dollar sign in front of 'Group'. Actually, why not 
simply introduce a directive that shows the value of a variable. This 
directive could simply be a '$' like this:

	(.$<variable-name>.)

But if you really feel that you want to use {}, I'd like it if it was 
possible to write

	[:search ${Group}/ text:]

because having '$' in front of '{' is much more familar to me. 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:]


> 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?

> To me a value and a directive are slightly different--a directive usually
> implies we want to perform (or suppress) some action, whereas a value
> is just a simple text substitution.  Again, I'll go back to the notion
> of title--I think we need both a directive to set a page's title as well
> as a way of displaying the page's title in the output.  To me this
> implies different markup
> 
>    [:title my page's title:]  -- set the title for the page
>    {$Title}                   -- substitute page's title here

I think I'd prefer one of these

	[:${Title}:]
	[:$Title:]

> although that doesn't have to be the case
> 
>    [:settitle my page's title:]
>    [:title:]                

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.

> The extra character at the end of the directive buys a *lot*, namely, the
> ability to include a closing bracket in a parameter.

That's a good reason IMO.

/Christian

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list