<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>pageversion (third party plugin)</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="author" content="spalax" /> </head> <body> <div class="page"> <div class="pageheader"> <div class="header"> <span> <span class="parentlinks"> <a href="../../index.html">ikiwiki</a>/ <a href="../../plugins.html">plugins</a>/ <a href="../contrib.html">contrib</a>/ </span> <span class="title"> pageversion (third party plugin) </span> </span> </div> </div> <div id="pagebody"> <div id="content" role="main"> <p><span class="infobox"> Plugin: pageversion<br /> Author: <span class="createlink">Louis</span><br /> Included in ikiwiki: no<br /> Enabled by default: no<br /> Included in <a href="../goodstuff.html">goodstuff</a>: no<br /> Currently enabled: no<br /> </span></p> <p>This plugin makes it possible to manage different versions of the same page, allowing to:</p> <ul> <li>make older/newer versions available;</li> <li>highlight the latest version.</li> </ul> <div class="toc"> <ol> <li class="L1"><a href="#index1h1">Rationale</a> </li> <li class="L1"><a href="#index2h1">Example</a> </li> <li class="L1"><a href="#index3h1">List of directives and pagespecs</a> </li> <li class="L1"><a href="#index4h1">Download and Install</a> </li> </ol> </div> <h1><a name="index1h1"></a>Rationale</h1> <p>On my personal website/blog, I publish articles which I sometimes update. Sometimes, I add a few lines of text with a <code>Updated on DATE.</code> message; other times, I rewrite the whole article. In this latter case, I want:</p> <ul> <li>the main version of the article to be the latest one;</li> <li>oldest versions still to be available;</li> <li>the main list of my articles to list only the latest version of each article.</li> </ul> <h1><a name="index2h1"></a>Example</h1> <p>For instance, on my personal website, article <a href="//ababsurdo.fr/pedago/sismologie/20150110/">one</a> has been updated to <a href="//ababsurdo.fr/pedago/sismologie/20150819/">two</a>.</p> <ul> <li>They both contain the directive <code>[[!versionof parent]]</code>, marking them as a version of the <a href="//ababsurdo.fr/pedago/sismologie">main article</a> (which happens to be their parent page).</li> <li>On the <a href="//ababsurdo.fr/pedago/sismologie/20150819/">old article</a>, links to the other articles (only one here) are available.</li> <li>On the <a href="//ababsurdo.fr/pedago">page listing my articles</a>, only the latest article appears.</li> <li>The <a href="//ababsurdo.fr/pedago/sismologie">main page</a> lists all versions of this article, and redirects to the latest one.</li> </ul> <h1><a name="index3h1"></a>List of directives and pagespecs</h1> <p>Pages are marked as versions as other pages using tags (subtags of <code>_pageversion/*</code>). Directive <code>[[!versionof ]]</code> simply add the appropriate tag to the current page (thus, one can ignore this directive, but it makes things easier).</p> <p>Pages can be marked as versions of another page (e.g. <code>foo/version1</code> and <code>foo/version2</code> are versions of page <code>foo</code>), or versions of an arbitrary abstract page (called <em>label</em> later). There is no conflict between them (that is, pages marked as a version of page <code>foo</code> and as a version of label <code>foo</code> are not a version of the same page).</p> <h2><a name="index1h2"></a>Directive <code>versionof</code></h2> <p>Marks current page as a version of another page. Its main forms are:</p> <ul> <li><code>[[!versionof name=foo]]</code> Mark current page as a version of page <code>foo</code> (page <code>foo</code> is searched using the same <a href="../../ikiwiki/subpage/linkingrules.html">linking rules</a> as a <a href="../../ikiwiki/wikilink.html">WikiLink</a>).</li> <li><code>[[!versionof label=bar]]</code> Mark current page as a version of some abstract object labelled <code>bar</code>.</li> </ul> <p>It may be convenient to refer to some particular page. Thus, those alternative forms are also available:</p> <ul> <li><code>[[!versionof name]]</code> Mark current page as a version of itself.</li> <li><code>[[!versionof parent]]</code> Mark current page as a version of its parent page.</li> </ul> <h2><a name="index2h2"></a>Template <code>otherversions</code></h2> <p>To add a list to the other versions of a page (both older and newer), a template is provided. It is called with:</p> <pre><code>[[!template id=otherversions version=VERSION template=INLINETEMPLATE]] </code></pre> <p>Where:</p> <ul> <li><em>(Required)</em> Pages that are a version of <code>VERSION</code> are listed (for instance <code>[[!template id=otherversions version=name=foo]]</code>).</li> <li><em>(Optional)</em> Template <code>INLINETEMPLATE</code> is used (instead of the default <code>otherversionpage</code> template) in the <a href="../../ikiwiki/directive/inline.html">inline</a> directive listing the other pages.</li> </ul> <h2><a name="index3h2"></a>Pagespec <code>versionof</code></h2> <p>A pagespec can match pages marked as a version of something using the pagespec <code>versionof</code>. It accepts the same arguments as the arguments as the <code>versionof</code> directive, that is:</p> <ul> <li><code>versionof(name=foo)</code>: Match pages which are a version of page <code>foo</code>.</li> <li><code>versionof(name)</code>: Match pages which are a version of the current page.</li> <li><code>versionof(parent)</code>: Match pages which are a version of the parent page.</li> <li><code>versionof(label=bar)</code>: Match pages which are a version of some abstract object labelled <code>bar</code>.</li> </ul> <p>Moreover, it takes one additional argument:</p> <ul> <li><code>versionof(any)</code>: Match pages which are a version of anything.</li> </ul> <h2><a name="index4h2"></a>Pagespec <code>latestversion</code></h2> <p>An additional pagespec <code>latestversion</code> is provided. It accepts the same arguments as the <code>versionof</code> pagespec (that is: <code>latestversion(name=foo)</code>, <code>latestversion(name)</code>, <code>latestversion(parent)</code>, <code>latestversion(label=bar)</code>, <code>latestversion(any)</code>) but only the most recent page is matched.</p> <h2><a name="index5h2"></a>Pagespec <code>latest_tagged</code></h2> <p>As a side effect, this plugin also provides the <code>latest_tagged(TAG)</code> pagespec. It matches one single page: the most recent page tagged with the given tag.</p> <h2><a name="index6h2"></a>Directive <code>redirect</code></h2> <p>Directive <code>[[!redirect ]]</code> (from the <a href="./redirect.html">redirect</a> plugin) can be used together with this package. For instance, a page containing the directive <code>[[!redirect pages="versionof(page)"]]</code> will redirect to the most recent page marked as a version of the current page.</p> <h1><a name="index4h1"></a>Download and Install</h1> <p>Code and documentation can be found here : <a href="https://atelier.gresille.org/projects/gresille-ikiwiki/wiki/PageVersion">https://atelier.gresille.org/projects/gresille-ikiwiki/wiki/PageVersion</a>.</p> </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>