[Pmwiki-users] Re: include part of a page syntax, revisited

Christian Ridderström chr
Wed Jun 16 02:43:53 CDT 2004


On Tue, 15 Jun 2004, Patrick R. Michaud wrote:

> Hi, all-
> 
> I'd like to revisit a discussion we held previously about potential
> syntaxes for including parts of other pages.  The current syntax is
> 
>     [[include:PageName#start#end]]
> 
> which means include the portion of PageName between the [[#start]]
> and [[#end]] anchors.  As a special case, #start and #end can be
> numeric, in which case they refer to line numbers of the markup source
> in the page.

I think it'd look pretty and *very* intuitive if

        [[include:PageName#1-20]]

included lines 1-20. Is there anything bad with using this?

> I'd like to extend this markup somehow to be able to support
> including a portion of a page starting from any anchor to include
> the remainder of the page or the next N lines, paragraphs (delimited 
> by blank lines) or anchors.  For orthogonality's sake it might be
> nice to be able to include N lines/paragraphs/anchors before an ending
> anchor, but I haven't come up with any real uses for this

See my other mail for an example of how it could be useful.

> won't hurt if it's not supported.  (Including *everything* before
> a given anchor should of course be supported, but I think we can
> continue to use the #1#end syntax for this.)

I'd prefer: [[include:Page#1-end]] or [[include:Page#1-]] and conversely,
[[include:Page#-20]], but only if it's obvious what that does...

> My best idea so far is to make use of the + sign somehow (+ isn't allowed
> in anchor names)

Is '-' allowed in achor names?

>, as in
> 
>     SomePage#from+10      ten lines after #from
>     SomePage#from+3p      three paragraphs after #from
>     SomePage#from+2a      #from and text following next two anchors
>     SomePage#from+0a      #from up to the next anchor
>     SomePage#from         shortcut for above

I like the above, but...
* We should allow 'P' as well as 'p' for paragraph
* I think 'SomePage#from' should be equivalent to 'Somepage#from+1p', i.e
  the default is to include the entire paragraph. That's something I'd 
  need a lot more often.

> this would also allow
> 
>     SomePage+10           include first ten lines of SomePage
>     SomePage#1#10         same as above
>     SomePage#5+10         include ten lines starting with line 5
>     SomePage+1p           include first paragraph of SomePage
>     SomePage+2a           include start and next two anchors
>     SomePage+0a           include everything up to first anchor
>     SomePage#1#to         include everything before #to

Why not allow a '#' in 'SomePage+1p', making it 'SomePage#+1p'. To me an 
empty anchor would imply the beginning. Without the '+' I think that it's 
a part of the page name...
 
> The only item I'm unsure of is "include everything after #from", but I'm
> sure we can come up with something appropriate for that (e.g., a
> pseudo-anchor such as #end).

How about one of these:

	[[include:Page#from+]]
	[[include:Page#from-]]
	[[include:Page#from -]]
	[[include:Page#from..]]
	[[include:Page#from#]]
	[[include:Page#from#-]]
	[[include:Page#from#-]]
	[[include:Page#from#END]]

I like [[include:Page#anchor-]] or [[include:Page#anchor -]]. If '-' is
allowed in an anchor, maybe we could make an exception when it's the 
last character. Or we could make a special case when the anchor 'anchor' 
exists on the page, but 'anchor-' doesn't.

/Christian

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





More information about the pmwiki-users mailing list