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