[Po4a-devel] Xhtml module: Integrated comments and strange whitespace

Kaloian Doganov kaloian at doganov.org
Sun Aug 12 16:00:45 UTC 2007


Nicolas François <nicolas.francois at centraliens.net> writes:

    I understand that the empty lines and the concatenation of
    comments is not very pretty (this can be even more strange when
    there are comments before, in the middle and after a translatable
    paragraph), but is it really an issue?

It's nice not to have a screen of empty lines in the resulting
document, but it's not fatal to have them.  They can't cause a
misintepretation of the document and that's the most important.  Even
if we still don't like them for some reason, we can always strip them
with an external script afterwards.

But the concatenation of comments is a real issue.  It is useful to
have a construct that is guaranteed not to be modified by the
processing tool (po4a).  In Html module, comments were such
constructs.  We used them in a preprocessing phase to leave marks and
placeholders in the original document that have special meaning to our
postprocessing tools.  The workflow is (very roughly):

   Process an article
   ------------------
   1. Preprocess the original article
   2. Run po4a on the preprocessed article to get localized one
   3. Postprocess the localized article

For instance, in the first phase we comment out some portions of the
document that must not be made translatable.  Here is one real
example:

    <p>
    Updated:
    <!-- timestamp start -->
    $Date: 2007/06/19 00:02:58 $
    <!-- timestamp end -->
    </p>

We don't want the line with $Date to be translatable at all, since it
is set automatically by CVS.  This is a dynamically changing string
that we don't want to leak in POT and POs.  So we comment it out and
after the preprocessing phase the fragment looks like this:

    <p>
    Updated:
    <!-- timestamp start -->
    <!-- $Date: 2007/06/19 00:02:58 $ -->
    <!-- timestamp end -->
    </p>

After the po4a phase it looks like (for Bulgarian):

    <p>
    Последно обновяване:
    <!-- timestamp start -->
    <!-- $Date: 2007/06/19 00:02:58 $ -->
    <!-- timestamp end -->
    </p>

And finally, after the postprocessing phase the fragment looks like
this (for Bulgarian):

    <p>
    Последно обновяване:
    <!-- timestamp start -->
    $Date: 2007/06/19 00:02:58 $
    <!-- timestamp end -->
    </p>

This was working fine with Html module, but Xhtml's comment
concatenation breaks it.  I don't insist on keeping the Html's way of
doing things, I can imagine that comment concatenation may be good in
other cases, but it is really useful to have some construct that po4a
will just pass verbatim into the output document.

(The above example was picked because is the shortest one.)


-- 
Protect your digital freedom and privacy, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm



More information about the Po4a-devel mailing list