<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cutpaste</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="../../style.css" type="text/css" /> <link rel="stylesheet" href="../../local.css" type="text/css" /> <meta name="robots" content="noindex, follow" /> </head> <body> <div class="page"> <div class="pageheader"> <div class="header"> <span> <span class="parentlinks"> <a href="../../index.html">ikiwiki</a>/ <a href="../../ikiwiki.html">ikiwiki</a>/ <a href="../directive.html">directive</a>/ </span> <span class="title"> cutpaste </span> </span> </div> </div> <div id="pagebody"> <div id="content" role="main"> <p>The <code>copy</code>, <code>cut</code> and <code>paste</code> directives are supplied by the <a href="http://ikiwiki.info/plugins/cutpaste/">cutpaste</a> plugin.</p> <p>With these directives you can store and recall pieces of text in a page:</p> <ul> <li><code>[[!cut id=name text="text"]]</code> memorizes the text allowing to recall it using the given ID. The text being cut is not included in the output.</li> <li><code>[[!copy id=name text="text"]]</code> memorizes the text allowing to recall it using the given ID. The text being cut <em>is</em> included in the output.</li> <li><code>[[!paste id=name]]</code> is replaced by the previously memorized text.</li> </ul> <p>The text being cut, copied and pasted can freely include wiki markup, including more calls to cut, copy and paste.</p> <p>You do not need to memorize the text before using it: a cut directive can follow the paste directive that uses its text. In fact, this is quite useful to postpone big blocks of text like long annotations and have a more natural flow. For example:</p> <pre><code>[[!toggleable id="cut" text="[[!paste id=cutlongdesc]]"]] [[!toggleable id="copy" text="[[!paste id=copylongdesc]]"]] [[!toggleable id="paste" text="[[!paste id=pastelongdesc]]"]] [...some time later...] [[!cut id=cutlongdesc text=""" blah blah blah """]] [[!cut id=copylongdesc text=""" blah blah blah """]] [[!cut id=pastelongdesc text=""" blah blah blah """]] </code></pre> <p>This can potentially be used to create loops, but ikiwiki is clever and breaks them.</p> <p>Since you can paste without using double quotes, copy and paste can be used to nest directives that require multiline parameters inside each other:</p> <pre><code>[[!toggleable id=foo text=""" [[!toggleable id=bar text="[[!paste id=baz]]"]] """]] [[!cut id=baz text=""" multiline parameter! """]] </code></pre> </div> </div> <div id="footer" class="pagefooter" role="contentinfo"> <div id="pageinfo"> <div class="pagedate"> Last edited <span class="date">Tue Feb 26 23:01:54 2019</span> <!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> --> </div> </div> <!-- from ikiwiki --> </div> </div> </body> </html>