Wiki source code of Attach Macro (Radeox)

Last modified by Thomas Mortagne on 2023/10/10 14:24

Show last authors
1 Adds a link to download an attachment in the wiki.
2
3 Can also link to an external resource.
4
5 {{info}}
6 For XWiki Syntax 2.0, use the syntax directly. For example: ##{{{attach:myimage.png}}}##. See the [[Syntax Page>>xwiki:Documentation.UserGuide.Features.XWikiSyntax]] for more details.
7 {{/info}}
8
9 == Usage ==
10
11 {{code language="none"}}
12 {attach:<link text>|file=<file>|document=<document>|title=<title>|rel=<rel>|id=<id>|fromIncludingDoc=}
13 {{/code}}
14
15 === Parameters definition ===
16
17 |=Name|=Optional|=Allowed values|=Default values|=Description
18 |link text (*)|yes|Text|If missing, the file name is used.|The link text.
19 |file (*)|yes|attachment name or an absolute url|If missing, the link text is used.|The target filename.
20 |document (~*~*)|yes|document name within the wiki|current document|The document to which the file is attached (allows linking to files attached to different pages).
21 |title|yes|Text|If missing, no title.|The [[title attribute>>http://www.w3.org/TR/html401/struct/global.html#adef-title]] of the link. Often rendered as a tooltip.
22 |rel|yes|[[Link Types>>http://www.w3.org/TR/html401/types.html#type-links]]|If missing, no rel.|The [[rel attribute>>http://www.w3.org/TR/html401/struct/links.html#adef-rel]] of the link. Specifies the [[relation>>http://www.w3.org/TR/html401/types.html#type-links]] from this document to the link.
23 |id|yes| |If missing, no id.|The [[id attribute>>http://www.w3.org/TR/html401/struct/global.html#adef-id]] of the link.
24 |fromIncludingDoc (~*~*)|yes|**Empty**(just end with =)| |Fetch the attachment from the parent document that included the current document. This is useful for templates, for example.
25
26 (*) At least one of these parameters must be specified. Macro is ignored if both are missing.
27
28 (~*~*) Use either //document// or //fromIncludingDoc//. Parameter //fromIncludingDoc// is ignored if both are specified.
29
30 == Example ==
31
32 {{code language="none"}}
33 {attach:A simple text file|file=simple.txt|title=Download Simple Txt}
34 {{/code}}
35
36 {{code language="none"}}
37 {attach: An image file on another page|file=gamesigns.jpg|document=ImageMacro|title=Download gamesigns.jpg}
38 {{/code}}
39
40 === Result ===
41
42 [[A simple text file>>attach:simple.txt||title="Download Simple Txt"]] \ [[ An image file on another page>>attach:Extension.Image Macro (Radeox)@gamesigns.jpg||title="Download gamesigns.jpg"]] \

Get Connected