response
[ikiwiki.git] / doc / bugs / cutpaste.pm:_missing_filter_call.mdwn
1 Consider this:
2
3     $ wget http://www.thomas.schwinge.homeip.net/tmp/cutpaste_filter.tar.bz2
4     $ wget http://www.thomas.schwinge.homeip.net/tmp/cutpaste_filter.patch
5     
6     $ tar -xj < cutpaste_filter.tar.bz2
7     $ cd cutpaste_filter/
8     $ ./render_locally
9     $ find "$PWD".rendered/ -type f -print0 | xargs -0 grep -H -E 'FOO|BAR'
10     [notice one FOO in there]
11     $ rm -rf .ikiwiki "$PWD".rendered
12     
13     $ cp /usr/share/perl5/IkiWiki/Plugin/cutpaste.pm .library/IkiWiki/Plugin/
14     $ patch -p0 < ../cutpaste_filter.patch
15     $ ./render_locally
16     $ find "$PWD".rendered/ -type f -print0 | xargs -0 grep -H -E 'FOO|BAR'
17     [correct; notice no more FOO]
18
19 I guess this needs a general audit -- there are other places where `preprocess`
20 is being doing without `filter`ing first, for example in the same file, `copy`
21 function.
22
23 --[[tschwinge]]
24
25 > So, in English, page text inside a cut directive will not be filtered.
26 > Because the cut directive takes the text during the scan pass, before
27 > filtering happens.
28
29 > Commit 192ce7a238af9021b0fd6dd571f22409af81ebaf and
30 > [[bugs/po_vs_templates]] has to do with this.
31 > There I decided that filter hooks should *only* act on the complete
32 > text of a page. 
33
34 > I also suggested that anything that wants to reliably
35 > s/FOO/BAR/ should probably use a sanitize hook, not a filter hook.
36 > I think that would make sense in this example.
37
38 > I don't see any way to make cut text be filtered while satisfying these
39 > constraints, without removing cutpaste's ability to have forward pastes
40 > of text cut laster in the page. (That does seems like an increasingly
41 > bad idea..) --[[Joey]]