[Po4a-devel] parsing asciidoc styles

Anders Nawroth anders at neotechnology.com
Wed Sep 26 16:03:20 UTC 2012


Hi!

I found a problem with the parsing of AsciiDoc "styles", or rather,
they are simply not parsed.

Here's an example.

In the original file we have:
[appendix]
Questions & Answers
===================

The po file generated by po4a-gettextize looks like this:
#. type: Plain text
#: target/original/src/qanda/index.asciidoc:4
msgid "[appendix] Questions & Answers"
msgstr "[appendix] Questions & Réponses"

And thus the following get generated when translating:
[appendix] Questions & Réponses
===================

So, "[appendix]" is something called a style in AsciiDoc.
There exists a few predefined styles and you can add your own as well.
The AsciiDoc filters are defined as styles.

I was only going to report this, but after having a look at the newly
refactored (thanks!)
Text.pm I changed my mind and fixed it instead :-)

Here's the essential part of the diff:

-             ($line =~
m/^\[(NOTE|TIP|IMPORTANT|WARNING|CAUTION|verse|quote)\]$/)) {
+             ($line =~
m/^\[(NOTE|TIP|IMPORTANT|WARNING|CAUTION|verse|quote|appendix|horizontal|qanda|glossary|bibliography|listing|abstract|partintro|literal|float|normal|comment|example|sidebar|source|music|latex|graphviz|arabic|loweralpha|upperalpha|lowerroman|upperroman)\]$/))
{

I went through the AsciiDoc user guide and added all the styles I
could find in it.
Didn't look into the AsciiDoc sources, though.

A slightly related problem which I didn't fix:
When applying a filter and having attributes/parameters for it, that
line is parsed as plain text.
it should be no-wrap really, I think.

Example:

#. type: Plain text
#: target/original/src/introduction/what-is-a-graphdb.asciidoc:20
msgid "[\"dot\", \"graphdb-GVE.svg\", \"meta\"]"
msgstr "[\"dot\", \"graphdb-GVE.svg\", \"meta\"]"

(We have a bunch of our own AsciiDoc filters, obviously one is named "dot".)

I do think this message should get translated (as there may be
attributes in there that you wish to alter in a translation), but it's
not plain text.


/anders

-- 
Anders Nawroth [anders at neotechnology.com]
Skype: anders.nawroth



More information about the Po4a-devel mailing list