Bug 12207: fix TTparser's handling of TT directives that contain "]"
authorPasi Kallinen <pasi.kallinen@pttk.fi>
Wed, 7 May 2014 06:49:01 +0000 (09:49 +0300)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 23 May 2014 15:23:20 +0000 (15:23 +0000)
commit5f740f03fe8e8ee2b7f2e6a64ce9d50cc3cad25f
tree7949ddf24dea319340074db9de4e44f15fe50342
parent8a32843ebf8ba959ac2af95cf76caae71209b8db
Bug 12207: fix TTparser's handling of TT directives that contain "]"

This piece of TT code:

  [% SWITCH lang %]
   [% CASE ['en', 'eng'] %]English
   [% CASE ['fr', 'fre'] %]French
   [% CASE ['it', 'ita'] %]Italian
    ...
   [% CASE %][% lang %]
  [% END %]

is parsed by the TTparser.pm wrong. In the po-files, it shows up as:

   ...

All the "CASE [ ... ]" codes are shown as "ERROR".
This happens if any TT statement contains a ']' in it - the TTParser
looks for anything that starts with [% and ends with ].

This patch fixes it so that it expects TT directives to end
with '%]'.

To test:

1)  cd misc/translator/
2)  perl translate update xx-YY
3)  for x in po/xx-YY-*.po; do cp "$x" "${x/.po/.po.bak}"; done
4)  apply patch
5)  perl translate update xx-YY
6)  for x in po/xx-YY-*.po; do diff -Nurd "$x" "${x/.po/.po.bak}"; done
      the only changed lines should be those that apply to msgid's with
      ERROR-parameters.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described. No errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/TTParser.pm