From 78b279c3d8c803391a5a4fc59ffd7855ce8bc5f5 Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 23 Aug 2006 03:25:40 +0000 Subject: [PATCH] * Allow preprocessor directives to span multiple lines, both to make long ones with lots of values easier to write, and to allow for ones with multi-line quoted values. --- IkiWiki.pm | 1 - IkiWiki/Render.pm | 2 +- basewiki/preprocessordirective.mdwn | 13 +++++++++++++ debian/changelog | 5 ++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 9556d6ef7..b9ae74f85 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -18,7 +18,6 @@ use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase sub defaultconfig () { #{{{ wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$)}, wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/, - wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]*)\]\]/, wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/, verbose => 0, syslog => 0, diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index ddd146922..8657dc380 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -123,7 +123,7 @@ sub preprocess ($$$;$) { #{{{ } }; - $content =~ s{(\\?)$config{wiki_processor_regexp}}{$handle->($1, $2, $3)}eg; + $content =~ s{(\\?)\[\[(\w+)\s+((?:(?:\w+=)?(?:"[^"]+"|[^\s\]]+)\s*)*)\]\]}{$handle->($1, $2, $3)}eg; return $content; } #}}} diff --git a/basewiki/preprocessordirective.mdwn b/basewiki/preprocessordirective.mdwn index 2d84cfb97..31731af66 100644 --- a/basewiki/preprocessordirective.mdwn +++ b/basewiki/preprocessordirective.mdwn @@ -15,3 +15,16 @@ Note that if a preprocessor directive has no parameters, a space still must be put after its name, to avoid confusion with a [[WikiLink]]. For example: \[[pagecount ]] + +A preprocessor directive does not need to all be on one line. Also, +multiple lines of *quoted* text can be used for a value. Examples: + + \[[directive foo="baldersnatch" + bar="supercalifragalisticexpealadocious" baz=11]] + + \[[directive text=" + 1. foo + 2. bar + 3. baz + more lines + "]] diff --git a/debian/changelog b/debian/changelog index a4676af79..ba8b6d4f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,11 @@ ikiwiki (1.22) UNRELEASED; urgency=low new more general variable can be used to link to other things (eg, images) from the template, as well as stylesheets. * Fix a bug introduced last version to do with nested inlines. + * Allow preprocessor directives to span multiple lines, both to make + long ones with lots of values easier to write, and to allow for ones with + multi-line quoted values. - -- Joey Hess Tue, 22 Aug 2006 12:53:05 -0400 + -- Joey Hess Tue, 22 Aug 2006 23:09:46 -0400 ikiwiki (1.21) unstable; urgency=low -- 2.45.2