Wiki source code of XWikiSyntaxLinks

Last modified by admin admin on 2020/04/02 19:17

Show last authors
1 = Editing =
2
3 == Links ==
4
5 === 1.0 Links ===
6
7 |=(% style="width:20%" %)Feature|=XWiki Syntax 1.0|=(% style="width:20%" %)Result
8 |Link to a page in the current Space|{{{[WebHome]}}}|[[Web Home>>WebHome]]
9 |Link with a label|{{{[label>WebHome]}}}|[[label>>WebHome]]
10 |Link with XWiki Syntax in the label|{{{<a href="$xwiki.getURL("WebHome")"><strong>bold label</strong></a>}}}|[[**bold label**>>WebHome]]
11 |Link to a page with the space specified|{{{[Main.WebHome]}}}|[[Web Home>>Main.WebHome]]
12 |Link to a subwiki|{{{[subwiki:Main.WebHome]}}}|[[Web Home>>xwiki:Main.WebHome]]
13 |Link that opens in a new window|{{{[label>WebHome>_blank]}}}|[[label>>WebHome||target="_blank"]]
14 |Link to a URL directly in the text|{{{This is a URL: http://xwiki.org}}}|This is a URL: http://xwiki.org
15 |Link to a URL|{{{[http://xwiki.org]}}}|[[http://xwiki.org]]
16 |Link to a URL with a label|{{{[XWiki>http://xwiki.org]}}}|[[XWiki>>http://xwiki.org]]
17 |Link to an email address|{{{[john@smith.net>mailto:john@smith.net]}}}|[[john@smith.net>>mailto:john@smith.net]]
18 |Image Link|{{{<a href="$xwiki.getURL("Space1.Page1")">{image:img.png|document=Space2.Page2}</a>}}}|[[image:XWiki.XWikiSyntaxLinks@img.png>>Main.WebHome]]
19 |Image Link with image parameters|{{{<a href="$xwiki.getURL("Space1.Page1")">{image:img.png|document=Space2.Page2|width=26|height=26}</a>}}}|[[[[image:XWiki.XWikiSyntaxLinks@img.png||width="26" height="26"]]>>Main.WebHome]]
20 |Link to an attachment on the current page|(((
21 {{info}}See [[Attach Macro>>http://extensions.xwiki.org/xwiki/bin/view/Extension/Attach+Macro+%28Radeox%29]] for details{{/info}}
22 {{{{attach:text|file=img.png}}}}
23 )))|[[text>>attach:XWiki.XWikiSyntaxLinks@img.png]]
24 |Link to an attachment in a different page|(((
25 {{info}}See [[Attach Macro>>http://extensions.xwiki.org/xwiki/bin/view/Extension/Attach+Macro+%28Radeox%29]] for details{{/info}}
26 {{{{attach:text|document=Space.Page|file=img.png}}}}
27 )))|[[text>>attach:XWiki.XWikiSyntaxLinks@img.png]]
28 |Link to an Anchor in a page|{{{[label>Space.Page#anchor]}}}|[[label>>XWiki.XWikiSyntax||anchor=anchor]]
29 |Link to a Heading in a page|(((
30 {{{[label>Space.Page#HMyheading]}}}
31 )))|[[label>>XWiki.XWikiSyntax||anchor=HMyheading]]
32
33 {{info}}When you add a Heading, an anchor named "H" followed by the heading title with only alpha characters is created. For example, for a Heading named "My heading", the generated anchor will be "HMyheading".{{/info}}
34
35 {{velocity}}$subHeading XWiki Syntax 1.0 Link Specification $subHeading{{/velocity}}
36
37 {{info}}
38 Part in ##( )## is required, parts in ##[ ]## are optional and one of the two chars in ##{ }## needs to be added if optional parts are being used.
39 {{/info}}
40
41 The full format of a link is **##[label {> or |}] (resource) [@interWikiAlias] [{> or |} target]##**
42
43 * **##label##**: An optional string which will be displayed to the user as the link name when rendered. Example: ##My Page##
44 * **##resource##**: The full link reference using the following syntax: **##(reference) [?queryString] [#anchor]##**
45 ** **##reference##**: The link reference. This can be either
46 *** **A URI** in the form **##protocol:path##** (examples: ##http:~/~/xwiki.org##, ##mailto~:john@smith.com##), or
47 *** **A wiki page** reference in the form **##~[~[wikiName:] spaceNameList.] (pageName)##**. Examples: ##WebHome##, ##Main.WebHome##, ##mywiki:Main.WebHome##
48 **** **##wikiName##**: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: ##mywiki##
49 **** **##spaceNameList##**: An optional dot-separated list of wiki Space names. If no space is specified the current space is used. Examples: ##Main##, ##A.B##, ##A.B.C##
50 **** **##pageName##**: A required string containing the name of the linked wiki page. Example: ##WebHome##
51 ** **##queryString##**: An optional query string for specifying parameters that will be used in the rendered URL. Example: ##mydata1=5&mydata2=Hello##
52 ** **##anchor##**: An optional anchor name pointing to an anchor defined in the referenced link. Note that in XWiki anchors are automatically created for headings. Example: ##HTableOfContents##
53 * **##interWikiAlias##**: An optional [[Inter Wiki>>http://en.wikipedia.org/wiki/InterWiki]] alias as defined in the InterWiki Map (see the [[Admin Guide>>http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/]]). This is only valid for wiki page names. Example: ##wikipedia##
54 * **##target##**: An optional string corresponding to the HTML ##target## attribute for a HTML ##A## link element. This element is used when rendering the link. It defaults to opening the link in the current window. Examples: ##_self##, ##_blank##
55
56 === 2.0 Links ===
57
58 |=(% style="width:20%" %)Feature|=XWiki Syntax 2.0|=(% style="width:20%" %)Result
59 |Link to a page in the current Space|{{{[[WebHome]]}}}|[[WebHome]]
60 |Link with a label|(((
61 {{{[[label>>WebHome]]}}}
62 {{info}}XWiki Syntax is supported inside link labels.{{/info}}
63 )))|[[label>>WebHome]]
64 |Link with XWiki Syntax in the label|{{{[[**bold label**>>WebHome]]}}}|[[**bold label**>>WebHome]]
65 |Link to a page with the space specified|{{{[[Main.WebHome]]}}}|[[Main.WebHome]]
66 |Link to a subwiki|{{{[[subwiki:Main.WebHome]]}}}|[[xwiki:Main.WebHome]]
67 |Link that opens in a new window|{{{[[label>>WebHome||target="_blank"]]}}}|[[label>>WebHome||target="_blank"]]
68 |Link to a URL directly in the text|{{{This is a URL: http://xwiki.org}}}|This is a URL: http://xwiki.org
69 |Link to a URL|{{{[[http://xwiki.org]]}}}|[[http://xwiki.org]]
70 |Link to a URL with a label|{{{[[XWiki>>http://xwiki.org]]}}}|[[XWiki>>http://xwiki.org]]
71 |Link to an email address|{{{[[john@smith.net>>mailto:john@smith.net]]}}}|[[john@smith.net>>mailto:john@smith.net]]
72 |Image Link|{{{[[image:Space2.Page2@img.png>>Space1.Page1]]}}}|[[image:XWiki.XWikiSyntaxLinks@img.png>>Main.WebHome]]
73 |Image Link with image parameters|{{{[[[[image:Space2.Page2@img.png||width="26" height="26"]]>>Space1.Page1]]}}}|[[[[image:XWiki.XWikiSyntaxLinks@img.png||width="26" height="26"]]>>Main.WebHome]]
74 |Link to an attachment on the current page|{{{[[text>>attach:img.png]]}}}|[[text>>attach:XWiki.XWikiSyntaxLinks@img.png]]
75 |Link to an attachment in a different page|{{{[[text>>attach:Space.Page@img.png]]}}}|[[text>>attach:XWiki.XWikiSyntaxLinks@img.png]]
76 |Link to an Anchor in a page|{{{[[label>>Space.Page#anchor]]}}}|[[label>>XWiki.XWikiSyntax||anchor="anchor"]]
77 |Link to a Heading in a page|{{{[[label>>Space.Page#HMyheading]]}}}|[[label>>XWiki.XWikiSyntax||anchor="HMyheading"]]
78 |Link to an Anchor in the current page|{{{[[label>>#anchor]]}}}|[[label>>||anchor="anchor"]]
79
80 {{info}}When you add a Heading, an anchor named "H" followed by the heading title with only alpha characters is created. For example, for a Heading named "My heading", the generated anchor will be "HMyheading".{{/info}}
81
82 {{velocity}}$subHeading XWiki Syntax 2.0 Link Specification $subHeading{{/velocity}}
83
84 {{info}}
85 The part in ##( )## is required, while the parts in ##[ ]## are optional.
86 {{/info}}
87
88 The full format of a link is **##[label>>] (resource) [@interWikiAlias] [||parameters]##**
89
90 * **##label##**: An optional string which will be displayed to the user as the link name when rendered. The label may contain XWiki Syntax. If no label is specified a default label will be generated. The generation pattern can be changed, see the [[Admin Guide>>http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/]]. Example: ##My Page##
91 * **##resource##**: The full link reference using the following syntax: **##(reference) [?queryString] [#anchor]##**
92 ** **##reference##**: The link reference in one of the following forms:
93 *** **URL**: Any URL in the form of **##protocol:~/~/path##**. Examples: ##http:~/~/xwiki.org##, ##https:~/~/svn.xwiki.org/##
94 *** **Wiki page** reference in the form **##~[~[wikiName:] spaceNameList.] (pageName)##**. Examples: ##WebHome##, ##Main.WebHome##, ##mywiki:Main.WebHome##
95 **** **##wikiName##**: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. Example: ##mywiki##
96 **** **##spaceNameList##**: An optional dot-separated list of wiki Space names. If no space is specified the current space is used. Examples: ##Main##, ##A.B##, ##A.B.C##
97 **** **##pageName##**: A required string containing the name of the linked wiki page. Example: ##WebHome##
98 *** **Attachment** reference in the form **##attach~: [wikiPageName@] (attachmentName)##**. Examples: ##attach~:img.png##, ##attach~:mywiki:Main.WebHome@img.png##
99 **** **##attach~:##** A required string identifying the resource as attachment.
100 **** **##wikiPageName##**: An optional string referencing the page that holds the attachment, see "Wiki page" above.
101 **** **##attachmentName##**: Name of the attachment as it is stored in the wiki.
102 *** **Email address** in the form **##mailto~: (emailAddress)##** (###anchor## is not valid). Example: ##mailto~:john@smith.com##
103 **** **##mailto~:##** A required string identifying the resource as email.
104 **** **##emailAddress##**: Targeted email address. Example: "##john@smith.com##"
105 ** **##queryString##**: An optional query string for specifying parameters that will be used in the rendered URL. Example: ##mydata1=5&mydata2=Hello##
106 ** **##anchor##**: An optional anchor name pointing to an anchor defined in the referenced link. Note that in XWiki anchors are automatically created for headings. Example: ##HTableOfContents##
107 * **##interWikiAlias##**: An optional [[Inter Wiki>>http://en.wikipedia.org/wiki/InterWiki]] alias as defined in the InterWiki Map (see the [[Admin Guide>>http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/]]). This is only valid for wiki page names. Example: ##wikipedia##
108 * **##parameters##**: An optional list of parameters passed to the link. Example: ##target="~_blank"## (open in new window)
109
110 === 2.1 Links ===
111
112 |=Feature|=XWiki Syntax 2.1|=Result
113 |Absolute link to page ##PageB## located in ##PageA##|{{{[[PageA.PageB]]}}}|[[PageB>>]]
114 |Relative link to page ##PageA## from the current page|{{{[[PageA]]}}} or {{{[[.PageA]]}}}|[[PageA>>]]
115 |Relative link to page ##PageB## in ##PageA## from the current page|{{{[[.PageA.PageB]]}}}|[[PageB>>]]
116 |Link with a label|(((
117 {{{[[label>>PageA]]}}}
118
119 {{info}}XWiki Syntax is supported inside link labels.{{/info}}
120 )))|[[label>>]]
121 |Link with wiki syntax in the label|{{{[[**bold label**>>PageA]]}}}|[[**bold label**>>]]
122 |Link on an image|{{{[[image:PageA@img.png>>PageA]]}}}|[[image:XWiki.XWikiSyntaxLinks@img.png>>]]
123 |Absolute link to page ##PageB## located in ##PageA## in wiki ##WikiA##|{{{[[WikiA:PageA.PageB]]}}}|[[PageB>>]]
124 |Link that opens in a new window|{{{[[PageA||target="_blank"]]}}}|[[PageA>>]]
125 |Implicit link to a URL|{{{This is a URL: http://xwiki.org}}}|This is a URL: http://xwiki.org
126 |Explicit link to a URL|{{{[[http://xwiki.org]]}}}|[[http://xwiki.org]]
127 |Explicit link to a URL with a label|{{{[[XWiki>>http://xwiki.org]]}}}|[[XWiki>>http://xwiki.org]]
128 |Link to an email address|{{{[[john@smith.net>>mailto:john@smith.net]]}}}|[[john@smith.net>>mailto:john@smith.net]]
129 |Link to an attachment on the current page|{{{[[attach:img.png]]}}}|[[img.png>>]]
130 |Link to an attachment in a different page|{{{[[attach:PageA.PageB@img.png]]}}}|[[img.png>>]]
131 |Link to an Anchor in a page|{{{[[PageA.PageB||anchor="anchor"]]}}}|[[PageB>>]]
132 |Link to a Heading in a page|(((
133 {{{[[PageA.PageB||anchor="HMyheading"]]}}}
134
135 {{info}}When you add a Heading, an anchor named "H" followed by the heading title with only alpha characters is created. For example, for a Heading named "My heading", the generated anchor will be "HMyheading".{{/info}}
136 )))|[[PageB>>]]
137 |Link to an anchor in the current page|{{{[[label>>||anchor="anchor"]]}}}|[[label>>]]
138 |Link to a page with a query string|{{{[[PageA.PageB||queryString="param1=value1&param2=value2"]]}}}|[[PageB>>]]
139 |Link to the current page with a query string|{{{[[label>>||queryString="param1=value1&param2=value2"]]}}}|[[label>>]]
140
141 {{velocity}}$subHeading XWiki Syntax 2.1 Link Specification $subHeading{{/velocity}}
142
143 {{info}}
144 The part in ##( )## is required, while the parts in ##[ ]## are optional.
145 {{/info}}
146
147 The full format of a link is **##[label>>] (resource) [||parameters]##**
148
149 * **##label##**: An optional string which will be displayed to the user as the link name when rendered. The label may contain XWiki Syntax. If no label is specified a default label will be generated. The generation pattern can be changed, see the [[Admin Guide>>http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/]]. Example: ##My Page##
150 * **##resource##**: A required string with the link reference in one of the following forms
151 ** **URL**: Any URL in the form of **##[url:] (protocol:~/~/path)##**. Examples: ##http:~/~/xwiki.org##, ##url:https:~/~/svn.xwiki.org/##
152 *** **##url:##** An optional string identifying the resource as an URL.
153 ** **Wiki page** {{info}}Since 10.6{{/info}} reference in the form ##(page: ) [wikiName:] (pageNameList)##**. Examples: ##page:Page##, ##page:myxwiki:Page##, ##page:ParentPage.ChildPage.SubChildPage##, ##page:../SiblingPage##, ##page:./ChildPage##
154 *** **##page:##** A required string identifying the resource as an XWiki page. The same reference can be use for either a terminal or non-terminal page, both both exist it will lead to the non-terminal page.
155 *** **##wikiName##**: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. If no wiki is specified, the current wiki is used. Example: ##mywiki##
156 *** **##pageNameList##**: A required list of slash-separated wiki Pages names pointing to the final linked wiki Page syntax. It's also possible to us ##.## and ##..## to indicate current or parent page/wiki. Examples: ##Main##, ##A/B##, ##A/B/C##, ##../Sibling##, ##./Child##
157 ** **Wiki document** reference in the form **##(doc: ) ~[~[wikiName:] spaceNameList.] (documentName)##**. Examples: ##doc:Welcome##, ##doc:Main.Welcome##, ##doc:mywiki:Main.Welcome##
158 *** **##doc:##** A required string identifying the resource as an XWiki terminal page. A non-terminal page can also be referenced this way, but it must append its ##.WebHome## part (e.g. ##doc:Sandbox.WebHome##).
159 *** **##wikiName##**: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. If no wiki is specified, the current wiki is used. Example: ##mywiki##.
160 *** **##spaceNameList##**: An optional dot-separated list of wiki Space names. If no space is specified the current space is used. Examples: ##Main##, ##A.B##, ##A.B.C##
161 *** **##documentName##**: A required string containing the name of the linked wiki page. Example: ##Welcome##
162 ** **Wiki space** {{info}}Since 7.4.1{{/info}} reference in the form **##(space: ) [wikiName:] (spaceNameList)##**. Examples: ##space:Main##, ##space:mywiki:Main##, ##space:A.B.C##
163 *** **##space:##** A required string identifying the resource as an XWiki non-terminal page (i.e. a space).
164 *** **##wikiName##**: An optional string containing the name of a virtual wiki. The link will point to a page inside that virtual wiki. If no wiki is specified, the current wiki is used. Example: ##mywiki##
165 *** **##spaceNameList##**: A required list of dot-separated wiki Space names pointing to the final linked wiki Space (or non-terminal page). Examples: ##Main##, ##A.B##, ##A.B.C##
166 ** **InterWiki page** reference in the form **##interwiki: (interWikiAlias: ) (pageName)##**. Example: ##interwiki:wikipedia:XWiki##
167 *** **##interwiki:##** A required string identifying the resource as an InterWiki link.
168 *** **##interWikiAlias##**: An optional [[Inter Wiki>>http://en.wikipedia.org/wiki/InterWiki]] alias as defined in the InterWiki Map (see the [[Admin Guide>>http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/]]). Example: ##wikipedia##
169 *** **##pageName##**: A required string containing the name of the linked page. Example: ##XWiki##
170 ** **Attachment** reference in the form **##attach~: [wikiPageName@] (attachmentName)##**. Examples: ##attach~:img.png##, ##attach~:mywiki:Main.WebHome@img.png##, ##attach~:mywiki:Main@img.png##
171 *** **##attach~:##** A required string identifying the resource as attachment.
172 *** **##wikiPageName##**: An optional string referencing the (terminal or non-terminal) page that holds the attachment. This is resolved identically to "Untyped", below.
173 *** **##attachmentName##**: Name of the attachment as it is stored in the wiki. Example: ##photo.png##
174 ** **Email address** in the form **##mailto~: (emailAddress)##** (###anchor## is not valid). Example: ##mailto~:john@smith.com##
175 *** **##mailto~:##** A required string identifying the resource as email.
176 *** **##emailAddress##**: Targeted email address. Example: ##john@smith.com##
177 ** **Relative path** reference on the server in the form **##path: (relPath)##**. Example: ##path:$doc.getURL('reset')## produces target address ##http:~/~/server.domain.com/xwiki/bin/reset/Space/Page## where ##/xwiki/bin/reset/Space/Page## is produced by ##$doc.getURL('reset')##.
178 *** **##path:##** A required string identifying the resource as a relative path.
179 *** **##relPath##**: A required string containing the relative path of the resource on the server that shall be linked.
180 ** **UNC (Windows Explorer)** reference in the form **##unc: (path)##**. The link is rendered as a ##file:~/~/## link. Examples: ##unc:C:\Windows\##, ##unc:~\~\myserver\path\img.png##, ##unc:home/user/somefile##
181 *** **##unc:##** A required string identifying the resource as a UNC (Windows Explorer) path.
182 *** **##path##**: A required string containing the local path of resource accessible by the user. Examples: ##C:\Windows\##, ##~\~\myserver\path\img.png##, ##home/user/somefile##
183 ** **Untyped**: If none of the above mentioned resource types are specified (i.e. no ##type:## resource prefix was specified in the link), then the link will be treated as a link to an XWiki terminal or non-terminal page using the following algorithm:
184 *** **##Terminal page##** in the current space, //only// if it exists. Example: ##~[~[A]]## is resolved to the equivalent of ##~[~[doc:currentSpace.A]]##
185 *** **##Non-terminal page##** {{info}}Since 7.4.1{{/info}} in the current space. Example: ##~[~[A]]## is resolved to the equivalent of ##~[~[space:currentSpace.A]]##, which is the equivalent of ##~[~[doc:currentSpace.A.WebHome]]##
186 *** If the current page is non-terminal and the previous 2 checks above did not find an existing page, 2 additional checks are made:
187 **** **##Terminal page##** {{info}}Since 7.4.1{{/info}} as sibling in the parent space, //only// if it exists. Example: The ##~[~[B]]## link inside the non-terminal page ##A.C## is resolved to the equivalent of ##~[~[doc:A.B]]##
188 **** **##Non-terminal page##** {{info}}Since 7.4.1{{/info}} as sibling in the parent space, regardless if it exists or not. Example: The ##~[~[B]]## link inside the non-terminal page ##A.C## is resolved to the equivalent of ##~[~[space:A.B]]##, which is the equivalent of ##~[~[doc:A.B.WebHome]]##
189 *** //Note1 - Absolute links//: {{info}}Since 7.4.1{{/info}} If the untyped link has 2 or more dot-separated components specified (i.e. that look like a space name and a page name), the above algorithm will resolve the page relative to the current wiki, and not the current space. Example: ##~[~[A.B]]## can be resolved to either ##~[~[doc:currentWiki:A.B]]## (if it exists) or to ##~[~[space:currentWiki:A.B]##] (equivalent of ##~[~[doc:currentWiki:A.B.WebHome]]##) and not to ##~[~[doc:currentWiki:currentSpace.A.B]]## or ##~[~[doc:currentWiki:currentSpace.A.B.WebHome]]##.
190 *** //Note2 - Special handling of ##.WebHome##//: {{info}}Since 7.4.1{{/info}} If the untyped link ends in ##.WebHome##, it will //always// be handled as a terminal page. Example: ##~[~[A.WebHome]]## will always be resolved to the equivalent of ##~[~[doc:A.WebHome]]## and not to ##~[~[doc:A.WebHome.WebHome]]##.
191 * **##parameters##**: An optional list of space-separated parameters passed to the link. Example: ##queryString="mydata1=5&mydata2=Hello" anchor="HTableOfContents" target="~_blank"##
192 ** **##queryString##**: An optional query string for specifying parameters that will be appended to the link target address and used in the rendered URL. Example: ##url:http:~/~/domain.com/path||queryString="mydata1=5&mydata2=Hello"## produces target address ##http:~/~/domain.com/path?mydata1=5&mydata2=Hello##
193 ** **##anchor##**: An optional anchor name pointing to an anchor defined in the referenced link. Note that in XWiki anchors are automatically created for headings. Example: ##url:http:~/~/domain.com/path||anchor="HTableOfContents"## produces target address ##http:~/~/domain.com/path#HTableOfContents##
194 ** **##target##**: An optional parameter that allows to open link target in new window. Example: ##target="~_blank"##