add underlay files for listdirectives
[ikiwiki.git] / underlays / basewiki / directive / cutpaste.mdwn
1 The `copy`, `cut` and `paste` directives are supplied by the [[!iki plugins/cutpaste]] plugin.
2
3 With these directives you can store and recall pieces of text:
4
5  * `\[[!cut id=name text="text"]]` memorizes the text allowing to recall it
6    using the given ID.  The text being cut is not included in the output.
7  * `\[[!copy id=name text="text"]]` memorizes the text allowing to recall it
8    using the given ID.  The text being cut *is* included in the output.
9  * `\[[!paste id=name]]` is replaced by the previously memorized text.
10
11 The text being cut, copied and pasted can freely include wiki markup, including
12 more calls to cut, copy and paste.
13
14 You do not need to memorize the text before using it: a cut directive can
15 follow the paste directive that uses its text.  In fact, this is quite useful
16 to postpone big blocks of text like long annotations and have a more natural
17 flow.  For example:
18
19         This plugin provides three directives:
20
21          * \[[!toggle id="cut" text="cut"]] that cuts text
22          * \[[!toggle id="copy" text="copy"]] that copies text
23          * \[[!toggle id="paste" text="paste"]] that pastes text
24
25         \[[!toggleable id="cut" text="\[[!paste id=cutlongdesc]]"]]
26         \[[!toggleable id="copy" text="\[[!paste id=copylongdesc]]"]]
27         \[[!toggleable id="paste" text="\[[!paste id=pastelongdesc]]"]]
28
29         \[...some time later...]
30
31         \[[!cut id=cutlongdesc text="""
32            blah blah blah
33         """]]
34         \[[!cut id=copylongdesc text="""
35            blah blah blah
36         """]]
37         \[[!cut id=pastelongdesc text="""
38            blah blah blah
39         """]]
40
41 This can potentially be used to create loops, but ikiwiki is clever and breaks
42 them.
43
44 Since you can paste without using double quotes, copy and paste can be used to
45 nest directive that require multiline parameters inside each other:
46
47         \[[!toggleable id=foo text="""
48           \[[!toggleable id=bar text="\[[!paste id=baz]]"]]
49         """]]
50
51         \[[!cut id=baz text="""
52         multiline parameter!
53         """]]