]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/todo/simple_text_parsing_or_regex_in_template_or_shortcut.mdwn
move the patch into my repository
[ikiwiki.git] / doc / todo / simple_text_parsing_or_regex_in_template_or_shortcut.mdwn
index a086f417996402ec45b58ff84c80b45d8e97ec88..3ff8b9ef6d54c67c9bd70c4d9edff3b3234ad7c4 100644 (file)
@@ -2,7 +2,31 @@ Either [[plugins/template]] or [[plugins/shortcut]] should support some form
 of very simple text parsing or regex application, to make it possible to write
 shortcuts like these:
 
-    [[mmlist listname@lists.example.org]] -> <listname@example.org> ([mailman page] (http://lists.example.org/mailman/listinfo/listname)
-    [[debchangelog packagename]] -> [packagename changelog](http://packages.debian.org/changelogs/pool/main/p/packagename/current/changelog)
+    [[!mmlist listname@lists.example.org]] -> <listname@example.org> ([mailman page] (http://lists.example.org/mailman/listinfo/listname)
+    [[!debcl packagename]] -> [packagename changelog](http://packages.debian.org/changelogs/pool/main/p/packagename/current/changelog)
 
---[[JoshTriplett]]
\ No newline at end of file
+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.
+
+--[[JoshTriplett]]
+
+I'm not comfortable with exposing regexps to web editing. At the very least
+it's trivial to construct regexps that take indefinitely long to match
+certain strings, which could be used to DOS ikiwiki. At worst, perl code
+can be embedded in regexps in a variety of ways that are painful to filter
+out, and perl's regexp engine could also potentially have bugs that could
+be exploited by user-supplied regexps.
+
+It seems that a better place to put this kind of text munging is in
+special-purpose plugins. It should be very simple to write plugins for the
+above two examples, that look identical to the user as what you described.
+
+--[[Joey]]
+
+Fair enough.  I only proposed regexes for the purposes of generality.
+
+That said, some simple text substitution mechanisms might handle many of these
+cases without the need for a specialized plugin beyond [[plugins/shortcut]].
+For instance, substring extraction would suffice for the `debcl` shortcut, and
+something like a split function would work for the `mmlist` shortcut.
+
+--[[JoshTriplett]]