[Pmwiki-users] including parts of a page, once again
Patrick R. Michaud
pmichaud
Thu Jul 15 14:06:29 CDT 2004
I've got another proposal for an include syntax that includes parts
of a page. Taking a cue from one of J. Meijer's emails, rather than
going for syntactically short I've decided to try the verbose route.
The examples below are PmWiki 2.0 syntax but I can add this into
PmWiki 1.0 if there's demand...
First, we can include lines and paragraphs:
[:include SomePage:] include all of SomePage
[:include SomePage lines=10 :] lines 1-10
[:include SomePage lines=5..10 :] lines 5-10
[:include SomePage lines=5.. :] lines 5 to end
[:include SomePage paras=2 :] first two paragraphs
[:include SomePage paras=2..5 :] paragraphs 2, 3, 4, 5
Next, we can treat anchors as denoting "sections" to be cut from
the page:
[:include SomePage#a :] from #a to next anchor ("section" #a)
[:include SomePage #a..#b :] from #a up to #b
[:include SomePage ..#a :] from beginning to #a
[:include SomePage #a.. :] from #a to end of page
[:include SomePage#a#b :] from #a to #b
[:include SomePage##a :] from beginning to #a
[:include SomePage#a# :] from #a to end of page
Finally, the specifiers can be combined:
[:include SomePage paras=2..5 lines=5 :] five lines from paras 2-5
[:include SomePage #a paras=3 :] first 3 paragraphs of section #a
[:include SomePage #a lines=10 :] first 10 lines of section #a
[:include SomePage #a#b paras=10 :] text from #a up to #b, limited
to 10 paragraphs
I have this new syntax implemented on the 2.0 development wiki at
http://www.pmwiki.org/devel/pmwiki.php .
Based on many suggestions from John Rankn, I'm also considering adding an
"fs" ("full stop") option, where the full stop is a null sequence in the
markup such as `. that indicates the natural breaking point of the
line/paragraph/section. Thus:
[:include SomePage fs :] include SomePage up to the full stop
[:include SomePage #a fs :] section #a up to the full stop
[:include SomePage paras=2 fs :] 2 paragraphs up to the full stop
Comments, suggestions welcome.
Pm
More information about the pmwiki-users
mailing list