From 53e519931f3a6b7cea0af652d749344757d4e2bc Mon Sep 17 00:00:00 2001 From: "http://jmtd.livejournal.com/" Date: Mon, 15 Nov 2010 14:23:01 +0000 Subject: template files being treated as regular pages and the problems that can cause --- ...c:_mixing_templates_and_creation__95__date.mdwn | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn (limited to 'doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn') diff --git a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn new file mode 100644 index 000000000..70af505c1 --- /dev/null +++ b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn @@ -0,0 +1,58 @@ +I get the following error when building my wiki + + Argument "\x{3c}\x{54}..." isn't numeric in numeric eq (==) at /usr/share/perl5/IkiWiki.pm line 2547. + Argument "\x{3c}\x{54}..." isn't numeric in numeric eq (==) at /usr/share/perl5/IkiWiki.pm line 2547. + +that line corresponds to + + sub match_creation_year ($$;@) { + if ((localtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) { <-- this one + return IkiWiki::SuccessReason->new('creation_year matched'); + } + +A git bisect shows that the offending commit introduced this hunk + + + --- /dev/null + +++ b/templates/all_entry.mdwn + @@ -0,0 +1,23 @@ + +## + + + +There + + + +have been + + + +were + + + +[[!pagecount pages=" + +log/* and !tagged(aggregation) and !*/Discussion and !tagged(draft) + +and creation_year() + +and !*.png and !*.jpg + +"]] posts + + + +so far + + + +in . + + + +[[!inline pages=" + + log/* and !tagged(aggregation) and !*/Discussion and !tagged(draft) + + and creation_year() + + and !*.png and !*.jpg + + " archive=yes feeds=no]] + +The lines which feature creation_year() are most likely the culprits. That would explain why the error was repeated twice, and would tally with the file in `templates/` being rendered, rather than the inclusionists. + +A workaround is to move the template outside of the srcdir into the external templates directory and include the file suffix when using it, e.g. + + \[[!template id=all_entry.tmpl year=2010 current=true]] + +An alternative fix is to wrap the entire template inside a test to see whether the page is included or not. E.g. + + + \[[!if test="included()" then=""" + ...template... + """ else=""" + Nothing to see here. + """]] + +In fact, this is probably best practice for in-srcdir templates. I'd consider this done if the documentation for the directive suggested it. -- [[Jon]] -- cgit v1.2.3 From 9d0ac3170a8f90d2139ef75698e8af21a6435fb4 Mon Sep 17 00:00:00 2001 From: "http://jmtd.livejournal.com/" Date: Mon, 15 Nov 2010 14:28:50 +0000 Subject: done with commit da9e1ea667f82d5fca916 --- ...ent_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn') diff --git a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn index 70af505c1..5485bba9c 100644 --- a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn +++ b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn @@ -56,3 +56,5 @@ An alternative fix is to wrap the entire template inside a test to see whether t """]] In fact, this is probably best practice for in-srcdir templates. I'd consider this done if the documentation for the directive suggested it. -- [[Jon]] + +> [[done]] with -- [[Jon]] -- cgit v1.2.3 From 5430d5dc3bc37df92eb01cd65382c0f2be78b8e7 Mon Sep 17 00:00:00 2001 From: "http://jmtd.livejournal.com/" Date: Mon, 15 Nov 2010 14:43:35 +0000 Subject: not quite done yet: if/included() doesn't work that way. --- ...sn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn') diff --git a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn index 5485bba9c..83093895b 100644 --- a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn +++ b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn @@ -46,8 +46,7 @@ A workaround is to move the template outside of the srcdir into the external tem \[[!template id=all_entry.tmpl year=2010 current=true]] -An alternative fix is to wrap the entire template inside a test to see whether the page is included or not. E.g. - +I believed (until I tested) that the [[ikiwiki/directive/if]] directive, with the `included()` test, would be an option here, E.g. \[[!if test="included()" then=""" ...template... @@ -55,6 +54,4 @@ An alternative fix is to wrap the entire template inside a test to see whether t Nothing to see here. """]] -In fact, this is probably best practice for in-srcdir templates. I'd consider this done if the documentation for the directive suggested it. -- [[Jon]] - -> [[done]] with -- [[Jon]] +However this doesn't work. I assume "included" in this context means e.g. via an `inline` or `map`, not template trans-clusion. -- [[Jon]] -- cgit v1.2.3 From 8de7fde49c295a6c9098767b9fdfea79de8476eb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 Nov 2010 13:24:50 -0400 Subject: already fixed --- ...nt_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn') diff --git a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn index 83093895b..b1053fc38 100644 --- a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn +++ b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn @@ -55,3 +55,6 @@ I believed (until I tested) that the [[ikiwiki/directive/if]] directive, with th """]] However this doesn't work. I assume "included" in this context means e.g. via an `inline` or `map`, not template trans-clusion. -- [[Jon]] + +> As far as I know, this bug was fixed in +> 4a75dee651390b79ce4ceb1d951b02e28b3ce83a on October 20th. [[done]] --[[Joey]] -- cgit v1.2.3 From c02f9d224cb78a3ad880cb749ef4a11eadfad79a Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Wed, 17 Nov 2010 10:13:32 +0000 Subject: sorry, I'll try against master in future. --- ...ent_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn') diff --git a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn index b1053fc38..ff98ba55f 100644 --- a/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn +++ b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn @@ -58,3 +58,5 @@ However this doesn't work. I assume "included" in this context means e.g. via a > As far as I know, this bug was fixed in > 4a75dee651390b79ce4ceb1d951b02e28b3ce83a on October 20th. [[done]] --[[Joey]] + +>> Sorry Joey, I'll make sure to reproduce stuff against master in future. [[Jon]] -- cgit v1.2.3