docbook.conf change for simpara attribute

37 views
Skip to first unread message

Mats

unread,
Sep 9, 2009, 4:08:16 AM9/9/09
to asciidoc
Dear all,

Following my other query, I also need to set a role attribute on a
certain simpara. I assumed that including this snippet in the
docbook.conf (in the article document type section) would fit the
bill:

[simpara]
<simpara{role? role="{role}"}>
|
</simpara>

but to no avail. Any suggestions? Stuart, perhaps?

Best regards,
Mats Broberg

Stuart Rackham

unread,
Sep 9, 2009, 4:40:02 AM9/9/09
to asci...@googlegroups.com
What version are you on? As of 8.4.5 you can now add a role attribute to block
elements including paragraphs (see
http://www.methods.co.nz/asciidoc/CHANGELOG.html).

This example:

[role="foobar"]
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens.


outputs:

<simpara role="foobar">Qui in magna commodo, est labitur dolorum an. Est ne
magna primis
adolescens.</simpara>

See the [paragraph] (default paragraph definition) section in docbook.conf


Cheers, Stuart


>
> Best regards,
> Mats Broberg
> >
>

Mats

unread,
Sep 9, 2009, 5:24:05 AM9/9/09
to asciidoc
> What version are you on? As of 8.4.5 you can now add a role attribute to block
> elements including paragraphs (seehttp://www.methods.co.nz/asciidoc/CHANGELOG.html).

Hi Stuart,

Ok, thanks, now I've upgraded to 8.4.5. and the role attribute works
fine.

However, there seems to be a changed behavior re: the lang attribute
in my previous thread, with 8.4.5. In 8.4.4., lang="en" was only added
to the section after the [lang="en"], with 8.4.5 is is added to _all_
sections in the article.

So this:

[sect1]
<section{id? id="{id}"}{role? role="{role}"}{reftext?
xreflabel="{reftext}"}{lang? lang="{lang}"}>
<title>{title}</title>
|
</section>

has a different behavior in 8.4.5. than in 8.4.4.

Best regards,
Mats Broberg

Stuart Rackham

unread,
Sep 9, 2009, 10:23:22 PM9/9/09
to asci...@googlegroups.com
Previously the lang attribute was not set by default, the en default was set in
the configuration file headers if lang was not set:

<article lang="{lang=en}">^

The default is now set in asciidoc.conf i.e. a global lang attr will always be
set. This means your customized sections will always have the lang attribute
set, they are redundant but semantically this is exactly the same as before.

Mats

unread,
Sep 10, 2009, 1:52:40 AM9/10/09
to asciidoc
Hi Stuart,

Hmm. The thing is that I write an original article (in AsciiDoc) that
has lang=en on the article element. This article (when in DocBook XML)
is then translated into 20 languages by our translation agency. They
automatically change the article lang attribute to the respective
target language attribute, which is fine. But one section in the now-
translated article stays, as per our instruction, in English. To make
the batch formatter trigger a new hyphenation algorithm on that
section only, I need that section to have lang=en already from the
beginning.

Best regards,
Mats Broberg

Stuart Rackham

unread,
Sep 10, 2009, 2:36:56 AM9/10/09
to asci...@googlegroups.com
Mats wrote:
> Hi Stuart,
>
> Hmm. The thing is that I write an original article (in AsciiDoc) that
> has lang=en on the article element. This article (when in DocBook XML)
> is then translated into 20 languages by our translation agency. They
> automatically change the article lang attribute to the respective
> target language attribute, which is fine. But one section in the now-
> translated article stays, as per our instruction, in English. To make
> the batch formatter trigger a new hyphenation algorithm on that
> section only, I need that section to have lang=en already from the
> beginning.

I'm not sure I understand, are they changing the lang attribute by manually
editing the downstream DocBook XML file instead of in the AsciiDoc source file?

Mats

unread,
Sep 10, 2009, 3:20:39 PM9/10/09
to asciidoc
Hi Stuart,

The article lang attribute in the XML file, yes. Commercial
localization vendors, tools and workflows require XML files, so that
is the reason we don't send them AsciiDoc source.

So the bottom line is, how do I set a specific lang attribute on a
specific section or para already in the Asciidoc source?

Best regards,
Mats Broberg

Stuart Rackham

unread,
Sep 10, 2009, 6:30:21 PM9/10/09
to asci...@googlegroups.com
Mats wrote:
> Hi Stuart,
>
> The article lang attribute in the XML file, yes. Commercial
> localization vendors, tools and workflows require XML files, so that
> is the reason we don't send them AsciiDoc source.
>
> So the bottom line is, how do I set a specific lang attribute on a
> specific section or para already in the Asciidoc source?

You could set the en by default in the docbook.conf headers (this was the
previous behavior) e.g.

<article lang="{lang=en}"}>

Then undefine the default lang attribute either:

- on command-line with -a lang!
- preceeding header in document with :lang!:
- in $HOME/.asciidoc/asciidoc.conf with lang!

The problem now is that you'll get the error: 'language attribute (lang) is not
defined'. There needs to be an additional change to asciidoc.py for this to work.

Actually it turned out to be quite tricky to restore the old default behavior
and it uncovered a subtle lang attribute precedent bug. I've committed a
changeset that should work:
http://hg.sharesource.org/asciidoc/rev/3c66a765bb9d

Give it a whirl.


Cheers, Stuart
Reply all
Reply to author
Forward
0 new messages