1 [[meta title="sar (third party plugin)" ]]
2 [[template id=plugin name=sar author="[[VictorMoral]]"]]
3 [[tag type/chrome type/slow ]]
5 The `sar` plugin is useful to make global or local search and replace operations
6 using common or specific terms.
8 The characteristics are:
10 - Support for a global dictionary page (optional but recommended).
11 - Is possible to replace the first appearance with a text and the rest with
14 The global dictionary page is like this:
18 - [[sar search="ikiwiki" first="[IkiWiki](http://ikiwiki.info)" next="_IkiWiki_"]]
19 - [[sar search="debian" first="[Debian](http://debian.org)" next="_Debian_"]]
20 - [[sar search="perl" first="[Perl](http://perl.org)" next="_Perl_"]]
21 - [[sar search="linux" replace="GNU/Linux"]]
24 - [[sar search="joey" first="[Joey Hess](http://ikiwiki.info/users/joey]]" next="_Joey_" ]]
25 - [[sar search="angel" first="[Angel](http://triptico.com)" next="Angel"]]
29 - [[sar search="smtp" first="\[[wp SMTP]]" next="‘SMTP‘"]]
30 - [[sar search="pop3" first="\[[wp POP3]]" next="’POP3’"]]
32 The search expressions must be surrounded by double dashes in a source ikiwiki
35 Mis programas están escritos en lenguaje --perl--, funcionando con el
36 sistema --debian--, y mis páginas web funcionan con --ikiwiki-- cuyo autor
39 --ikiwiki-- es un buen software.
41 After a filter operation the content is:
43 Mis programas están escritos en lenguaje [Perl](http://perl.org),
44 funcionando con el sistema [Debian](http://debian.org), y mis páginas web
45 funcionan con [IkiWiki](http://ikiwiki.info) cuyo autor es [Joey
46 Hess](http://ikiwiki.info/users/joey).
48 _IkiWiki_ es un buen software.
50 _Note_: I chose this syntax because don't clashes with markdown and it is easy to write.
52 A _search and replace_ directive has the following parameters:
54 - `search`: define the text to search.
55 - `first`: define the replace text in the first match.
56 - `next`: define the replace text in all matches except the first.
57 - `replace`: define the replace text in all matches.
59 Now the code is used at my site without problems, and the author will
60 appreciate any help with his development or his english.
64 The plugin need the following global values:
66 - `sar_mainpage`: define the global dictionary page. The default value is `sar`.
67 - `sar_pagespec`: enable the plugin with a selection of pages. The default
68 value is `*`, but a recommended value is `link(tag/sar)`.
72 In a ikiwiki source page we can write this
74 \[[sar search=debian replace="__Debian__"]]
76 for define a global replace for the term `--debian--` or
78 \[[sar search=ibm first=’[IBM](http://www.ibm.com)’
81 to define a replace for the first match of the string `--ibm--` and a different
88 - First functional version with the new sar expressions.
92 - New design for the search expressions.
96 - Minor bugfixes in the pages selection.
97 - Call to add_depends() for every page filtered
101 - This is the first functional version.
105 The module can be downloaded from:
107 - [My personal site](http://taquiones.net/files/misc)
108 - [My personal Debian repository](http://taquiones.net/files/debian)