[Po4a-devel] parsing asciidoc styles

Anders Nawroth anders at neotechnology.com
Thu Sep 27 13:16:59 UTC 2012


Ah, the correct term for all of this is an AttributeList, see:
http://www.methods.co.nz/asciidoc/userguide.html#X21
Which then has very different uses ...

The question is if we shouldn't just support anything in there and
make everything between the [] a no-wrap string to be translated?
Maybe keeping some specific support for verse and quote et al which
may benefit from that.
It just seems quite hard to perfectly parse all the ways
AttributeLists can be used in AsciiDoc.
(we don't want to re-implement AsciiDoc, right! ;-)

Keeping the no-extra-arguments built-ins as non-translatable string,
just like now.

WDYT?

/anders

On Thu, Sep 27, 2012 at 3:02 PM, Anders Nawroth
<anders at neotechnology.com> wrote:
> Oops, I found a few more:
>
> sect1, sect2, sect3, sect4
> preface, colophon, dedication, synopsis, index
>
> Seems a lot of different things in AsciiDoc share the same syntax,
> these are called "section templates" (there's a few more already in our lists):
> http://www.methods.co.nz/asciidoc/userguide.html#X93
> Other uses are "paragraph styles" and "filters".
>
> For the case with additional attributes, they are supported for verse
> and quote, filtered out like so:
>              ($line =~ m/^\[(verse|quote), +(.*)\]$/)) {
>
> To try it out I went with this text (as both original and translation):
> [verse, "William Blake", "from Auguries of Innocence"]
> To see a world in a grain of sand,
> And a heaven in a wild flower,
> Hold infinity in the palm of your hand,
> And eternity in an hour.
>
> Which outputs the following into the po file:
> #. type: verse
> #: target/original/src/dummy.asciidoc:4
> #, fuzzy, no-wrap
> msgid "\"William Blake\", \"from Auguries of Innocence\""
> msgstr "\"William Blake\", \"from Auguries of Innocence\""
>
> #. type: verse
> #: target/original/src/dummy.asciidoc:9
> #, fuzzy, no-wrap
> msgid ""
> "To see a world in a grain of sand,\n"
> "And a heaven in a wild flower,\n"
> "Hold infinity in the palm of your hand,\n"
> "And eternity in an hour.\n"
> msgstr ""
> "To see a world in a grain of sand,\n"
> "And a heaven in a wild flower,\n"
> "Hold infinity in the palm of your hand,\n"
> "And eternity in an hour.\n"
>
> I think this is good enough, but should be expanded to cover all styles in
> $asciidoc_RE_STYLE_PARAGRAPH and $asciidoc_RE_STYLE_LIST.
> And a user contributed list of styles/filters, I guess? (including the
> different wrapping modes)
>
> I'm currently fixing a problem with the current verse/quote +
> attributes code ...
> I'll report back regarding that soon.
>
> /anders



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



More information about the Po4a-devel mailing list