[Po4a-devel]Canonizing tabs

Nicolas François nicolas.francois@centraliens.net
Mon, 21 Mar 2005 23:45:49 +0100


On Mon, Mar 21, 2005 at 03:56:37PM +0100, Jordi Vilalta wrote:
> today, while testing the Docbook module on new documents, I've seen that 
> some docbook documents are indented with tabs. I've noticed that the 
> canonizing function doesn't handle tabs, and such msgids look like this:
> 
> "line1\t\t\tline2\t\t\tline3..."
> 
> It's so annoying to translate. Can we also canonize tabs to spaces or 
> would it break something?

For the TeX format, there shouldn't be any problem (IIRC, spaces and tabs
are quite equivalent, except in verbatim blocks, which are not canonized
anyway).

For the Man and Pod modules, I can think of possible issues, because a
space is not be equivalent to a tab (e.g. at the beginning of a line, or
when the tab is used for alignment). However, all these are theoric, and I
could not make pages (that would not have been considered buggy) showing
any issue (in these cases, the document should have use verbatim blocks).

> This simple patch works for me:

I will try the exhaustive test suite (but I think it is not suitable to
detect possible issues triggered by this patch).

> +    $text =~ s/\t/  /gm;

Note that this change all tabs, not only trailing and leading tabs.


Best Regards,
-- 
Nekral