[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/DocBook.pm (%defaults, conve
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/DocBook.pm (%defaults, convert, convert_tree) ($DEFAULT_LANG, output, _convert): set the default for documentlanguage as undef, but use $DEFAULT_LANG, set to 'en' as lang attribute for the whole document if documentlanguage is undef. Use a stack of languages, with current documentlanguage value pushed at sectioning command opening, removed when a sectioning command is closed. If the new language is different from the container section, set a lang attribute. |
Date: |
Mon, 06 Sep 2021 12:29:06 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new e31d37f * tp/Texinfo/Convert/DocBook.pm (%defaults, convert,
convert_tree) ($DEFAULT_LANG, output, _convert): set the default for
documentlanguage as undef, but use $DEFAULT_LANG, set to 'en' as lang attribute
for the whole document if documentlanguage is undef. Use a stack of languages,
with current documentlanguage value pushed at sectioning command opening,
removed when a sectioning command is closed. If the new language is different
from the container section, set a lang at [...]
e31d37f is described below
commit e31d37f3a366bd68cd304b5b998a469f06da637a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 6 18:28:56 2021 +0200
* tp/Texinfo/Convert/DocBook.pm (%defaults, convert, convert_tree)
($DEFAULT_LANG, output, _convert): set the default for
documentlanguage as undef, but use $DEFAULT_LANG, set to 'en' as
lang attribute for the whole document if documentlanguage is undef.
Use a stack of languages, with current documentlanguage value
pushed at sectioning command opening, removed when a sectioning
command is closed. If the new language is different from the
container section, set a lang attribute.
* tp/Texinfo/Convert/DocBook.pm (%docbook_global_commands):
remove 'documentencoding'.
---
ChangeLog | 14 +
tp/Texinfo/Convert/DocBook.pm | 35 +-
tp/t/docbook_tests.t | 24 +-
.../docbook_tests/multiple_documentlanguage.pl | 833 +++++++++++++++++++++
4 files changed, 899 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 695c981..6bfe13b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2021-09-06 Patrice Dumas <pertusus@free.fr>
+ * tp/Texinfo/Convert/DocBook.pm (%defaults, convert, convert_tree)
+ ($DEFAULT_LANG, output, _convert): set the default for
+ documentlanguage as undef, but use $DEFAULT_LANG, set to 'en' as
+ lang attribute for the whole document if documentlanguage is undef.
+ Use a stack of languages, with current documentlanguage value
+ pushed at sectioning command opening, removed when a sectioning
+ command is closed. If the new language is different from the
+ container section, set a lang attribute.
+
+ * tp/Texinfo/Convert/DocBook.pm (%docbook_global_commands):
+ remove 'documentencoding'.
+
+2021-09-06 Patrice Dumas <pertusus@free.fr>
+
* tp/Texinfo/Convert/IXIN.pm: do not call
set_global_document_commands().
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 9d2c740..cd39ab4 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -59,7 +59,7 @@ my %defaults = (
'SUBDIR' => undef,
'output_format' => 'docbook',
'SPLIT' => 0,
- 'documentlanguage' => 'en',
+ 'documentlanguage' => undef,
'OPEN_QUOTE_SYMBOL' => $lsquo,
'CLOSE_QUOTE_SYMBOL' => $rsquo,
);
@@ -181,7 +181,6 @@ foreach my $command ('item', 'headitem', 'itemx', 'tab',
}
my %docbook_global_commands = (
- 'documentencoding' => 1,
'documentlanguage' => 1,
);
@@ -278,7 +277,9 @@ sub convert($$)
my $self = shift;
my $root = shift;
- $self->set_global_document_commands(-1);
+ if (! defined($self->{'lang_stack'})) {
+ $self->{'lang_stack'} = [''];
+ }
return $self->convert_document_sections($root);
}
@@ -287,9 +288,15 @@ sub convert_tree($$)
my $self = shift;
my $root = shift;
+ if (! defined($self->{'lang_stack'})) {
+ $self->{'lang_stack'} = [''];
+ }
return $self->_convert($root);
}
+# not the same as a default for @documentlanguage as it appears
+# as an empty string on the lang_stack.
+my $DEFAULT_LANG = 'en';
sub output($$)
{
my $self = shift;
@@ -311,8 +318,6 @@ sub output($$)
}
}
- $self->set_global_document_commands(-1);
-
my $encoding = '';
if ($self->get_conf('OUTPUT_ENCODING_NAME')
and $self->get_conf('OUTPUT_ENCODING_NAME') ne 'utf-8') {
@@ -327,12 +332,20 @@ sub output($$)
$id = '';
}
+ $self->{'lang_stack'} = [];
+ my $lang = $DEFAULT_LANG;
+ if (defined($self->get_conf('documentlanguage'))) {
+ $lang = $self->get_conf('documentlanguage');
+ push @{$self->{'lang_stack'}}, $self->get_conf('documentlanguage');
+ } else {
+ push @{$self->{'lang_stack'}}, '';
+ }
my $header = "<?xml version=\"1.0\"${encoding}?>".'
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY tex "TeX">
<!ENTITY latex "LaTeX">
]>
-'. "<book${id} lang=\"".$self->get_conf('documentlanguage') ."\">\n";
+'. "<book${id} lang=\"$lang\">\n";
my $result = '';
$result .= $self->_output_text($header, $fh);
@@ -687,6 +700,14 @@ sub _convert($$;$)
if ($root->{'extra'} and $root->{'extra'}->{'associated_node'}) {
$attribute .= "
id=\"$root->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}\"";
}
+ my $language = '';
+ if (defined($self->get_conf('documentlanguage'))) {
+ $language = $self->get_conf('documentlanguage');
+ if ($self->{'lang_stack'}->[-1] ne
$self->get_conf('documentlanguage')) {
+ $attribute .= ' lang="'.$self->get_conf('documentlanguage').'"';
+ }
+ }
+ push @{$self->{'lang_stack'}}, $language;
$result .= "<$command${attribute}>\n";
if ($root->{'args'} and $root->{'args'}->[0]) {
my ($arg, $end_line) =
$self->_convert_argument_and_end_line($root);
@@ -1460,6 +1481,7 @@ sub _convert($$;$)
if (!($root->{'section_childs'} and scalar(@{$root->{'section_childs'}}))
or $command_texi eq 'top') {
$result .= "</$command>\n";
+ pop @{$self->{'lang_stack'}};
my $current = $root;
while ($current->{'section_up'}
# the most up element is a virtual sectioning root element, this
@@ -1469,6 +1491,7 @@ sub _convert($$;$)
and $self->_level_corrected_section($current->{'section_up'}) ne
'top') {
$current = $current->{'section_up'};
$result .= '</'.$self->_docbook_section_element($current) .">\n";
+ pop @{$self->{'lang_stack'}};
}
}
}
diff --git a/tp/t/docbook_tests.t b/tp/t/docbook_tests.t
index 66f17ee..a770cd3 100644
--- a/tp/t/docbook_tests.t
+++ b/tp/t/docbook_tests.t
@@ -47,7 +47,29 @@ Glossary
@chapter A chapter Acnkowledgements
Ack!
-']
+'],
+['multiple_documentlanguage',
+'@documentlanguage ja
+
+@node Top
+@top top
+
+@node chap
+@chapter Chap no new language
+
+@documentlanguage fr
+@node chapter fr
+@chapter chapter fr
+
+@documentlanguage pt
+@node subnode pt
+@section section pt
+
+@documentlanguage fr
+@node subnode fr
+@section section fr
+
+'],
);
foreach my $test (@test_cases) {
diff --git a/tp/t/results/docbook_tests/multiple_documentlanguage.pl
b/tp/t/results/docbook_tests/multiple_documentlanguage.pl
new file mode 100644
index 0000000..8932023
--- /dev/null
+++ b/tp/t/results/docbook_tests/multiple_documentlanguage.pl
@@ -0,0 +1,833 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'multiple_documentlanguage'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'ja'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'documentlanguage',
+ 'extra' => {
+ 'spaces_before_argument' => ' ',
+ 'text_arg' => 'ja'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'text_root'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'Top'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'Top'
+ }
+ ],
+ 'normalized' => 'Top',
+ 'spaces_before_argument' => ' '
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 3,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'top'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'top',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 0,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'chap'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'chap'
+ }
+ ],
+ 'normalized' => 'chap',
+ 'spaces_before_argument' => ' '
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 6,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'Chap no new language'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'chapter',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'documentlanguage',
+ 'extra' => {
+ 'spaces_before_argument' => ' ',
+ 'text_arg' => 'fr'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 9,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 1,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 7,
+ 'macro' => ''
+ },
+ 'number' => 1,
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'chapter fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'chapter-fr'
+ }
+ ],
+ 'normalized' => 'chapter-fr',
+ 'spaces_before_argument' => ' '
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 10,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'chapter fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'chapter',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'pt'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'documentlanguage',
+ 'extra' => {
+ 'spaces_before_argument' => ' ',
+ 'text_arg' => 'pt'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 13,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 1,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 11,
+ 'macro' => ''
+ },
+ 'number' => 2,
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'subnode pt'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'subnode-pt'
+ }
+ ],
+ 'normalized' => 'subnode-pt',
+ 'spaces_before_argument' => ' '
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 14,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'section pt'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'section',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'documentlanguage',
+ 'extra' => {
+ 'spaces_before_argument' => ' ',
+ 'text_arg' => 'fr'
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 17,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 2,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 15,
+ 'macro' => ''
+ },
+ 'number' => '2.1',
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'subnode fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'contents' => [],
+ 'extra' => {
+ 'node_content' => [
+ {}
+ ],
+ 'nodes_manuals' => [
+ {
+ 'node_content' => [
+ {}
+ ],
+ 'normalized' => 'subnode-fr'
+ }
+ ],
+ 'normalized' => 'subnode-fr',
+ 'spaces_before_argument' => ' '
+ },
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 18,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => 'section fr'
+ }
+ ],
+ 'extra' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'parent' => {},
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'section',
+ 'contents' => [
+ {
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ }
+ ],
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 2,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 19,
+ 'macro' => ''
+ },
+ 'number' => '2.2',
+ 'parent' => {}
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'multiple_documentlanguage'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'multiple_documentlanguage'}{'contents'}[0]{'contents'}[0]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[0]{'contents'}[1]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[0]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[1]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[1];
+$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'extra'}{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[1]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[2]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[2]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[2];
+$result_trees{'multiple_documentlanguage'}{'contents'}[2]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[2];
+$result_trees{'multiple_documentlanguage'}{'contents'}[2]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[3]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[3];
+$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'extra'}{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[3]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[4]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[4];
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[4];
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'contents'}[1]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[4]{'contents'}[1];
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'contents'}[1]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[4];
+$result_trees{'multiple_documentlanguage'}{'contents'}[4]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[5]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[5];
+$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'extra'}{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[5]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[6]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[6];
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[6];
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'contents'}[1]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[6]{'contents'}[1];
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'contents'}[1]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[6];
+$result_trees{'multiple_documentlanguage'}{'contents'}[6]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[7]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[7];
+$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'extra'}{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[7]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[8]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[8];
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[8];
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
=
$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'contents'}[1]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[8]{'contents'}[1];
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'contents'}[1]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[8];
+$result_trees{'multiple_documentlanguage'}{'contents'}[8]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[9]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[9];
+$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'extra'}{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
=
$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'args'}[0]{'contents'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[9]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+$result_trees{'multiple_documentlanguage'}{'contents'}[10]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[10]{'args'}[0];
+$result_trees{'multiple_documentlanguage'}{'contents'}[10]{'args'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[10];
+$result_trees{'multiple_documentlanguage'}{'contents'}[10]{'contents'}[0]{'parent'}
= $result_trees{'multiple_documentlanguage'}{'contents'}[10];
+$result_trees{'multiple_documentlanguage'}{'contents'}[10]{'parent'} =
$result_trees{'multiple_documentlanguage'};
+
+$result_texis{'multiple_documentlanguage'} = '@documentlanguage ja
+
+@node Top
+@top top
+
+@node chap
+@chapter Chap no new language
+
+@documentlanguage fr
+@node chapter fr
+@chapter chapter fr
+
+@documentlanguage pt
+@node subnode pt
+@section section pt
+
+@documentlanguage fr
+@node subnode fr
+@section section fr
+
+';
+
+
+$result_texts{'multiple_documentlanguage'} = '
+top
+***
+
+1 Chap no new language
+**********************
+
+2 chapter fr
+************
+
+2.1 section pt
+==============
+
+2.2 section fr
+==============
+
+';
+
+$result_sectioning{'multiple_documentlanguage'} = {
+ 'level' => -1,
+ 'section_childs' => [
+ {
+ 'cmdname' => 'top',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top',
+ 'spaces_before_argument' => ' '
+ }
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 0,
+ 'section_childs' => [
+ {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'chap',
+ 'spaces_before_argument' => ' '
+ }
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 1,
+ 'number' => 1,
+ 'section_up' => {},
+ 'toplevel_prev' => {},
+ 'toplevel_up' => {}
+ },
+ {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'chapter-fr',
+ 'spaces_before_argument' => ' '
+ }
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 1,
+ 'number' => 2,
+ 'section_childs' => [
+ {
+ 'cmdname' => 'section',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'subnode-pt',
+ 'spaces_before_argument' => ' '
+ }
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 2,
+ 'number' => '2.1',
+ 'section_up' => {}
+ },
+ {
+ 'cmdname' => 'section',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'subnode-fr',
+ 'spaces_before_argument' => ' '
+ }
+ },
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 2,
+ 'number' => '2.2',
+ 'section_prev' => {},
+ 'section_up' => {}
+ }
+ ],
+ 'section_prev' => {},
+ 'section_up' => {},
+ 'toplevel_prev' => {},
+ 'toplevel_up' => {}
+ }
+ ],
+ 'section_up' => {}
+ }
+ ]
+};
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[0]{'section_up'}
= $result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[0]{'toplevel_prev'}
= $result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[0]{'toplevel_up'}
= $result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'section_childs'}[0]{'section_up'}
=
$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'section_childs'}[1]{'section_prev'}
=
$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'section_childs'}[1]{'section_up'}
=
$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'section_prev'}
=
$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'section_up'}
= $result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'toplevel_prev'}
=
$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_childs'}[1]{'toplevel_up'}
= $result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0];
+$result_sectioning{'multiple_documentlanguage'}{'section_childs'}[0]{'section_up'}
= $result_sectioning{'multiple_documentlanguage'};
+
+$result_nodes{'multiple_documentlanguage'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'top',
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 0
+ },
+ 'normalized' => 'Top',
+ 'spaces_before_argument' => ' '
+ },
+ 'node_next' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 1,
+ 'number' => 1
+ },
+ 'normalized' => 'chap',
+ 'spaces_before_argument' => ' '
+ },
+ 'node_next' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'level' => 1,
+ 'number' => 2
+ },
+ 'normalized' => 'chapter-fr',
+ 'spaces_before_argument' => ' '
+ },
+ 'node_prev' => {},
+ 'node_up' => {}
+ },
+ 'node_prev' => {},
+ 'node_up' => {}
+ }
+};
+$result_nodes{'multiple_documentlanguage'}{'node_next'}{'node_next'}{'node_prev'}
= $result_nodes{'multiple_documentlanguage'}{'node_next'};
+$result_nodes{'multiple_documentlanguage'}{'node_next'}{'node_next'}{'node_up'}
= $result_nodes{'multiple_documentlanguage'};
+$result_nodes{'multiple_documentlanguage'}{'node_next'}{'node_prev'} =
$result_nodes{'multiple_documentlanguage'};
+$result_nodes{'multiple_documentlanguage'}{'node_next'}{'node_up'} =
$result_nodes{'multiple_documentlanguage'};
+
+$result_menus{'multiple_documentlanguage'} = {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top',
+ 'spaces_before_argument' => ' '
+ }
+};
+
+$result_errors{'multiple_documentlanguage'} = [];
+
+
+$result_floats{'multiple_documentlanguage'} = {};
+
+
+
+$result_converted{'docbook'}->{'multiple_documentlanguage'} = '
+<chapter label="" id="Top" lang="ja">
+<title>top</title>
+
+</chapter>
+<chapter label="1" id="chap" lang="ja">
+<title>Chap no new language</title>
+
+</chapter>
+<chapter label="2" id="chapter-fr" lang="fr">
+<title>chapter fr</title>
+
+<sect1 label="2.1" id="subnode-pt" lang="pt">
+<title>section pt</title>
+
+</sect1>
+<sect1 label="2.2" id="subnode-fr">
+<title>section fr</title>
+
+</sect1>
+</chapter>
+';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/DocBook.pm (%defaults, convert, convert_tree) ($DEFAULT_LANG, output, _convert): set the default for documentlanguage as undef, but use $DEFAULT_LANG, set to 'en' as lang attribute for the whole document if documentlanguage is undef. Use a stack of languages, with current documentlanguage value pushed at sectioning command opening, removed when a sectioning command is closed. If the new language is different from the container section, set a lang attribute.,
Patrice Dumas <=