447 |
$toc_body = \&T2H_GPL_toc_body; |
$toc_body = \&T2H_GPL_toc_body; |
448 |
$style = \&T2H_GPL_style; |
$style = \&T2H_GPL_style; |
449 |
$format = \&T2H_GPL_format; |
$format = \&T2H_GPL_format; |
450 |
$normal_text = \&t2h_gpl_normal_text; |
#$normal_text = \&t2h_gpl_normal_text; |
451 |
|
|
452 |
sub T2H_GPL_toc_body($) |
sub T2H_GPL_toc_body($) |
453 |
{ |
{ |
622 |
return "<${element}$attribute_text>\n" . $text. "</$element>\n"; |
return "<${element}$attribute_text>\n" . $text. "</$element>\n"; |
623 |
} |
} |
624 |
|
|
625 |
sub t2h_gpl_normal_text($) |
#sub t2h_gpl_normal_text($) |
626 |
{ |
#{ |
627 |
my $text = shift; |
# my $text = shift; |
628 |
$text =~ s/``/"/go; |
# $text =~ s/``/"/go; |
629 |
$text =~ s/''/"/go; |
# $text =~ s/''/"/go; |
630 |
$text =~ s/-(--?)/$1/go; |
# $text =~ s/-(--?)/$1/go; |
631 |
return $text; |
# return $text; |
632 |
} |
#} |
633 |
# @INIT@ |
# @INIT@ |
634 |
|
|
635 |
require "$ENV{T2H_HOME}/texi2html.init" |
require "$ENV{T2H_HOME}/texi2html.init" |
1069 |
foreach my $simple_format (keys(%Texi2HTML::Config::format_map)) |
foreach my $simple_format (keys(%Texi2HTML::Config::format_map)) |
1070 |
{ |
{ |
1071 |
$format_type{$simple_format} = 'simple'; |
$format_type{$simple_format} = 'simple'; |
|
$no_line_macros{$simple_format} = 1; |
|
|
$no_line_macros{"end $simple_format"} = 1; |
|
1072 |
} |
} |
1073 |
foreach my $paragraph_style (keys(%Texi2HTML::Config::paragraph_style)) |
foreach my $paragraph_style (keys(%Texi2HTML::Config::paragraph_style)) |
1074 |
{ |
{ |
1075 |
$format_type{$paragraph_style} = 'paragraph_style'; |
$format_type{$paragraph_style} = 'paragraph_style'; |
|
$no_line_macros{$paragraph_style} = 1; |
|
|
$no_line_macros{"end $paragraph_style"} = 1; |
|
1076 |
} |
} |
1077 |
foreach my $complex_format (keys(%$Texi2HTML::Config::complex_format_map)) |
foreach my $complex_format (keys(%$Texi2HTML::Config::complex_format_map)) |
1078 |
{ |
{ |
1079 |
$format_type{$complex_format} = 'complex'; |
$format_type{$complex_format} = 'complex'; |
|
$no_line_macros{$complex_format} = 1; |
|
|
$no_line_macros{"end $complex_format"} = 1; |
|
1080 |
} |
} |
1081 |
foreach my $table (('table', 'ftable', 'vtable', 'multitable')) |
foreach my $table (('table', 'ftable', 'vtable', 'multitable')) |
1082 |
{ |
{ |
1083 |
$format_type{$table} = 'table'; |
$format_type{$table} = 'table'; |
|
$no_line_macros{$table} = 1; |
|
|
$no_line_macros{"end $table"} = 1; |
|
1084 |
} |
} |
1085 |
foreach my $def_format (keys(%Texi2HTML::Config::def_map)) |
foreach my $def_format (keys(%Texi2HTML::Config::def_map)) |
1086 |
{ |
{ |
1087 |
$format_type{$def_format} = 'deff'; |
$format_type{$def_format} = 'deff'; |
|
$no_line_macros{$def_format} = 1; |
|
|
$no_line_macros{"end $def_format"} = 1; |
|
1088 |
} |
} |
1089 |
$format_type{'itemize'} = 'list'; |
$format_type{'itemize'} = 'list'; |
1090 |
$format_type{'enumerate'} = 'list'; |
$format_type{'enumerate'} = 'list'; |
1099 |
|
|
1100 |
$format_type{'group'} = 'group'; |
$format_type{'group'} = 'group'; |
1101 |
|
|
1102 |
foreach my $macro (('itemize', 'enumerate', 'menu', 'cartouche', 'float', 'quotation')) |
foreach my $key (keys(%format_type)) |
1103 |
{ |
{ |
1104 |
$no_line_macros{$macro} = 1; |
$no_line_macros{$key} = 1; |
1105 |
$no_line_macros{"end $macro"} = 1; |
$no_line_macros{"end $key"} = 1; |
1106 |
} |
} |
1107 |
|
|
1108 |
foreach my $macro (keys(%Texi2HTML::Config::format_in_paragraph)) |
foreach my $macro (keys(%Texi2HTML::Config::format_in_paragraph)) |
1156 |
# raw formats which are expanded especially |
# raw formats which are expanded especially |
1157 |
my @raw_regions = ('html', 'verbatim', 'tex', 'xml', 'docbook'); |
my @raw_regions = ('html', 'verbatim', 'tex', 'xml', 'docbook'); |
1158 |
|
|
1159 |
# special raw formats which are expanded between first and second pass |
# special raw formats which are expanded between second and third pass |
1160 |
# and are replaced by specific commands. Currently used for tex. It takes |
# and are replaced by specific commands. Currently used for tex. It takes |
1161 |
# precedence over raw_regions. |
# precedence over raw_regions. |
1162 |
|
# Currently there is no integrated handling of such regions. The collecting |
1163 |
|
# of special sections is generic, they are collected by init_special during |
1164 |
|
# the second phase, so calling a user function reference should be trivial. |
1165 |
|
# then init_special would remember which @-command is associated with |
1166 |
|
# which user defined function and add a mangled @-command like |
1167 |
|
# @t2h_special_command_nr |
1168 |
|
# remark: this is not problematic, the only gotcha is that it shouldn't |
1169 |
|
# intersect with user undefined @-commands (nor with texinfo commands!). |
1170 |
|
# However the replacement is done by matching @tex_(\d+). Maybe a generic |
1171 |
|
# interface would be to have the @-commands names set by init_special |
1172 |
|
# in a hash and expand them by calling the correponding function. |
1173 |
my @special_regions = (); |
my @special_regions = (); |
1174 |
|
|
1175 |
|
# the handling of @math is ad-hoc, it should be more generic. More |
1176 |
|
# precisely this is a special command. The special commands should be |
1177 |
|
# collect by init_special and handled like special regions. |
1178 |
|
|
1179 |
|
# there should be more hooks for user defined functions, at least |
1180 |
|
# one after the first pass with all the possible information (file |
1181 |
|
# names), between the pass 2 and 3, that mark that all the special |
1182 |
|
# regions have been collected, and one after the pass 3 for cleaning. |
1183 |
|
# This is currently what is done with Latex2HTML. |
1184 |
|
|
1185 |
# regions expanded or not depending on the value of this hash |
# regions expanded or not depending on the value of this hash |
1186 |
my %text_macros = ( |
my %text_macros = ( |
1187 |
'iftex' => 0, |
'iftex' => 0, |
1356 |
} |
} |
1357 |
} |
} |
1358 |
|
|
1359 |
|
# used to manage expanded sections from the command line |
1360 |
sub set_expansion($$) |
sub set_expansion($$) |
1361 |
{ |
{ |
1362 |
my $region = shift; |
my $region = shift; |
1371 |
@Texi2HTML::Config::EXPAND = grep {$_ ne $region} @Texi2HTML::Config::EXPAND; |
@Texi2HTML::Config::EXPAND = grep {$_ ne $region} @Texi2HTML::Config::EXPAND; |
1372 |
} |
} |
1373 |
} |
} |
1374 |
|
|
1375 |
|
|
1376 |
sub set_encoding($) |
sub set_encoding($) |
1377 |
{ |
{ |
1378 |
my $encoding = shift; |
my $encoding = shift; |
4148 |
$index_properties->{$name}->{'code'} = 1 if $macro eq 'defcodeindex'; |
$index_properties->{$name}->{'code'} = 1 if $macro eq 'defcodeindex'; |
4149 |
} |
} |
4150 |
else |
else |
4151 |
{# FIXME makeinfo don't warn ? |
{# FIXME makeinfo don't warn and even accepts index with empty name |
4152 |
echo_error ("Bad $macro line: $line", $line_nr); |
echo_error ("Bad $macro line: $line", $line_nr); |
4153 |
} |
} |
4154 |
} |
} |
7394 |
} |
} |
7395 |
|
|
7396 |
# do regions handled specially, currently only tex, going throug latex2html |
# do regions handled specially, currently only tex, going throug latex2html |
7397 |
sub do_special ($$) |
sub init_special($$) |
7398 |
{ |
{ |
7399 |
my $style = shift; |
my $style = shift; |
7400 |
my $text = shift; |
my $text = shift; |
9373 |
{ |
{ |
9374 |
my $tag = $state->{'raw'}; |
my $tag = $state->{'raw'}; |
9375 |
$tag = $state->{'special'} unless $tag; |
$tag = $state->{'special'} unless $tag; |
9376 |
|
################# debug |
9377 |
if (! @$stack or ($stack->[-1]->{'style'} ne $tag)) |
if (! @$stack or ($stack->[-1]->{'style'} ne $tag)) |
9378 |
{ |
{ |
9379 |
print STDERR "Bug: raw or special: $tag but not on top of stack\n"; |
print STDERR "Bug: raw or special: $tag but not on top of stack\n"; |
9381 |
dump_stack($text, $stack, $state); |
dump_stack($text, $stack, $state); |
9382 |
exit 1; |
exit 1; |
9383 |
} |
} |
9384 |
|
################# end debug |
9385 |
if (s/^(.*?)\@end\s$tag$// or s/^(.*?)\@end\s$tag\s//) |
if (s/^(.*?)\@end\s$tag$// or s/^(.*?)\@end\s$tag\s//) |
9386 |
{ |
{ |
9387 |
add_prev ($text, $stack, $1); |
add_prev ($text, $stack, $1); |
9388 |
my $style = pop @$stack; |
my $style = pop @$stack; |
9389 |
if ($state->{'special'}) |
if ($state->{'special'}) |
9390 |
{ |
{ # replace the special region by what init_special give |
9391 |
delete $state->{'special'}; |
delete $state->{'special'}; |
9392 |
if ($style->{'text'} !~ /^\s*$/) |
if ($style->{'text'} !~ /^\s*$/) |
9393 |
{ |
{ |
9394 |
add_prev ($text, $stack, do_special($style->{'style'}, $style->{'text'})); |
add_prev ($text, $stack, init_special($style->{'style'}, $style->{'text'})); |
9395 |
} |
} |
9396 |
|
|
9397 |
} |
} |