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

Christian Ridderström chr
Sat Apr 17 08:06:00 CDT 2004


On Fri, 16 Apr 2004, Patrick R. Michaud wrote:

> I think I find it a bit confusing that 
> 
>     [[include:PageName#anchor]]
> 
> returns everything before #anchor

I also find that confusing. Further more, I basically agrees with
Patricks idea for the semantics, but I'd like to change it with
respect to how: [[include:PageName#anchor]] is interpreted.

Let us first look at the syntax. The syntax that was described before
can be written down as:

    '[[include:' <PageName> [ '#'[<Anchor1>] ['#'[<Anchor2>] ] ] ']]'

and it allows these combinations:

	[[include:PageName]]
	[[include:PageName#]]
	[[include:PageName##]]
	[[include:PageName#Anchor1]]
	[[include:PageName#Anchor1#]]
	[[include:PageName#Anchor1#Anchor2]]
	[[include:PageName##Anchor2]]

which we want to give a meaning. Now, I like the notation

	[[para:PageName#anchor]]

which allows me to include only a single paragraph from a page, and I'd
like to assign this to [[include:PageName#anchor]].

So what kind of stuff do we want to include?
* Include an entire page
* Include a paragraph with a specific anchor
* Include the first paragraph of a page
* Include named paragraph up to just before another named paragraph
	#from <= included-stuff < #to
* Include named paragraph and the rest of the page
	#from <= included-stuff
* Include everything up to just before a named paragraph
		 included-stuff < #to

First two notations which have an "obvious" meaning to me:

	[[include:PageName]]	- all paragraphs: 
	[[include:PageName#A]]	- paragraph with anchor 'A': para = #A

Then just as Patrick, let us assume that

	[[include:PageName#A#B]] - includes: #A <= para < #B

If we now don't write 'A', I think that should take away the condition, i.e.

	[[include:PageName##B]]	- includes: '0' <= para < #B

and similarly

	[[include:PageName#A#]]	- the range: #A <= para < 'infinity'

Consequently, with both 'A' and 'B' empty, we should get:

	[[include:PageName##]]	- all paragraphs: '0' <= para < 'infinity'

This leaves us with one unassigned notation:

	[[include:PageName#]]

which I'd like to use to select the first paragraph of a page.


In case the above was confusing, here's a list of examples:

Example			Action
[[include:PgName]]	Includes entire page called 'PgName'
[[include:PgName#]]	Include 1st paragraph of the page called 'PgName'
[[include:PgName#A]]	Include paragraph with anchor #A, i.e named 'A'
[[include:PgName#A#]]	Include paragraph '#A' and the rest of the page
[[include:PgName##B]]	Include all paragraphs up to paragraph '#B'
[[include:PgName#A#B]]	Include paragraph '#A' up to paragraph '#B'
[[include:PgName##]]	Includes all paragraphs, i.e. entire page


Finally, to confuse the issue further, here are some alternative
suggestions for including a range:

	[[include:PageName#A..#B]]	
	[[include:PageName#A-#B]]

Alternative suggestions for including an open range:

	[[include:PageName#TOP#B]]
	[[include:PageName#A#END]]

i.e. we introduce predefined names for beginning and end of a page.

Combining the above, we could have:

	[[include:PageName#TOP..#B]]
	[[include:PageName#A..END]]

or for that matter, 

	[[include:PageName#..#B]]
	[[include:PageName#A..]]


> Perhaps the semantics should include/exclude the entire markup line
> containing the anchor(s), as opposed to the text
> immediately/following the anchor.

Yes, I think the entire line should be considered one entity. If you
actually wanted to split something up, could you do it like this?

	Bla bla bla bla bla bla bla bla bla \
	[[#anchor]]aba aba aba aba
	baba baba baba baba

so that [[include:PageName#anchor]] will insert:

	aba aba aba aba
	baba baba baba baba

/Christian

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





More information about the pmwiki-users mailing list