]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/sar.mdwn
web commit by bremner
[ikiwiki.git] / doc / plugins / contrib / sar.mdwn
1 [[template id=plugin name=sar author="[[VictorMoral]]"]]
2 [[tag type/chrome type/slow ]]
3
4 The `sar` plugin is useful to make global or local search and replace operations
5 using common or specific terms.
6
7 The characteristics are:
8
9 - Support for a global dictionary page (optional but recommended).
10 - Is possible to replace the first appearance with a text and the rest with
11 other.
12
13 The global dictionary page is like this:
14
15     ## Sites and projects
16
17     - [[sar search="ikiwiki" first="[IkiWiki](http://ikiwiki.info)" next="_IkiWiki_"]]
18     - [[sar search="debian" first="[Debian](http://debian.org)" next="_Debian_"]]
19     - [[sar search="perl" first="[Perl](http://perl.org)" next="_Perl_"]]
20     - [[sar search="linux" replace="GNU/Linux"]]
21    
22     ## Persons
23     - [[sar search="joey" first="[Joey Hess](http://ikiwiki.info/users/joey]]" next="_Joey_" ]]
24     - [[sar search="angel" first="[Angel](http://triptico.com)" next="Angel"]]
25
26     ## Technical terms
27
28     - [[sar search="smtp" first="\[[wp SMTP]]" next="‘SMTP‘"]]
29     - [[sar search="pop3" first="\[[wp POP3]]" next="’POP3’"]]
30
31 The search expressions must be surrounded by double dashes in a source ikiwiki
32 page, like this:
33
34     Mis programas están escritos en lenguaje --perl--, funcionando con el 
35     sistema --debian--, y mis páginas web funcionan con --ikiwiki-- cuyo autor
36     es --joey--.
37
38     --ikiwiki-- es un buen software.
39
40 After a filter operation the content is:
41
42     Mis programas están escritos en lenguaje [Perl](http://perl.org),
43     funcionando con el sistema [Debian](http://debian.org), y mis páginas web
44     funcionan con [IkiWiki](http://ikiwiki.info) cuyo autor es [Joey
45     Hess](http://ikiwiki.info/users/joey).
46
47     _IkiWiki_ es un buen software.
48
49 _Note_: I chose this syntax because don't clashes with markdown and it is easy to write. 
50
51 A _search and replace_ directive has the following parameters:
52
53 - `search`: define the text to search.
54 - `first`: define the replace text in the first match.
55 - `next`: define the replace text in all matches except the first.
56 - `replace`: define the replace text in all matches.
57
58 Now the code is used at my site without problems, and the author will
59 appreciate any help with his development or his english. 
60
61 ## Configuration
62
63 The plugin need the following global values:
64
65 - `sar_mainpage`: define the global dictionary page. The default value is `sar`.
66 - `sar_pagespec`: enable the plugin with a selection of pages. The default
67 value is `*`, but a recommended value is `link(tag/sar)`.
68
69 ## Synopsis
70
71 In a ikiwiki source page we can write this
72
73     \[[sar search=debian replace="__Debian__"]]
74
75 for define a global replace for the term `--debian--` or
76
77     \[[sar search=ibm first=’[IBM](http://www.ibm.com)’
78             next="_IBM_"]]
79
80 to define a replace for the first match of the string `--ibm--` and a different
81 replace for the rest.
82
83 ## Changelog
84
85 ### version 0.8
86
87 - First functional version with the new sar expressions.
88
89 ### version 0.7 
90
91 - New design for the search expressions.
92
93 ### version 0.6
94
95 - Minor bugfixes in the pages selection.
96 - Call to add_depends() for every page filtered
97
98 ### version 0.5
99
100 - This is the first functional version.
101
102 ## Download 
103
104 The module can be downloaded from:
105
106 - [My personal site](http://taquiones.net/files/misc)
107 - [My personal Debian repository](http://taquiones.net/files/debian)
108
109