X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ccc8e8868269bf2751596e04f792c388acb85c12..20052f888277f270ab846bf8b1eb44714c1009d6:/doc/plugins/contrib/getfield.mdwn?ds=inline diff --git a/doc/plugins/contrib/getfield.mdwn b/doc/plugins/contrib/getfield.mdwn index ed03dc439..0a92894f1 100644 --- a/doc/plugins/contrib/getfield.mdwn +++ b/doc/plugins/contrib/getfield.mdwn @@ -1,5 +1,5 @@ [[!template id=plugin name=getfield author="[[rubykat]]"]] -[[!tag type/meta]] +[[!tag type/meta type/format]] [[!toc]] ## NAME @@ -18,13 +18,13 @@ use per-page structured data, where each page is treated like a record, and the structured data are fields in that record. This can include the meta-data for that page, such as the page title. -This plugin is meant to be used in conjunction with the B plugin. +This plugin is meant to be used in conjunction with the [[field]] plugin. ### USAGE One can get the value of a field by using special markup in the page. This does not use directive markup, in order to make it easier to -use the markup inside other directives. There are two forms: +use the markup inside other directives. There are four forms: * {{$*fieldname*}} @@ -39,6 +39,26 @@ use the markup inside other directives. There are two forms:

My Long and Complicated Title With Potential For Spelling Mistakes

+* {{$*pagename*#*fieldname*}} + + This queries the value of *fieldname* for the page *pagename*. + + For example: + + On PageFoo: + + \[[!meta title="I Am Page Foo"]] + + Stuff about Foo. + + On PageBar: + + For more info, see \[[{{$PageFoo#title}}|PageFoo]]. + + When PageBar is displayed: + + <p>For more info, see <a href="PageFoo">I Am Page Foo</a>.</p> + * {{+$*fieldname*+}} This queries the value of *fieldname* for the destination page; that is, @@ -68,18 +88,44 @@ use the markup inside other directives. There are two forms:

I Am Page B

Stuff about A.

+* {{+$*pagename*#*fieldname*+}} + + This queries the value of *fieldname* for the page *pagename*; the + only difference between this and {{$*pagename*#*fieldname*}} is + that the full name of *pagename* is calculated relative to the + destination page rather than the source page. + + I can't really think of a reason why this should be needed, but + this format has been added for completeness. + +### No Value Found + +If no value is found for the given field, then the field name is returned. + +For example: + +On PageFoo: + + \[[!meta title="Foo"]] + My title is {{$title}}. + + My description is {{$description}}. + +When PageFoo is displayed: + +

My title is Foo.

+ +

My description is description.

+ +This is because "description" hasn't been defined for that page. + ### More Examples Listing all the sub-pages of the current page: \[[!map pages="{{$page}}/*"]] -### LIMITATIONS - -One cannot query the values of fields on pages other than the current -page or the destination page. - ## DOWNLOAD -* browse at GitHub: +* browse at GitHub: * git repo at git://github.com/rubykat/ikiplugins.git