aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-07-27 04:42:59 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-07-27 04:42:59 +0000
commit26bfed13ac23faf7108f861447f3a1bc774c674f (patch)
tree3327d7acb0a6dbf352e86331cd58369e110ae11a /doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn
parentc7a25f76dfe4b8aaf768a8fde82238bf889d8027 (diff)
downloadikiwiki-26bfed13ac23faf7108f861447f3a1bc774c674f.tar
ikiwiki-26bfed13ac23faf7108f861447f3a1bc774c674f.tar.gz
web commit by http://ethan.betacantrips.com/: regexes are fun
Diffstat (limited to 'doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn')
-rw-r--r--doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn58
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn b/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn
new file mode 100644
index 000000000..b7379e7b4
--- /dev/null
+++ b/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn
@@ -0,0 +1,58 @@
+The pagespec regexes don't allow functions with no arguments.
+
+IkiWiki.pm, around line 1035:
+
+<pre>
+$spec=~m{
+ \s* # ignore whitespace
+ ( # 1: match a single word
+ \! # !
+ |
+ \( # (
+ |
+ \) # )
+ |
+ \w+\([^\)]+\) # command(params)
+ |
+ [^\s()]+ # any other text
+ )
+ \s* # ignore whitespace
+ }igx
+</pre>
+
+command(params) of course might be just command(). (See
+conditional.pm: match_included.) Trying to feed
+ikiwiki a pagespec without params will get you instead:
+
+IkiWiki::PageSpec::match_glob($page, q{function}, @params) ( )
+
+Which is completely not desired. The second + on that line should be a *.
+
+None of the builtin pagespecs "work" with no parameters, so it's hard to
+write a unit test for this. But can we at least write a helpful note in
+case the user is given to rebuilding the wiki by hand. --Ethan
+
+<pre>
+--- ikiwiki/IkiWiki.pm 2007-07-26 15:15:22.716860000 -0700
++++ ikidev/IkiWiki.pm 2007-07-26 21:34:45.542248000 -0700
+@@ -1032,7 +1032,7 @@
+ |
+ \) # )
+ |
+- \w+\([^\)]+\) # command(params)
++ \w+\([^\)]*\) # command(params)
+ |
+ [^\s()]+ # any other text
+ )
+@@ -1075,6 +1075,10 @@
+ }
+
+ my $ret=eval pagespec_translate($spec);
++ if ($@){
++ my $t = pagespec_translate($spec);
++ print "evaluating pagespec failed: $t $@\n";
++ }
+ return IkiWiki::FailReason->new("syntax error") if $@;
+ return $ret;
+ } #}}}
+</pre> \ No newline at end of file