[ZPT] Re: [Zope-CMF] ZPT Problems
Joerg Lehmann
joerg@luga.de
Tue, 18 Dec 2001 22:48:30 +0100
Hi Tres,
On 15.12.01, Tres Seaver wrote on the topic of expanding METAL-macros
during edits:
> This issue is hard to solve in a way that doesn't penalize
> one side or the other:
>
> - People using WYSIWYG tools expect the expansion of METAL
> macros, so that the templates look as they will when used
> "live";
>
> - People who use the textarea, or a text-based WebDAV/FTP
> editor, typically *don't* want the expansion, which obscures
> the "real" parts of the template.
Talking about editing via the textarea, I think it would really be
nice, if the checkbox "Expand macros" worked as expected, i.e switch
between the two aforementioned situations... Apart from that, another
problem of the corresponding code is, that it saves the "Expand macros"
switch in the page template (cf. ZopePageTemplate.pt_editAction). IMHO,
this is conceptually wrong, since, just as you described it above,
expanding or not is more a question of presentation than of content --
yeah, in this context, I would call a page template content, and now I
begin to understand, why it is not called presentation template anymore :)
> Perhaps we should patch PageTemplates to use some configurable
> switch (an environment variable, or a command-line switch? A
> globally-acquired attribute?) for the default value now stored
> in 'PageTemplate.expand'.
Any of these solutions seem to be better than always having to patch the
corresponding file ;-), but as I said above, the switch belongs more to
the presentation realm, than to that of content. Thus, I would prefer
a solution, which allows the user to set this value via the "Expand
macros" checkbox and (for the default behaviour) in "Browser Preferences".
In other words, I think it should work exactly like for instance the
settings for the size of the textarea. Of course, I have to admit, that
for editing via WebDAV/FTP such a simple solution doesn't exist...
> Another alternative would be to add a knob to PageTemplate which
> strips out everything that supplied by METAL (maybe we spell that
> by supplying the path to an "empty" template, an do the expansion
> using the empty template, followed by setting 'self.expand=0'?)
If I understood you right, you are talking of going back to an unexpaned
version of the page template, right? I think this functionality would be
necessary anyhow, since you have to be able to switch at any time between
the two expansion states, if a toggle "Expand macros" should make any
sense at all.
Greetings,
Joerg Lehmann