]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/simple_text_parsing_or_regex_in_template_or_shortcut.mdwn
Conversion support for existing other wikis.
[ikiwiki.git] / doc / todo / simple_text_parsing_or_regex_in_template_or_shortcut.mdwn
1 Either [[plugins/template]] or [[plugins/shortcut]] should support some form
2 of very simple text parsing or regex application, to make it possible to write
3 shortcuts like these:
4
5     [[mmlist listname@lists.example.org]] -> <listname@example.org> ([mailman page] (http://lists.example.org/mailman/listinfo/listname)
6     [[debcl packagename]] -> [packagename changelog](http://packages.debian.org/changelogs/pool/main/p/packagename/current/changelog)
7
8 For shortcut definitions, a `match` parameter could supply a regex, and then the `url` and `desc` parameters could make use of the named or numbered groups from the match.
9
10 --[[JoshTriplett]]
11
12 I'm not comfortable with exposing regexps to web editing. At the very least
13 it's trivial to construct regexps that take indefinitely long to match
14 certain strings, which could be used to DOS ikiwiki. At worst, perl code
15 can be embedded in regexps in a variety of ways that are painful to filter
16 out, and perl's regexp engine could also potentially have bugs that could
17 be exploited by user-supplied regexps.
18
19 It seems that a better place to put this kind of text munging is in
20 special-purpose plugins. It should be very simple to write plugins for the
21 above two examples, that look identical to the user as what you described.
22
23 --[[Joey]]
24
25 Fair enough.  I only proposed regexes for the purposes of generality.
26
27 That said, some simple text substitution mechanisms might handle many of these
28 cases without the need for a specialized plugin beyond [[plugins/shortcut]].
29 For instance, substring extraction would suffice for the `debcl` shortcut, and
30 something like a split function would work for the `mmlist` shortcut.
31
32 --[[JoshTriplett]]