YAML filter should escape sequences before passing to subfilters.

Issue #556 resolved
Nikolai Vladimirov created an issue

Given the following YML file:

html: "Visit <a href=\"http://www.google.com\">Google</a>"

And the YAML filter configured with HTML subfilter like this:

#v1                                                                                                                                                                                                                                                                                      
extractIsolatedStrings.b=false                                                  
extractAllPairs.b=true                                                          
exceptions=                                                                     
useKeyAsName.b=true                                                             
useFullKeyPath.b=true                                                           
useCodeFinder.b=false                                                           
escapeNonAscii.b=false                                                          
wrap.b=true                                                                     
codeFinderRules.count.i=0                                                       
codeFinderRules.sample=%s, %d, {1}, \n, \r, \t, {{var}} etc.                    
codeFinderRules.useAllRulesWhenTesting.b=true                                   
subfilter=okf_html

Produces the following result .out file when using the test tool in Rainbow:

html: "Visit <a href=\"\\"http://www.google.com\\"\">Google</a>"

The translatable entities look correct in the test tool:

Visit <1>Google</1>

Am I missing some config option?

I tried playing around with custom okf_html configs with various quote mode parameters, but the output is always broken.

Comments (3)

  1. Chase Tingley

    cc @jhargraveiii

    It looks like the HTML subfilter is passing this value back after merging:

    Visit <a href="\&quot;http://www.google.com\&quot;">Google</a>
    

    Then the YamlEncoder is applied to it, further making a mess of things.

    However, I think the root of the problem may be the string we initially pass to the HTML subfilter during extraction. We're passing this:

    Visit <a href=\"http://www.google.com\">Google</a>
    

    Note that the escaping \ character, which is YAML markup, hasn't been removed before calling HTML. That looks funny to me.

  2. Log in to comment