aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Paulssen <timonator@perpetuum-immobile.de>2011-04-30 21:58:43 +0200
committerJoey Hess <joey@kitenet.net>2011-05-13 11:24:15 -0400
commit1c58634068ab39ed24e81a138375651ce04b244a (patch)
tree1b4e3d59e96f36af144ff3cd3e7763443292938d
parent8028d979425ec1d390be044ee31a1ab7800eb1b6 (diff)
downloadikiwiki-1c58634068ab39ed24e81a138375651ce04b244a.tar
ikiwiki-1c58634068ab39ed24e81a138375651ce04b244a.tar.gz
added support for here-docs and ''' in parameters.
-rw-r--r--IkiWiki.pm22
1 files changed, 20 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index fdf3e5c47..8136a7c4b 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1392,10 +1392,14 @@ sub preprocess ($$$;$$) {
|
"([^"]*?)" # 3: single-quoted value
|
- (\S+) # 4: unquoted value
+ '''(.*?)''' # 4: triple-single-quote
+ |
+ <<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # 5, 6: heredoc'd value.
+ |
+ (\S+) # 7: unquoted value
)
(?:\s+|$) # delimiter to next param
- }sgx) {
+ }msgx) {
my $key=$1;
my $val;
if (defined $2) {
@@ -1410,6 +1414,12 @@ sub preprocess ($$$;$$) {
elsif (defined $4) {
$val=$4;
}
+ elsif (defined $7) {
+ $val=$7;
+ }
+ elsif (defined $+{heredoc}) {
+ $val=$+{heredoc};
+ }
if (defined $key) {
push @params, $key, $val;
@@ -1478,6 +1488,10 @@ sub preprocess ($$$;$$) {
|
"[^"]*?" # single-quoted value
|
+ <<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # heredoc'd value.
+ |
+ '''.*?''' # triple-single-quoted value
+ |
[^"\s\]]+ # unquoted value
)
\s* # whitespace or end
@@ -1501,6 +1515,10 @@ sub preprocess ($$$;$$) {
|
"[^"]*?" # single-quoted value
|
+ '''.*?''' # triple-single-quoted value
+ |
+ <<(?<start>[a-zA-Z]+)\n(?<heredoc>.*?)\n\k<start> # heredoc'd value.
+ |
[^"\s\]]+ # unquoted value
)
\s* # whitespace or end