<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>sar (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" /> </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"> sar (third party plugin) </span> </span> </div> </div> <div id="pagebody"> <div id="content" role="main"> <p><span class="infobox"> Plugin: sar<br /> Author: <span class="createlink">VictorMoral</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>The <code>sar</code> plugin is useful to make global or local search and replace operations using common or specific terms.</p> <p>The characteristics are:</p> <ul> <li>Support for a global dictionary page (optional but recommended).</li> <li>Is possible to replace the first appearance with a text and the rest with other.</li> </ul> <p>The global dictionary page is like this:</p> <pre><code>## Sites and projects - [[!sar search="ikiwiki" first="[IkiWiki](http://ikiwiki.info)" next="_IkiWiki_"]] - [[!sar search="debian" first="[Debian](http://debian.org)" next="_Debian_"]] - [[!sar search="perl" first="[Perl](http://perl.org)" next="_Perl_"]] - [[!sar search="linux" replace="GNU/Linux"]] ## Persons - [[!sar search="joey" first="[Joey Hess](http://ikiwiki.info/users/joey]]" next="_Joey_" ]] - [[!sar search="angel" first="[Angel](http://triptico.com)" next="Angel"]] ## Technical terms - [[!sar search="smtp" first="\[[!wp SMTP]]" next="‘SMTP‘"]] - [[!sar search="pop3" first="\[[!wp POP3]]" next="’POP3’"]] </code></pre> <p>The search expressions must be surrounded by double dashes in a source ikiwiki page, like this:</p> <pre><code>Mis programas están escritos en lenguaje --perl--, funcionando con el sistema --debian--, y mis páginas web funcionan con --ikiwiki-- cuyo autor es --joey--. --ikiwiki-- es un buen software. </code></pre> <p>After a filter operation the content is:</p> <pre><code>Mis programas están escritos en lenguaje [Perl](http://perl.org), funcionando con el sistema [Debian](http://debian.org), y mis páginas web funcionan con [IkiWiki](http://ikiwiki.info) cuyo autor es [Joey Hess](http://ikiwiki.info/users/joey). _IkiWiki_ es un buen software. </code></pre> <p><em>Note</em>: I chose this syntax because don't clashes with markdown and it is easy to write. </p> <p>A <em>search and replace</em> directive has the following parameters:</p> <ul> <li><code>search</code>: define the text to search.</li> <li><code>first</code>: define the replace text in the first match.</li> <li><code>next</code>: define the replace text in all matches except the first.</li> <li><code>replace</code>: define the replace text in all matches.</li> </ul> <p>Now the code is used at my site without problems, and the author will appreciate any help with his development or his english. </p> <h2>Configuration</h2> <p>The plugin need the following global values:</p> <ul> <li><code>sar_mainpage</code>: define the global dictionary page. The default value is <code>sar</code>.</li> <li><code>sar_pagespec</code>: enable the plugin with a selection of pages. The default value is <code>*</code>, but a recommended value is <code>link(tag/sar)</code>.</li> </ul> <h2>Synopsis</h2> <p>In a ikiwiki source page we can write this</p> <pre><code>[[!sar search=debian replace="__Debian__"]] </code></pre> <p>for define a global replace for the term <code>--debian--</code> or</p> <pre><code>\[[!sar search=ibm first=’[IBM](http://www.ibm.com)’ next="_IBM_"]] </code></pre> <p>to define a replace for the first match of the string <code>--ibm--</code> and a different replace for the rest.</p> <h2>Changelog</h2> <h3>version 0.8</h3> <ul> <li>First functional version with the new sar expressions.</li> </ul> <h3>version 0.7</h3> <ul> <li>New design for the search expressions.</li> </ul> <h3>version 0.6</h3> <ul> <li>Minor bugfixes in the pages selection.</li> <li>Call to add_depends() for every page filtered</li> </ul> <h3>version 0.5</h3> <ul> <li>This is the first functional version.</li> </ul> <h2>Download</h2> <p>The module can be downloaded from:</p> <ul> <li><a href="http://taquiones.net/files/misc">My personal site</a></li> <li><a href="http://taquiones.net/files/debian">My personal Debian repository</a></li> </ul> </div> </div> <div id="footer" class="pagefooter" role="contentinfo"> <div id="pageinfo"> <div class="tags"> Tags: <a href="../type/chrome.html" rel="tag">type/chrome</a> <a href="../type/slow.html" rel="tag">type/slow</a> </div> <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>