summaryrefslogtreecommitdiff
path: root/doc/recentchanges/change_53e519931f3a6b7cea0af652d749344757d4e2bc._change
blob: 05105eacc8350c5410d9ba4a1af031371c599e36 (plain)
  1. [[!meta author="""http://jmtd.livejournal.com/"""]]
  2. [[!meta authorurl="""http://jmtd.livejournal.com/"""]]
  3. [[!meta title="""change to bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date on ikiwiki"""]]
  4. [[!meta permalink="http://ikiwiki.info/recentchanges/#change-53e519931f3a6b7cea0af652d749344757d4e2bc"]]
  5. <div id="change-53e519931f3a6b7cea0af652d749344757d4e2bc" class="metadata">
  6. <span class="desc"><br />Changed pages:</span>
  7. <span class="pagelinks">
  8. <a href="http://git.ikiwiki.info/?p=ikiwiki;a=blobdiff;f=doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn;h=70af505c124ac6ddb6e987c2625f92629de4690b;hp=0000000000000000000000000000000000000000;hb=53e519931f3a6b7cea0af652d749344757d4e2bc;hpb=5ecba3b05d66bb58dc48a9027838e8b0bcbc0db9" title="diff" rel="nofollow">[[diff|wikiicons/diff.png]]</a><a href="http://ikiwiki.info/ikiwiki.cgi?page=bugs%2Fargument_isn__39__t_numeric%3A_mixing_templates_and_creation__95__date&amp;do=goto" rel="nofollow">bugs/argument isn&#39;t numeric: mixing templates and creation&#95;date</a>
  9. </span>
  10. <span class="desc"><br />Changed by:</span>
  11. <span class="committer">
  12. <a href="http://jmtd.livejournal.com/" rel="nofollow">jmtd [livejournal.com]</a>
  13. </span>
  14. <span class="desc"><br />Commit type:</span>
  15. <span class="committype">web</span>
  16. <span class="desc"><br />Date:</span>
  17. <span class="changedate"><span class="relativedate" title="Mon, 15 Nov 2010 10:23:01 -0400">10:23:01 11/15/10</span></span>
  18. <span class="desc"><br /></span>
  19. </div>
  20. <span class="revert">
  21. <a href="http://ikiwiki.info/ikiwiki.cgi?rev=53e519931f3a6b7cea0af652d749344757d4e2bc&amp;do=revert" title="revert" rel="nofollow">[[revert|wikiicons/revert.png]]</a>
  22. </span>
  23. <div class="changelog">
  24. template files being treated as regular pages and the problems that can cause<br />
  25. </div>
  26. <div class="diff">
  27. <pre>
  28. 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
  29. new file mode 100644
  30. index 0000000..70af505
  31. --- /dev/null
  32. +++ b/doc/bugs/argument_isn__39__t_numeric:_mixing_templates_and_creation__95__date.mdwn
  33. @@ -0,0 +1,58 @@
  34. +I get the following error when building my wiki
  35. +
  36. + Argument &quot;\x{3c}\x{54}...&quot; isn&#39;t numeric in numeric eq (==) at /usr/share/perl5/IkiWiki.pm line 2547.
  37. + Argument &quot;\x{3c}\x{54}...&quot; isn&#39;t numeric in numeric eq (==) at /usr/share/perl5/IkiWiki.pm line 2547.
  38. +
  39. +that line corresponds to
  40. +
  41. + sub match_creation_year ($$;@) {
  42. + if ((localtime($IkiWiki::pagectime{shift()}))&#91;5&#93; + 1900 == shift) { &lt;-- this one
  43. + return IkiWiki::SuccessReason-&gt;new(&#39;creation_year matched&#39;);
  44. + }
  45. +
  46. +A git bisect shows that the offending commit introduced this hunk
  47. +
  48. +
  49. + --- /dev/null
  50. + +++ b/templates/all_entry.mdwn
  51. + @@ -0,0 +1,23 @@
  52. + +## &lt;TMPL_VAR year&gt;
  53. + +
  54. + +There
  55. + +&lt;TMPL_IF current&gt;
  56. + +have been
  57. + +&lt;TMPL_ELSE&gt;
  58. + +were
  59. + +&lt;/TMPL_IF&gt;
  60. + +&#91;&#91;!pagecount pages=&quot;
  61. + +log/* and !tagged(aggregation) and !*/Discussion and !tagged(draft)
  62. + +and creation_year(&lt;TMPL_VAR year&gt;)
  63. + +and !*.png and !*.jpg
  64. + +&quot;&#93;&#93; posts
  65. + +&lt;TMPL_IF current&gt;
  66. + +so far
  67. + +&lt;/TMPL_IF&gt;
  68. + +in &lt;TMPL_VAR year&gt;.
  69. + +
  70. + +&#91;&#91;!inline pages=&quot;
  71. + + log/* and !tagged(aggregation) and !*/Discussion and !tagged(draft)
  72. + + and creation_year(&lt;TMPL_VAR year&gt;)
  73. + + and !*.png and !*.jpg
  74. + + &quot; archive=yes feeds=no&#93;&#93;
  75. +
  76. +The lines which feature creation_year(&lt;TMPL_VAR year&gt;) 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.
  77. +
  78. +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.
  79. +
  80. + \&#91;&#91;!template id=all_entry.tmpl year=2010 current=true&#93;&#93;
  81. +
  82. +An alternative fix is to wrap the entire template inside a test to see whether the page is included or not. E.g.
  83. +
  84. +
  85. + \&#91;&#91;!if test=&quot;included()&quot; then=&quot;&quot;&quot;
  86. + ...template...
  87. + &quot;&quot;&quot; else=&quot;&quot;&quot;
  88. + Nothing to see here.
  89. + &quot;&quot;&quot;&#93;&#93;
  90. +
  91. +In fact, this is probably best practice for in-srcdir templates. I&#39;d consider this done if the documentation for the directive suggested it. -- &#91;&#91;Jon&#93;&#93;
  92. </pre>
  93. </div>
  94. <!-- 53e519931f3a6b7cea0af652d749344757d4e2bc -->