[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp TODO Texinfo/Convert/HTML.pm t/30sec...
From: |
Patrice Dumas |
Subject: |
texinfo/tp TODO Texinfo/Convert/HTML.pm t/30sec... |
Date: |
Wed, 20 Jul 2011 14:21:51 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/07/20 14:21:51
Modified files:
tp : TODO
tp/Texinfo/Convert: HTML.pm
tp/t : 30sectioning.t
Added files:
tp/t/results/sectioning: two_unnumbered_no_argument.pl
Log message:
Handle better @*contents formatting.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/30sectioning.t?cvsroot=texinfo&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/sectioning/two_unnumbered_no_argument.pl?cvsroot=texinfo&rev=1.1
Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- TODO 16 Jul 2011 13:38:54 -0000 1.143
+++ TODO 20 Jul 2011 14:21:50 -0000 1.144
@@ -127,6 +127,12 @@
In html test empty @top for title, with different cases for
setcontentsaftertit* and for anchors.
+Tests in contents/ are incorporated? Also a test is missing, along:
address@hidden chap
address@hidden part
address@hidden jjj
address@hidden
+
@address@hidden leads to R( in @var? Test in
plaintext_tests/characters_and_commands_in_var
Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- Texinfo/Convert/HTML.pm 17 Jul 2011 00:59:56 -0000 1.112
+++ Texinfo/Convert/HTML.pm 20 Jul 2011 14:21:51 -0000 1.113
@@ -2809,7 +2809,9 @@
my $index_id = $self->command_id ($command);
if (defined($index_id) and $index_id ne '' and
address@hidden>{'multiple_pass'}}) {
- return "<a name=\"$index_id\"></a>\n";
+ my $result = "<a name=\"$index_id\"></a>";
+ $result .= "\n" unless ($self->in_preformatted());
+ return $result;
}
return '';
}
@@ -2986,6 +2988,9 @@
my $result = '';
my $special_element
= $self->special_element($contents_command_element_name{$cmdname});
+ # This may not be defined if setcontentsaftertitlepage is set and
+ # @titlepage is not used.
+ if ($special_element) {
my $id = $self->command_id($special_element);
if ($id ne '') {
$result .= "<a name=\"$id\"></a>\n";
@@ -2995,6 +3000,10 @@
$result .= $content . "\n";
return $result;
}
+ #else {
+ #cluck "$cmdname special element not defined";
+ #}
+ }
return '';
}
@@ -3007,11 +3016,12 @@
$cmdname = 'shortcontents' if ($cmdname eq 'summarycontents');
$self->_informative_command($command);
- if ($self->get_conf('INLINE_CONTENTS')) {
- if ($cmdname eq 'contents' or $cmdname eq 'shortcontents') {
+ if ($self->get_conf('INLINE_CONTENTS')
+ and ($cmdname eq 'contents' or $cmdname eq 'shortcontents')
+ and ! ($self->get_conf('set'.$cmdname.'aftertitlepage')
+ and $self->get_conf('USE_TITLEPAGE_FOR_TITLE'))) {
return $self->_contents_inline_element($cmdname, $command);
}
- }
return '';
}
@@ -3144,6 +3154,8 @@
my @pre_classes = $self->preformatted_classes_stack();
foreach my $class (@pre_classes) {
+ # FIXME maybe add or $pre_class eq 'menu-preformatted' to override
+ # 'menu-preformatted' wiith 'menu-comment'?
$pre_class = $class unless ($pre_class
and $preformatted_code_commands{$pre_class}
and !($preformatted_code_commands{$class}
@@ -3611,12 +3623,17 @@
if (defined($titlepage_text));
if ($self->{'structuring'} and $self->{'structuring'}->{'sectioning_root'}) {
if ($self->get_conf('setcontentsaftertitlepage')) {
- $result .= $self->_contents_inline_element('contents', undef);
- $result .= $self->get_conf('DEFAULT_RULE')."\n";
+ my $contents_text = $self->_contents_inline_element('contents', undef);
+ if ($contents_text ne '') {
+ $result .= $contents_text . $self->get_conf('DEFAULT_RULE')."\n";
+ }
}
if ($self->get_conf('setshortcontentsaftertitlepage')) {
- $result .= $self->_contents_inline_element('shortcontents', undef);
- $result .= $self->get_conf('DEFAULT_RULE')."\n";
+ my $shortcontents_text
+ = $self->_contents_inline_element('shortcontents', undef);
+ if ($shortcontents_text ne '') {
+ $result .= $shortcontents_text . $self->get_conf('DEFAULT_RULE')."\n";
+ }
}
}
return $result;
@@ -4180,12 +4197,14 @@
}
my $nr=1;
my $target = $target_base;
+ if ($target ne '') {
while ($self->{'ids'}->{$target}) {
$target = $target_base.'-'.$nr;
$nr++;
# Avoid integer overflow
die if ($nr == 0);
}
+ }
my $id = $target;
if ($command->{'extra'}->{'associated_node'}
@@ -4208,6 +4227,7 @@
#} else {
# $target_base_contents = $target_base;
#}
+ if ($id ne '') {
$target_contents = 'toc-'.$id;
my $target_base_contents = $target_base;
my $toc_nr = $nr -1;
@@ -4238,6 +4258,7 @@
# Avoid integer overflow
die if ($stoc_nr == 0);
}
+ }
$id_shortcontents = $target_shortcontents;
}
@@ -4670,11 +4691,14 @@
my $self = shift;
if ($self->{'structuring'} and $self->{'structuring'}->{'sectioning_root'}) {
- foreach my $cmdname('contents', 'shortcontents') {
+ foreach my $cmdname ('contents', 'shortcontents') {
my $type = $contents_command_element_name{$cmdname};
if ($self->get_conf($cmdname)) {
my $default_filename;
- if ($self->get_conf('INLINE_CONTENTS')) {
+ if ($self->get_conf('set'.$cmdname.'aftertitlepage')
+ and $self->get_conf('USE_TITLEPAGE_FOR_TITLE')) {
+ $default_filename = $self->{'pages'}->[0]->{'filename'};
+ } elsif ($self->get_conf('INLINE_CONTENTS')) {
if ($self->{'extra'} and $self->{'extra'}->{$cmdname}) {
foreach my $command(@{$self->{'extra'}->{$cmdname}}) {
my ($page, $element, $root_command)
@@ -4685,9 +4709,6 @@
}
}
}
- } elsif ($self->get_conf('set'.$cmdname.'aftertitlepage')
- and $self->get_conf('USE_TITLEPAGE_FOR_TITLE')) {
- $default_filename = $self->{'pages'}->[0]->{'filename'};
}
if (defined($default_filename)) {
my $element = {'type' => 'element',
@@ -5079,13 +5100,16 @@
my $result = '';
$result .= $self->attribute_class('div', $cmdname).">\n";
+ if (@{$section_root->{'section_childs'}} > 1
+ or $section_root->{'section_childs'}->[0]->{'cmdname'} ne 'top') {
+ $result .= $self->attribute_class('ul', $ul_class) .">\n";
+ }
foreach my $top_section (@{$section_root->{'section_childs'}}) {
my $section = $top_section;
SECTION:
- while ($section) {# and $section ne $section_root) {
+ while ($section) {
if ($section->{'cmdname'} ne 'top') {
my $text = $self->command_text($section);
- # FIXME OVERVIEW_LINK_TO_TOC?
my $href;
if (!$contents and $self->get_conf('OVERVIEW_LINK_TO_TOC')) {
$href = $self->command_contents_href($section, 'contents',
$filename);
@@ -5120,7 +5144,7 @@
if ($contents);
$result .= $self->attribute_class('ul', $ul_class) .">\n";
$section = $section->{'section_childs'}->[0];
- } elsif ($section->{'section_next'}) {
+ } elsif ($section->{'section_next'} and $section->{'cmdname'} ne 'top') {
$result .= "</li>\n";
last if ($section eq $top_section);
$section = $section->{'section_next'};
@@ -5139,8 +5163,12 @@
}
}
}
- $result .= "\n</div>\n";
}
+ if (@{$section_root->{'section_childs'}} > 1
+ or $section_root->{'section_childs'}->[0]->{'cmdname'} ne 'top') {
+ $result .= "\n</ul>";
+ }
+ $result .= "\n</div>\n";
return $result;
}
Index: t/30sectioning.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/30sectioning.t,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- t/30sectioning.t 9 Jul 2011 06:35:39 -0000 1.42
+++ t/30sectioning.t 20 Jul 2011 14:21:51 -0000 1.43
@@ -304,6 +304,10 @@
['section_in_unnumbered_plaintext',
$section_in_unnumbered_text
],
+['two_unnumbered_no_argument',
+'@unnumbered
address@hidden
+'],
);
my @tests_info = (
Index: t/results/sectioning/two_unnumbered_no_argument.pl
===================================================================
RCS file: t/results/sectioning/two_unnumbered_no_argument.pl
diff -N t/results/sectioning/two_unnumbered_no_argument.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ t/results/sectioning/two_unnumbered_no_argument.pl 20 Jul 2011 14:21:51
-0000 1.1
@@ -0,0 +1,150 @@
+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);
+
+use utf8;
+
+$result_trees{'two_unnumbered_no_argument'} = {
+ 'contents' => [
+ {
+ 'contents' => [],
+ 'parent' => {},
+ 'type' => 'text_root'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'unnumbered',
+ 'contents' => [],
+ 'extra' => {
+ 'missing_argument' => 1
+ },
+ 'level' => 1,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'extra' => {
+ 'command' => {}
+ },
+ 'parent' => {},
+ 'text' => '
+',
+ 'type' => 'empty_line_after_command'
+ }
+ ],
+ 'parent' => {},
+ 'type' => 'misc_line_arg'
+ }
+ ],
+ 'cmdname' => 'unnumbered',
+ 'contents' => [],
+ 'extra' => {
+ 'missing_argument' => 1
+ },
+ 'level' => 1,
+ 'line_nr' => {
+ 'file_name' => '',
+ 'line_nr' => 2,
+ 'macro' => ''
+ },
+ 'parent' => {}
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[0]{'parent'} =
$result_trees{'two_unnumbered_no_argument'};
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
= $result_trees{'two_unnumbered_no_argument'}{'contents'}[1];
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'two_unnumbered_no_argument'}{'contents'}[1]{'args'}[0];
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[1]{'args'}[0]{'parent'}
= $result_trees{'two_unnumbered_no_argument'}{'contents'}[1];
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[1]{'parent'} =
$result_trees{'two_unnumbered_no_argument'};
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
= $result_trees{'two_unnumbered_no_argument'}{'contents'}[2];
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'two_unnumbered_no_argument'}{'contents'}[2]{'args'}[0];
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[2]{'args'}[0]{'parent'}
= $result_trees{'two_unnumbered_no_argument'}{'contents'}[2];
+$result_trees{'two_unnumbered_no_argument'}{'contents'}[2]{'parent'} =
$result_trees{'two_unnumbered_no_argument'};
+
+$result_texis{'two_unnumbered_no_argument'} = '@unnumbered
address@hidden
+';
+
+
+$result_texts{'two_unnumbered_no_argument'} = '';
+
+$result_sectioning{'two_unnumbered_no_argument'} = {
+ 'level' => 0,
+ 'section_childs' => [
+ {
+ 'cmdname' => 'unnumbered',
+ 'extra' => {
+ 'missing_argument' => 1
+ },
+ 'level' => 1,
+ 'section_up' => {}
+ },
+ {
+ 'cmdname' => 'unnumbered',
+ 'extra' => {
+ 'missing_argument' => 1
+ },
+ 'level' => 1,
+ 'section_prev' => {},
+ 'section_up' => {},
+ 'toplevel_prev' => {}
+ }
+ ]
+};
+$result_sectioning{'two_unnumbered_no_argument'}{'section_childs'}[0]{'section_up'}
= $result_sectioning{'two_unnumbered_no_argument'};
+$result_sectioning{'two_unnumbered_no_argument'}{'section_childs'}[1]{'section_prev'}
= $result_sectioning{'two_unnumbered_no_argument'}{'section_childs'}[0];
+$result_sectioning{'two_unnumbered_no_argument'}{'section_childs'}[1]{'section_up'}
= $result_sectioning{'two_unnumbered_no_argument'};
+$result_sectioning{'two_unnumbered_no_argument'}{'section_childs'}[1]{'toplevel_prev'}
= $result_sectioning{'two_unnumbered_no_argument'}{'section_childs'}[0];
+
+$result_errors{'two_unnumbered_no_argument'} = [
+ {
+ 'error_line' => ':1: @unnumbered missing argument
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@unnumbered missing argument',
+ 'type' => 'error'
+ },
+ {
+ 'error_line' => ':2: @unnumbered missing argument
+',
+ 'file_name' => '',
+ 'line_nr' => 2,
+ 'macro' => '',
+ 'text' => '@unnumbered missing argument',
+ 'type' => 'error'
+ }
+];
+
+
+
+$result_converted{'plaintext'}->{'two_unnumbered_no_argument'} = '';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp TODO Texinfo/Convert/HTML.pm t/30sec...,
Patrice Dumas <=