]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/plugins/contrib/sar___40__third_party_plugin__41__.mdwn
af41bc932b64afb0d621b92201fbf1db0b9e9dfd
[git.ikiwiki.info.git] / doc / plugins / contrib / sar___40__third_party_plugin__41__.mdwn
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
12 other.
13 - Support for enable or disable sar engine in any page.
14 - Support for disable sar engine on any term in any page.
16 The global dictionary page is like this:
18     ## Sites and projects
20     - [[sar search="ikiwiki" first="[IkiWiki](http://ikiwiki.info)" next="_IkiWiki_"]]
21     - [[sar search="debian" first="[Debian](http://debian.org)" next="_Debian_"]]
22     - [[sar search="perl" first="[Perl](http://perl.org)" next="_Perl_"]]
23     - [[sar search="linux" replace="GNU/Linux"]]
24    
25     ## Persons
26     - [[sar search="joey" first="[Joey Hess](http://ikiwiki.info/users/joey]]" next="_Joey_" ]]
27     - [[sar search="angel" first="[Angel](http://triptico.com)" next="Angel"]]
29     ## Technical terms
31     - [[sar search="smtp" first="\[[wp SMTP]]" next="‘SMTP‘"]]
32     - [[sar search="pop3" first="\[[wp POP3]]" next="’POP3’"]]
34 The search parameter is a literal text; later will be used as part of the
35 final regular expression.
37 A _search and replace_ directive has the following parameters:
39 - `search`: define the text to search.
40 - `first`: define the replace text in the first match.
41 - `next`: define the replace text in all matches except the first.
42 - `replace`: define the replace text in all matches.
43 - `disable`: disable the sar plugin in the current page or the current term if
44 there is a search parameter.
46 ## Configuration
48 The plugin need the following global values:
50 - `sar_mainpage`: define the global dictionary page. The default value is `sar`.
51 - `sar_pagespec`: enable the plugin with a selection of pages. The default
52 value is `*`, but a recommended value is `link(tag/sar)`.
54 ## Caveats
56 This plugin works as a filter hook on the source markdown text; the dictionary
57 terms must be carefully selected, because they could interfere with URLs and
58 other preprocessor directives.
60 The code is highly experimental and the author will appreciate any help with
61 his development or his english. I'm using at my site with minor problems.
63 ## sinopsys
65 In a ikiwiki source page we can write this
67     \[[sar]]
69 for enable the sar plugin in this page or
71     \[[sar disable = 1]]
73 for disable the sar plugin or
75     \[[sar search=debian replace="__Debian__"]]
77 to define a global replace for the term `debian` or
79     \[[sar search=ibm first=’[IBM](http://www.ibm.com)’
80             next="_IBM_"]]
82 to define a replace for the first match of the string `ibm` and a different
83 replace for the rest, and
85     \[[sar search=hp ]]
86     \[[sar search=hp disable=1]]
88 to disable the sar plugin in the current page for the term `hp`.
90 ## Changelog
92 ### version 0.5
94 This is the first functional version.
96 ## Download 
98 The module can be downloaded from:
100 - [My personal site](http://taquiones.net/files/misc)
101 - [My personal Debian repository](http://taquiones.net/files/debian)