summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://smcv.pseudorandom.co.uk/ <http://smcv.pseudorandom.co.uk/@web>2008-08-03 11:24:20 -0400
committerJoey Hess <joey@kitenet.net>2008-08-03 11:24:20 -0400
commiteadff687abbec442423967d5cba3bcfb606dc1a9 (patch)
treed0ca1f7fab238c8ddde174da1eeaba45c63818eb
parent47b4564c500b93ce6e29fb04618e6f45df004b83 (diff)
-rw-r--r--doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn b/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn
new file mode 100644
index 000000000..6274f1299
--- /dev/null
+++ b/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn
@@ -0,0 +1,17 @@
+In `IkiWiki::preprocess`, the last capturing group in the regex used to parse directives in prefix_directives mode is of the form `(\s+...)?\]\]`, which will not be matched if the directive is something without arguments or whitespace, like `\[[!orphans]]`. As a result, its value is undef instead of being an empty string, causing a warning when it is used in the anonymous sub `$handle`. A trivial fix is to treat it as "" if it is undef.
+
+[[patch]] in the master branch of my git repository, and quoted here. --[[smcv]]
+
+ diff --git a/IkiWiki.pm b/IkiWiki.pm
+ index 241a7c0..d2c35a2 100644
+ --- a/IkiWiki.pm
+ +++ b/IkiWiki.pm
+ @@ -1167,7 +1167,8 @@ sub preprocess ($$$;$$) { #{{{
+ }sx;
+ }
+
+ - $content =~ s{$regex}{$handle->($1, $2, $3, $4)}eg;
+ + # $4 can be undef if the directive was \[[!foo]]
+ + $content =~ s{$regex}{$handle->($1, $2, $3, ($4 or ""))}eg;
+ return $content;
+ } #}}}