bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch: set id attribute for part in DocBook


From: Patrice Dumas
Subject: Re: patch: set id attribute for part in DocBook
Date: Mon, 10 Nov 2014 11:41:47 +0100
User-agent: Mutt/1.5.20 (2009-12-10)

On Sun, Nov 09, 2014 at 10:56:30PM -0800, Per Bothner wrote:
> It would be nice if the DocBook output generated for @part
> would include an id attribute. This is used for setting the filename
> in "chunked html" output in the standard DocBook XSLT scripts.
> 
> The attacked patch is definitely broken (it fails on the example
> in the texinfo manual with an @* in the part name).  However, it does do what 
> I
> need it to do. It would be much appreciated if someone who knows what they're
> doing could clean it up and check it in.

Indeed, id are added when there are nodes associated with sectioning
commands and @part is never associated with nodes.

The id from nodes obeys very strict constraints, explained in the HTML
part of the manual, for example,

 a "Th@'e" à.

leads to
 a-_0022Th_00e9_0022-_00c3_00a0_002e

Is it ok?  It would be consistent with other generated id.  It is
possible to have id slightly more readable, for instance what is used
for file names in html, like

 a-_0022The_0022-A-_002e

Opinion?

> -- 
>       --Per Bothner
> address@hidden   http://per.bothner.com/

> Index: tp/Texinfo/Convert/DocBook.pm
> ===================================================================
> --- tp/Texinfo/Convert/DocBook.pm     (revision 5920)
> +++ tp/Texinfo/Convert/DocBook.pm     (working copy)
> @@ -640,6 +640,12 @@
>            if ($root->{'extra'} and $root->{'extra'}->{'associated_node'}) {
>              $attribute .= " 
> id=\"$root->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}\"";
>            }
> +          elsif ($root->{'cmdname'} eq 'part' && $root->{'args'} and 
> $root->{'args'}->[0]) {
> +            my ($arg, $end_line)
> +              = $self->_convert_argument_and_end_line($root->{'args'}->[0]);
> +            $arg = 
> Texinfo::Convert::NodeNameNormalization::_unicode_to_protected($arg);
> +            $attribute .= " id=\"$arg\"";
> +          }
>            $result .= "<$command${attribute}>\n";
>            if ($root->{'args'} and $root->{'args'}->[0]) {
>              my ($arg, $end_line)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]