[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...
From: |
Patrice Dumas |
Subject: |
texinfo/tp texi2any.pl Texinfo/Common.pm Texinf... |
Date: |
Mon, 10 Oct 2011 21:08:45 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/10/10 21:08:45
Modified files:
tp : texi2any.pl
tp/Texinfo : Common.pm Parser.pm
tp/Texinfo/Convert: HTML.pm
tp/init : book.pm chm.pm html32.pm
Log message:
Register formatting commands through a function.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.68&r2=1.69
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.310&r2=1.311
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.178&r2=1.179
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/book.pm?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/chm.pm?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/init/html32.pm?cvsroot=texinfo&r1=1.1&r2=1.2
Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- texi2any.pl 10 Oct 2011 00:07:54 -0000 1.68
+++ texi2any.pl 10 Oct 2011 21:08:44 -0000 1.69
@@ -855,7 +855,8 @@
# code is ready above, but commented out.
foreach my $parser_settable_option ('TOP_NODE_UP', 'MAX_MACRO_CALL_NESTING',
'INLINE_INSERTCOPYING', 'SHOW_MENU',
- 'IGNORE_BEFORE_SETFILENAME', 'TEST') {
+ 'IGNORE_BEFORE_SETFILENAME', 'TEST',
+ 'GLOBAL_COMMANDS') {
$parser_default_options->{$parser_settable_option} =
get_conf($parser_settable_option)
if (defined(get_conf($parser_settable_option)));
}
Index: Texinfo/Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- Texinfo/Common.pm 8 Oct 2011 09:59:19 -0000 1.73
+++ Texinfo/Common.pm 10 Oct 2011 21:08:44 -0000 1.74
@@ -149,7 +149,7 @@
'DEFAULT_RULE', 'BIG_RULE',
'MENU_ENTRY_COLON', 'INDEX_ENTRY_COLON', 'MENU_SYMBOL', 'DO_ABOUT',
'CSS_FILES', 'CSS_REFS', 'BEFORE_OVERVIEW', 'AFTER_OVERVIEW',
- 'BEFORE_TOC_LINES', 'AFTER_TOC_LINES');
+ 'BEFORE_TOC_LINES', 'AFTER_TOC_LINES', 'GLOBAL_COMMANDS');
my %valid_options;
foreach my $var (@document_settable_at_commands, @document_global_at_commands,
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.310
retrieving revision 1.311
diff -u -b -r1.310 -r1.311
--- Texinfo/Parser.pm 29 Sep 2011 23:24:42 -0000 1.310
+++ Texinfo/Parser.pm 10 Oct 2011 21:08:44 -0000 1.311
@@ -147,8 +147,9 @@
'ENABLE_ENCODING' => 1, # corresponds to --enable-encoding.
'MAX_MACRO_CALL_NESTING' => 100000, # max number of nested macro calls
'TOP_NODE_UP' => '(dir)', # up node of Top node
- 'SIMPLE_MENU' => 0 # currently not used in the parser for now,
+ 'SIMPLE_MENU' => 0, # currently not used in the parser for now,
# but relevant for structuring
+ 'GLOBAL_COMMANDS' => [], # list of commands registered
);
# The commands in initialization_overrides are not set in the document if
Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -b -r1.178 -r1.179
--- Texinfo/Convert/HTML.pm 10 Oct 2011 00:07:54 -0000 1.178
+++ Texinfo/Convert/HTML.pm 10 Oct 2011 21:08:44 -0000 1.179
@@ -579,11 +579,10 @@
{
my $self = shift;
my $format = shift;
- return $self->{'default_formatting_functions'}->{'format_'.$format};
+ return $self->{'default_formatting_functions'}->{$format};
}
# see http://www.w3.org/TR/REC-html40/types.html#type-links
-# see http://www.w3.org/TR/REC-html40/types.html#type-links
my %BUTTONS_REL =
(
'Top', 'start',
@@ -4140,6 +4139,27 @@
};
}
+my %default_formatting_references = (
+ 'heading_text' => \&_default_heading_text,
+ 'comment' => \&_default_comment,
+ 'protect_text' => \&_default_protect_text,
+ 'css_lines' => \&_default_css_lines,
+ 'begin_file' => \&_default_begin_file,
+ 'node_redirection_page' => \&_default_node_redirection_page,
+ 'end_file' => \&_default_end_file,
+ 'special_element_body' => \&_default_special_element_body,
+ 'footnotes_text' => \&_default_footnotes_text,
+ 'program_string' => \&_default_program_string,
+ 'titlepage' => \&_default_titlepage,
+ 'navigation_header' => \&_default_navigation_header,
+ 'navigation_header_panel' => \&_default_navigation_header_panel,
+ 'element_header' => \&_default_element_header,
+ 'button' => \&_default_button_formatting,
+ 'button_icon_img' => \&_default_button_icon_img,
+ 'external_href' => \&_default_external_href,
+ 'contents' => \&_default_contents,
+);
+
sub _use_entity_is_entity($$)
{
my $self = shift;
@@ -4268,42 +4288,15 @@
}
}
- foreach my $formatting_references (
- ['format_heading_text', \&_default_heading_text,
$Texinfo::Config::heading_text],
- ['format_comment', \&_default_comment, $Texinfo::Config::comment],
- ['format_protect_text', \&_default_protect_text,
$Texinfo::Config::protect_text],
- ['format_css_lines', \&_default_css_lines, $Texinfo::Config::css_lines],
- ['format_begin_file', \&_default_begin_file,
$Texinfo::Config::begin_file],
- ['format_node_redirection_page', \&_default_node_redirection_page,
- $Texinfo::Config::node_redirection_page],
- ['format_end_file', \&_default_end_file, $Texinfo::Config::end_file],
- ['format_special_element_body', \&_default_special_element_body,
- $Texinfo::Config::special_element_body],
- ['format_footnotes_text', \&_default_footnotes_text,
- $Texinfo::Config::footnotes_text],
- ['format_program_string', \&_default_program_string,
- $Texinfo::Config::program_string],
- ['format_titlepage', \&_default_titlepage, $Texinfo::Config::titlepage],
- ['format_navigation_header', \&_default_navigation_header,
- $Texinfo::Config::navigation_header],
- ['format_navigation_header_panel', \&_default_navigation_header_panel,
- $Texinfo::Config::navigation_header_panel],
- ['format_element_header', \&_default_element_header,
- $Texinfo::Config::element_header],
- ['format_button', \&_default_button_formatting,
- $Texinfo::Config::button_formatting],
- ['format_button_icon_img', \&_default_button_icon_img,
- $Texinfo::Config::button_icon_img],
- ['format_external_href', \&_default_external_href,
- $Texinfo::Config::external_href],
- ['format_contents', \&_default_contents, $Texinfo::Config::contents],
- ) {
- $self->{'default_formatting_functions'}->{$formatting_references->[0]}
- = $formatting_references->[1];
- if (defined($formatting_references->[2])) {
- $self->{$formatting_references->[0]} = $formatting_references->[2];
+ foreach my $formatting_reference (keys(%default_formatting_references)) {
+ $self->{'default_formatting_functions'}->{$formatting_reference}
+ = $default_formatting_references{$formatting_reference};
+ if
(defined($Texinfo::Config::texinfo_formatting_references{$formatting_reference}))
{
+ $self->{"format_".$formatting_reference}
+ =
$Texinfo::Config::texinfo_formatting_references{$formatting_reference};
} else {
- $self->{$formatting_references->[0]} = $formatting_references->[1];
+ $self->{"format_".$formatting_reference}
+ = $default_formatting_references{$formatting_reference};
}
}
if ($Texinfo::Config::renamed_nodes) {
@@ -6043,7 +6036,7 @@
{
package Texinfo::Config;
-use vars qw(%texinfo_default_stage_handlers);
+use vars qw(%texinfo_default_stage_handlers %texinfo_formatting_references);
sub texinfo_register_handler($$;$)
{
@@ -6060,6 +6053,17 @@
return 1;
}
+sub texinfo_register_formatting_function($$)
+{
+ my $type = shift;
+ my $handler = shift;
+ if (!$default_formatting_references{$type}) {
+ carp ("Unknown formatting type $type\n");
+ return 0;
+ }
+ $texinfo_formatting_references{$type} = $handler;
+}
+
}
sub output($$)
Index: init/book.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/book.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- init/book.pm 10 Oct 2011 00:07:54 -0000 1.2
+++ init/book.pm 10 Oct 2011 21:08:44 -0000 1.3
@@ -10,7 +10,7 @@
use strict;
-use vars qw(%commands_conversion $navigation_header $element_file_name);
+use vars qw(%commands_conversion $element_file_name);
set_from_init_file('contents', 1);
set_from_init_file('INLINE_CONTENTS', 1);
@@ -115,7 +115,8 @@
}
}
-$navigation_header = \&book_navigation_header;
+texinfo_register_formatting_function('navigation_header',
+ \&book_navigation_header);
sub book_print_sub_toc($$$);
Index: init/chm.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/chm.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- init/chm.pm 10 Oct 2011 18:02:00 -0000 1.2
+++ init/chm.pm 10 Oct 2011 21:08:45 -0000 1.3
@@ -46,12 +46,10 @@
set_from_init_file('USE_NODES', 0);
#set_from_init_file('USE_SECTIONS', 1);
-use vars qw(%commands_formatting $end_file $navigation_header
- $navigation_header_panel);
-$end_file = \&chm_end_file;
-# no-ops to avoid headers and footers
-$navigation_header = \&chm_noop;
-$navigation_header_panel = \&chm_noop;
+use vars qw(%commands_formatting);
+texinfo_register_formatting_function('end_file', \&chm_end_file);
+texinfo_register_formatting_function('navigation_header', \&chm_noop);
+texinfo_register_formatting_function('navigation_header_panel', \&chm_noop);
my %chm_languages = (
'en' => '0x409 English (United States)',
Index: init/html32.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/init/html32.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- init/html32.pm 8 Oct 2011 20:04:46 -0000 1.1
+++ init/html32.pm 10 Oct 2011 21:08:45 -0000 1.2
@@ -25,7 +25,7 @@
use strict;
use Texinfo::Convert::Converter qw(xml_protect_text);
-use vars qw(%commands_formatting %style_commands_formatting $protect_text
+use vars qw(%commands_formatting %style_commands_formatting
%commands_conversion %types_conversion);
set_from_init_file('COMPLEX_FORMAT_IN_TABLE', 1);
@@ -93,7 +93,7 @@
return $text;
}
-$protect_text = \&html32_protect_text;
+texinfo_register_formatting_function('protect_text', \&html32_protect_text);
sub html32_convert_text($$$$)
{
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf..., Patrice Dumas, 2011/10/02
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf..., Patrice Dumas, 2011/10/08
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf...,
Patrice Dumas <=
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf..., Patrice Dumas, 2011/10/11
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf..., Patrice Dumas, 2011/10/21
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf..., Patrice Dumas, 2011/10/29
- texinfo/tp texi2any.pl Texinfo/Common.pm Texinf..., Patrice Dumas, 2011/10/30