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

Nicolas François nicolas.francois at centraliens.net
Sun Aug 12 16:43:10 UTC 2007


On Sun, Aug 12, 2007 at 07:00:45PM +0300, kaloian at doganov.org wrote:
> Nicolas François <nicolas.francois at centraliens.net> writes:
> 
> 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>

OK. I see how you use it.

One option could be to use another trick:
        <p>
        Updated:
        <timestamp date="$Date: 2007/06/19 00:02:58 $">
        </p>

This could be generated by the preprocessor, and the timestamp could be
restored afterward by the postprocessor.

I can try to add an option to handle comments differently:
 * drop comments inside a line
   (foo bar<!-- comment> baz qux)
 * keep the comments for lines which only contain comments (and spaces)
 * Use this commented lines as paragraph separators.
 * keep the comments gathered since the last paragraph to display them in
   the PO (but print them as is in the generated document)

(If we want to output the comments in place where they were found,
paragraphs like:

        foo bar
        <!-- comment -->
        baz qux

will have to be translated as two different paragraphs.)

I will work on it after the 0.32 release.

Best Regards,
-- 
Nekral



More information about the Po4a-devel mailing list