]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/po_vs_templates.mdwn
probably a markdown issue
[ikiwiki.git] / doc / bugs / po_vs_templates.mdwn
1 The po plugin's protection against processing loops (i.e. the
2 alreadyfiltered stuff) is playing against us: the template plugin
3 triggers a filter hooks run with the very same ($page, $destpage)
4 arguments pair that is used to identify an already filtered page.
5
6 Processing an included template can then mark the whole translation
7 page as already filtered, which prevented `po_to_markup` to be called on
8 the PO content.
9
10 Symptoms: the unprocessed gettext file goes unfiltered to the
11 generated HTML.
12
13 This has been fixed in my po branch.
14
15 > My commit dcd57dd5c9f3265bb7a78a5696b90976698c43aa updates the
16 > bugfix in a much more elegant manner. Its main disadvantage is to
17 > add an (optional) argument to IkiWiki::filter. Please review.
18
19 -- [[intrigeri]]
20
21 >> Hmm. Don't like adding a fourth positional parameter to that (or
22 >> any really) function.
23 >>
24 >> I think it's quite possible that some of the directives that are
25 >> calling filter do so unnecessarily. For example, conditional,
26 >> cutpaste, more, and toggle each re-filter text that comes from the
27 >> page and so has already been filtered. They could probably drop
28 >> the filtering. template likewise does not need to filter the 
29 >> parameters passed into it. Does it need to filter the template output?
30 >> Well, it allows the (deprecated) embed plugin to work on template
31 >> content, but that's about it.
32 >>
33 >> Note also that the only other plugin to provide a filter, txt,
34 >> could also run into similar problems as po has, in theory (it looks at
35 >> the page parameter and assumes the content is for the whole page).
36 >>
37 >> [[!template id=gitbranch branch=origin/filter-full author="[[joey]]"]]
38 >> So, I've made a filter-full branch, where I attempt to fix this
39 >> by avoiding unnecessary filtering. Can you check it and merge it into
40 >> your po branch and remove your other workarounds so I can merge?
41 >> --[[Joey]]
42
43 >>> I merged your filter-full branch into my po branch and reverted my
44 >>> other workarounds. According to my tests this works ok. I'm glad
45 >>> you found this solution, as I didn't like changing the filter
46 >>> prototype. I believe you can now merge this code. --[[intrigeri]]
47
48 [[!tag patch done]]