[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texi2html-cvs] texi2html examples/info.init examples/makeinfo....
From: |
Patrice Dumas |
Subject: |
[Texi2html-cvs] texi2html examples/info.init examples/makeinfo.... |
Date: |
Fri, 09 Jan 2009 00:14:50 +0000 |
CVSROOT: /cvsroot/texi2html
Module name: texi2html
Changes by: Patrice Dumas <pertusus> 09/01/09 00:14:50
Modified files:
examples : info.init makeinfo.init
test/layout/res/formatting_makeinfo: chapter.html index.html
test/sectionning/res/two_footnotes_in_nodes: chapter.html
index.html
Log message:
Correct makeinfo.init such that the footnotes formatting function is
really
used.
Handle footnotes in info.init.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texi2html/examples/info.init?cvsroot=texi2html&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texi2html/examples/makeinfo.init?cvsroot=texi2html&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/texi2html/test/layout/res/formatting_makeinfo/chapter.html?cvsroot=texi2html&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/texi2html/test/layout/res/formatting_makeinfo/index.html?cvsroot=texi2html&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texi2html/test/sectionning/res/two_footnotes_in_nodes/chapter.html?cvsroot=texi2html&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texi2html/test/sectionning/res/two_footnotes_in_nodes/index.html?cvsroot=texi2html&r1=1.4&r2=1.5
Patches:
Index: examples/info.init
===================================================================
RCS file: /cvsroot/texi2html/texi2html/examples/info.init,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- examples/info.init 8 Jan 2009 12:42:34 -0000 1.14
+++ examples/info.init 9 Jan 2009 00:14:48 -0000 1.15
@@ -159,6 +159,7 @@
$print_page_head = \&info_default_print_page_head;
$toc_body = \&info_default_noop;
$about_body = \&info_default_noop;
+$print_Footnotes = \&info_default_noop;
$copying_comment = \&info_default_copying_comment;
$element_heading = \&info_default_element_heading;
$heading = \&info_default_heading;
@@ -169,6 +170,7 @@
# maybe should not be called from the main program?
$print_page_foot = \&info_default_print_page_foot;
$print_Top_footer = \&info_default_print_Top_footer;
+$print_Top = \&info_default_print_section;
$print_section = \&info_default_print_section;
$end_section = \&info_default_end_section;
$one_section = \&info_default_one_section;
@@ -196,7 +198,8 @@
$index_letter = \&info_default_index_letter;
$print_index = \&info_default_print_index;
$index_entry_label = \&info_default_index_entry_label;
-
+$foot_section = \&info_default_foot_lines;
+$foot_line_and_ref = \&info_default_foot_line_and_ref;
sub info_default_accent($$$)
@@ -970,8 +973,6 @@
print $fh $result;
}
-my $info_default_paragraph_in_element_nr;
-
sub info_default_paragraph($$$$$$$$$$$$)
{
my $text = shift;
@@ -990,8 +991,10 @@
my $top_stack = '';
$top_stack = $command_stack_at_begin->[-1] if (scalar
(@$command_stack_at_begin));
- $info_default_paragraph_in_element_nr++;
- return info_default_close_command(undef, undef, 'paragraph', undef, undef,
undef, '', undef, "\n", {'paragraph_in_element_nr' =>
($info_default_paragraph_in_element_nr -1), 'top_stack' => $top_stack});
+ my $state = $Texi2HTML::THISDOC{'state'};
+ my $info_state = info_default_get_state ($state);
+ $info_state->{'paragraph_in_element_nr'}++;
+ return info_default_close_command(undef, undef, 'paragraph', undef, undef,
undef, '', undef, "\n", {'paragraph_in_element_nr' =>
($info_state->{'paragraph_in_element_nr'} -1), 'top_stack' => $top_stack});
}
sub info_default_preformatted($$$$$$$$$$$$)
@@ -1015,7 +1018,9 @@
# }
#Â a paragraph after a preformatted is indented. So looks like
#Â preformatted count as paragraphs.
- $info_default_paragraph_in_element_nr++;
+ my $state = $Texi2HTML::THISDOC{'state'};
+ my $info_state = info_default_get_state ($state);
+ $info_state->{'paragraph_in_element_nr'}++;
return info_default_close_command(undef, undef, 'preformatted', undef,
undef, undef, undef, undef, undef);
}
@@ -1028,6 +1033,28 @@
4 => '.'
);
+sub info_default_node_line($)
+{
+ my $element = shift;
+ my $result = "\x{1F}\nFile: $element->{'file'}, Node: $element->{'text'}";
+ if (defined($element->{'NodeNext'}))
+ {
+ $result .= ','.&$I(' Next: %{node_next}', {'node_next' =>
$element->{'NodeNext'}->{'text'}});
+ }
+ if (defined($element->{'NodePrev'}))
+ {
+ $result .= ','.&$I(' Prev: %{node_prev}', {'node_prev' =>
$element->{'NodePrev'}->{'text'}});
+ }
+ if (defined($element->{'NodeUp'}))
+ {
+ $result .= ','.&$I(' Up: %{node_up}', {'node_up' =>
$element->{'NodeUp'}->{'text'}});
+ }
+ $result .= "\n\n";
+ return $result;
+}
+
+my $info_default_footnote_index;
+my $info_default_current_node;
sub info_default_element_heading($$$$$$$$$$$$)
{
my $element = shift;
@@ -1046,6 +1073,9 @@
my $state = $Texi2HTML::THISDOC{'state'};
my $info_state = info_default_get_state ($state);
+
+ #Â FIXME use $element or $Texi2HTML::THIS_ELEMENT? Main program should
+ #Â ensure they are the same.
if ($new_element and ($element ne $new_element or !$element->{'node'}))
{
die "There is a new element, but element $element->{'texi'} is not a
node or not the new element\n";
@@ -1054,31 +1084,23 @@
print STDERR "HHHHHHHHHHHHHHH node $info_state->{'nr'}\n";
my $before = '';
- if ($info_state->{'waiting_for_line'})
- {
- $before = "\n";
- $info_default_offset_in_file += length($before);
- $info_default_line_count++;
- $info_state->{'waiting_for_line'} = 0;
- }
+# if ($info_state->{'waiting_for_line'})
+# {
+# $before = "\n";
+# $info_default_offset_in_file += length($before);
+# $info_default_line_count++;
+# $info_state->{'waiting_for_line'} = 0;
+# }
$element->{'info_offset'} = $info_default_offset_in_file;
push @info_default_pending_tags, $element;
- my $result = "\x{1F}\nFile: $Texi2HTML::THIS_ELEMENT->{'file'}, Node:
$element->{'text'}";
- if (defined($Texi2HTML::THIS_ELEMENT->{'NodeNext'}))
- {
- $result .= ','.&$I(' Next: %{node_next}', {'node_next' =>
$Texi2HTML::THIS_ELEMENT->{'NodeNext'}->{'text'}});
- }
- if (defined($Texi2HTML::THIS_ELEMENT->{'NodePrev'}))
- {
- $result .= ','.&$I(' Prev: %{node_prev}', {'node_prev' =>
$Texi2HTML::THIS_ELEMENT->{'NodePrev'}->{'text'}});
- }
- if (defined($Texi2HTML::THIS_ELEMENT->{'NodeUp'}))
- {
- $result .= ','.&$I(' Up: %{node_up}', {'node_up' =>
$Texi2HTML::THIS_ELEMENT->{'NodeUp'}->{'text'}});
- }
- $result .= "\n\n";
+
+ my $result = info_default_node_line($element);
+
$info_default_line_count = 3;
$info_default_offset_in_file += length($result);
+ $info_default_footnote_index = 0;
+ #$info_default_current_node = $Texi2HTML::THIS_ELEMENT;
+ $info_default_current_node = $element;
return $before.$result;
}
@@ -1097,7 +1119,7 @@
my $state = $Texi2HTML::THISDOC{'state'};
my $info_state = info_default_get_state ($state);
print STDERR "HHHHHHHHHHHHHHH section $info_state->{'nr'}\n";
- $info_default_paragraph_in_element_nr = 0;
+ $info_state->{'paragraph_in_element_nr'} = 0;
my $text = "$element->{'text'}";
#Â to do the same than makeinfo a trailing dot in section number is removed
$text =~ s/^(\w+)\. /$1 /;
@@ -1239,6 +1261,7 @@
}
}
+my @info_default_pending_footnotes;
sub info_default_print_section
{
my $fh = shift;
@@ -1246,6 +1269,60 @@
my $previous_is_top = shift;
my $element = shift;
my $nw = main::print_lines($fh);
+ my $state = $Texi2HTML::THISDOC{'state'};
+ my $info_state = info_default_get_state ($state);
+ if ($info_state->{'waiting_for_line'})
+ {
+ my $end = "\n";
+ $info_default_offset_in_file += length($end);
+ $info_default_line_count++;
+ $info_state->{'waiting_for_line'} = 0;
+ }
+ if (@info_default_pending_footnotes)
+ {
+ my $footnote_text;
+ if ($SEPARATED_FOOTNOTES)
+ {
+ my $node_ref = $info_default_current_node;
+ $node_ref = {'text' => 'no node', 'file' => ''} if
(!defined($node_ref));
+ my $footnote_element = { 'NodeUp' => $node_ref,
+ 'text' => $node_ref->{'text'} . "-Footnotes",
+ 'file' => $node_ref->{'file'},
+ 'info_offset' => $info_default_offset_in_file,
+ 'node' => 1
+ };
+ push @info_default_pending_tags, $footnote_element;
+ $footnote_text = info_default_node_line($footnote_element);
+ $info_default_offset_in_file += length($footnote_text);
+ }
+ else
+ {
+ $footnote_text = " ---------- Footnotes ----------\n\n";
+ $info_default_offset_in_file += length($footnote_text);
+ }
+ while (@info_default_pending_footnotes)
+ {
+ #push @info_default_pending_footnotes, [$lines, $footnote_text,
${info_default_footnote_index}, $node_name];
+ my $footnote = shift @info_default_pending_footnotes;
+ my $foot_nr = $footnote->[2];
+ my $node_name = $footnote->[3];
+ my $lines = $footnote->[0];
+ push @info_default_pending_tags, {'anchor' => 1, 'text' =>
"${node_name}-Footnote-${foot_nr}", 'info_offset' =>
$info_default_offset_in_file };
+ my $footnote_result = shift @{$lines};
+ $footnote_result =~ s/^\s*//;
+ $footnote_result = " ($foot_nr) " . $footnote_result;
+ while (@$lines)
+ {
+ my $line = shift @$lines;
+ $footnote_result .= $line;
+ }
+ $footnote_result .= "\n";
+ $info_default_offset_in_file += length($footnote_result);
+ $footnote_text .= $footnote_result;
+ }
+ print $fh "$footnote_text";
+ }
+ #print $fh "AGAGA $info_default_current_node->{'text'} $info_state->{'nr'}
\n";
}
sub info_default_end_section($$$)
@@ -1268,9 +1345,10 @@
my $region = shift;
my $state = shift;
my $lines = shift;
+ my $info_state = info_default_get_state ($state);
if ($state->{'outside_document'})
{
- $info_default_paragraph_in_element_nr = 0;
+ $info_state->{'paragraph_in_element_nr'} = 0;
}
}
@@ -1637,5 +1715,37 @@
return '';
}
+sub info_default_foot_line_and_ref($$$$$$$$)
+{
+ my $foot_num = shift;
+ my $relative_num = shift;
+ my $footid = shift;
+ my $docid = shift;
+ my $from_file = shift;
+ my $footnote_file = shift;
+ my $lines = shift;
+ my $state = shift;
+
+ $info_default_footnote_index++;
+ my $footnote_text = "($info_default_footnote_index)";
+ my $node_name;
+ $node_name = '';
+ $node_name = $info_default_current_node->{'text'} if
defined($info_default_current_node);
+ if ($SEPARATED_FOOTNOTES)
+ {
+ $footnote_text .= ' (' . info_default_normal_reference('pxref',
["${node_name}-Footnote-${info_default_footnote_index}"]) . ')';
+ }
+ push @info_default_pending_footnotes, [$lines, $footnote_text,
${info_default_footnote_index}, $node_name];
+ return ($lines, $footnote_text);
+}
+
+sub info_default_foot_lines($)
+{
+ my $lines = shift;
+ #my $state = $Texi2HTML::THISDOC{'state'};
+ #my $info_state = info_default_get_state ($state);
+ @$lines = ();
+}
+
1;
Index: examples/makeinfo.init
===================================================================
RCS file: /cvsroot/texi2html/texi2html/examples/makeinfo.init,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- examples/makeinfo.init 8 Nov 2008 20:02:51 -0000 1.25
+++ examples/makeinfo.init 9 Jan 2009 00:14:48 -0000 1.26
@@ -99,7 +99,7 @@
@MISC_BUTTONS = @SECTION_BUTTONS;
$foot_line_and_ref = \&makeinfo_like_foot_line_and_ref;
-$foot_lines = \&makeinfo_like_foot_lines;
+$foot_section = \&makeinfo_like_foot_lines;
$paragraph = \&makeinfo_like_paragraph;
$index_summary = \&makeinfo_like_index_summary;
$summary_letter = \&makeinfo_like_summary_letter;
@@ -146,9 +146,10 @@
sub makeinfo_like_foot_lines($)
{
my $lines = shift;
- unshift @$lines,
"<hr>\n<h4>$Texi2HTML::I18n::WORDS->{'Footnotes_Title'}</h4>\n";
+ unshift @$lines, "<div class=\"footnote\">\n<hr>\n<h4>". &$I('Footnotes')
."</h4>\n";
#<ol type=\"1\">\n";
# push @$lines, "</ol>";
+ push (@$lines, "</div>\n");
return $lines;
}
Index: test/layout/res/formatting_makeinfo/chapter.html
===================================================================
RCS file:
/cvsroot/texi2html/texi2html/test/layout/res/formatting_makeinfo/chapter.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- test/layout/res/formatting_makeinfo/chapter.html 8 Jan 2009 00:21:39
-0000 1.9
+++ test/layout/res/formatting_makeinfo/chapter.html 9 Jan 2009 00:14:49
-0000 1.10
@@ -719,7 +719,7 @@
<div class="footnote">
<hr>
-<h3>Footnotes</h3>
+<h4>Footnotes</h4>
<p class="footnote"><small>[<a name="FOOT5" href="#DOCF5">1</a>]</small> in
footnote
</p></div>
<hr size="1">
Index: test/layout/res/formatting_makeinfo/index.html
===================================================================
RCS file:
/cvsroot/texi2html/texi2html/test/layout/res/formatting_makeinfo/index.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- test/layout/res/formatting_makeinfo/index.html 8 Jan 2009 00:21:40
-0000 1.12
+++ test/layout/res/formatting_makeinfo/index.html 9 Jan 2009 00:14:49
-0000 1.13
@@ -3019,7 +3019,7 @@
<div class="footnote">
<hr>
-<h3>Footnotes</h3>
+<h4>Footnotes</h4>
<p class="footnote"><small>[<a name="t_hcopying_FOOT1"
href="#t_hcopying_DOCF1">1</a>]</small> in footnote
</p><p class="footnote"><small>[<a name="t_hcopying_FOOT2"
href="#t_hcopying_DOCF2">2</a>]</small> in footnote2
</p><p class="footnote"><small>[<a name="FOOT1" href="#DOCF1">1</a>]</small>
in footnote
Index: test/sectionning/res/two_footnotes_in_nodes/chapter.html
===================================================================
RCS file:
/cvsroot/texi2html/texi2html/test/sectionning/res/two_footnotes_in_nodes/chapter.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- test/sectionning/res/two_footnotes_in_nodes/chapter.html 1 Nov 2008
18:28:34 -0000 1.4
+++ test/sectionning/res/two_footnotes_in_nodes/chapter.html 9 Jan 2009
00:14:49 -0000 1.5
@@ -66,7 +66,7 @@
</p>
<div class="footnote">
<hr>
-<h3>Footnotes</h3>
+<h4>Footnotes</h4>
<p class="footnote"><small>[<a name="FOOT3" href="#DOCF3">1</a>]</small>
Footnote chapter/1
</p>
<p>para2
Index: test/sectionning/res/two_footnotes_in_nodes/index.html
===================================================================
RCS file:
/cvsroot/texi2html/texi2html/test/sectionning/res/two_footnotes_in_nodes/index.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- test/sectionning/res/two_footnotes_in_nodes/index.html 1 Nov 2008
18:28:34 -0000 1.4
+++ test/sectionning/res/two_footnotes_in_nodes/index.html 9 Jan 2009
00:14:50 -0000 1.5
@@ -70,7 +70,7 @@
<div class="footnote">
<hr>
-<h3>Footnotes</h3>
+<h4>Footnotes</h4>
<p class="footnote"><small>[<a name="FOOT1" href="#DOCF1">1</a>]</small>
Footnote Top/1
</p>
<p>para2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Texi2html-cvs] texi2html examples/info.init examples/makeinfo....,
Patrice Dumas <=