[Koha-bugs] [Bug 6458] incorrect parsing result in translation processing

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jul 21 09:12:56 CEST 2011


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6458

--- Comment #6 from Frère Sébastien Marie <semarie-koha at latrappe.fr> 2011-07-21 07:12:56 UTC ---
Currently, the parser search the string "[%" in *every* HTML tag.

But it isn't a HTML parser. It just track when the string "[%" in placed after
the string "<" (and not ">" between "<" and "[%"), and not between two string
'"'. (but need to track also CDATA and COMMENT because of false-positive else).

It follow a *very simplified* HTML syntax for parsing.

It is relatively simple (and commented), and based on a "context" concept: it
just defined rules for enter in a "context", and to change the "context", when
a specific string is encounter.

For the INITIAL context (the default one):
 - when "<![CDATA[" string is encounter: go in CDATA context
 - when "<!--" string is encounter: go in COMMENT context
 - when "<" string encounter: go in TAG context

For the TAG context:
 - when encounter the string '"' : enter in STRING context
 - when encounter the string "[%" : mark a problem, as a template directive is
found in tag, but not in an attribute (because an attribute is a STRING
context)
 - when encounter the string ">": go in INITIAL context

For the STRING context:
 - when encounter the string '\"' : keep the STRING context
 - when encounter only the string '"' : go in TAG context

(in CDATA context, how to go in INITIAL context : "]]>" encounter ;
 or in COMMENT context: "-->"
)

That's all... (but the parser keep track the line number for reporting).

I hope I answer your question, and that I have clarified how work the parser...

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the Koha-bugs mailing list