]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/sar___40__third_party_plugin__41__.mdwn
web commit by http://victormoral.myopenid.com/: version 0.6
[ikiwiki.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 ]]
4
5 The `sar` plugin is useful to make global or local search and replace operations
6 using common or specific terms.
7
8 The characteristics are:
9
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.
15
16 The global dictionary page is like this:
17
18     ## Sites and projects
19
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"]]
28
29     ## Technical terms
30
31     - [[sar search="smtp" first="\[[wp SMTP]]" next="‘SMTP‘"]]
32     - [[sar search="pop3" first="\[[wp POP3]]" next="’POP3’"]]
33
34 The search parameter is a literal text; later will be used as part of the
35 final regular expression.
36
37 A _search and replace_ directive has the following parameters:
38
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.
45
46 ## Configuration
47
48 The plugin need the following global values:
49
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)`.
53
54 ## Caveats
55
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.
59
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.
62
63 ## sinopsys
64
65 In a ikiwiki source page we can write this
66
67     \[[sar]]
68
69 for enable the sar plugin in this page or
70
71     \[[sar disable = 1]]
72
73 for disable the sar plugin or
74
75     \[[sar search=debian replace="__Debian__"]]
76
77 to define a global replace for the term `debian` or
78
79     \[[sar search=ibm first=’[IBM](http://www.ibm.com)’
80             next="_IBM_"]]
81
82 to define a replace for the first match of the string `ibm` and a different
83 replace for the rest, and
84
85     \[[sar search=hp ]]
86     \[[sar search=hp disable=1]]
87
88 to disable the sar plugin in the current page for the term `hp`.
89
90 ## Changelog
91
92 ### version 0.6
93
94 - Minor bugfixes in the pages selection.
95 - Call to add_depends() for every page filtered
96
97 ### version 0.5
98
99 - This is the first functional version.
100
101 ## Download 
102
103 The module can be downloaded from:
104
105 - [My personal site](http://taquiones.net/files/misc)
106 - [My personal Debian repository](http://taquiones.net/files/debian)
107
108