[Pmwiki-users] [[include]] variant

J. Meijer commentgg
Tue Jul 6 17:42:41 CDT 2004


The [[include]] directive hasn't been completed yet and here comes a request
for a variant.

When including a page you need to take care formatting that page. When you
forget the closing newline, paragraps join. This is like GroupHeader used to
be. So the request is to now enable the same feature for includes, so an
include is always at least in a paragraph of its own.

Of course there are situations where the include should not do this. Though
I haven't encountered them. That would require an alternate syntax.

Suggestion for both syntax forms:

  [[include: page#anchor]]
  [[paragraph: page#anchor]]

Where the latter cares to properly insert newlines.


I'd very much like to see the [[include: page#anchor]] variant to work. But
I understand our biggest friend and virtual employee has other things on his
hands... and after all I could do it myself :-/

Thinking of an implementation I would prefer to extend the ReadPage function
to accept the selection parameters. So include requests a pageref along with
a selection string such as '#anchor paragraph 2 line 1'. This has several
advantages:
- all reads and associated processing are centralized;
- select functionality becomes part of the pmwiki api;
- wiki:group.page#anchor includes from within a .tmpl will work;
- an include may serve as a front-end to an SQL back-end.
Let's just wait and see someone offer the required selection function.


Finally, the include could receive an add-on syntax like this:

  [[frame [<name>]:\\---- The following text is included from page
$title\\$text\\---- ]]

This would define an optionally named frame for any included text. $title
and $text are replaced by the name of the included page and its contents.
When the page isn't found, the frametext would not appear.


This last solution could have a default that solves the problem I began with
without resorting to an additional [[paragraph]] syntax. We may see this
appear:

  [[include: page#anchor paragraph 2 line 1 frame <name>]]
  [[include: page#anchor paragraph 2 line 1 noframe]]

Pmw2 syntax:

  [:include page#anchor paragraph 2 line 1 noframe:]

The latter construct would cancel the hidden framing I just requested.

Let's make the ':' after the include optional, requiring a space instead.

jan



---------------------------------------------------------
"Asking only workmans wages I've come looking for a job. But I get no
offer" -- Simon & Garfunkel. Me too, anyone?






More information about the pmwiki-users mailing list