[Pmwiki-users] [[include: ... ]] part of a page

Patrick R. Michaud pmichaud
Fri Apr 16 11:24:04 CDT 2004


On Thu, Apr 15, 2004 at 10:20:45AM +1200, John Rankin wrote:
> This is a small enhancement request.
> It would be very useful (and trivial to implement) to write:
>     [[include:PageName#anchor]]
> and have pmwiki return the text up to and excluding [[#anchor]]. 
> [...]
> There is an obvious extension to support:
>     [[include:PageName#from#to]]
> to return the text between the anchors. If [[#to]] is not in PageName, 
> return the text from [[#from]] to the end. 

I think I find it a bit confusing that 

    [[include:PageName#anchor]]

returns everything before #anchor, while

    [[include:PageName#anchor#end]]

returns everything after #anchor and before #end.  How about discarding
the first syntax and using only the second, so that it's always

    [[include:PageName#from#to]]

If [[#from]] isn't in PageName, then the return the text up to and
excluding [[#to]]; if [[#to]] isn't in PageName, then return the text
immediately following [[#from]].  If neither are in PageName, return the
entire page.  This leaves the "degenerate" cases of:

    [[include:PageName#from#]]  - include everything after [[#from]]
    [[include:PageName##to]]    - include everything before [[#to]]

and I by symmetry then think that [[include:PageName#from]] would mean
"include everything after [[#from]]" (which differs from the original
proposal).

Also, I'm concerned that this feature could result in a large number of 
surprises and unexpected/unwanted behaviors--if the target (included) 
page has markups like:

    !!![[#anchor1]] Heading 1
    * Bullet
    * [[#anchor2]] Bullet 2
    * Bullet
    Here is a paragraph [[#anchor3]] with some text in it

then the included text becomes a bit bizarre when included -- e.g.,

    wiki wiki
    [[include:PageName#anchor1#anchor2]] 
    waki waki

results in

    wiki wiki
     Heading 1
    * Bullet
    * 
    waki waki

in which Heading 1 is now monospaced (not a heading) and there's
an extra bullet.  Perhaps the semantics should include/exclude the
entire markup line containing the anchor(s), as opposed to the text
immediately/following the anchor.

Also, I don't if this relates at all to the proposal given here, but I'm 
still planning to provide a ConditionalMarkup feature whereby sections 
of markup text can be included/excluded based on date, language,
or other conditions (see the thread surrounding http://contra.vosn.net/pipermail/pmwiki-users_pmichaud.com/2004-January/001902.html).

Pm



More information about the pmwiki-users mailing list