]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/simple_text_parsing_or_regex_in_template_or_shortcut.mdwn
web commit by JoshTriplett
[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     [[debchangelog 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]]