[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo Common.pm Encoding.pm Conver...
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo Common.pm Encoding.pm Conver... |
Date: |
Thu, 29 Sep 2011 08:40:19 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/09/29 08:40:19
Modified files:
tp/Texinfo : Common.pm Encoding.pm
tp/Texinfo/Convert: Converter.pm Texinfo.pm Text.pm
Log message:
Put find_innermost_accent_contents in Texinfo::Common.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Common.pm?cvsroot=texinfo&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Encoding.pm?cvsroot=texinfo&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Texinfo.pm?cvsroot=texinfo&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Text.pm?cvsroot=texinfo&r1=1.59&r2=1.60
Patches:
Index: Common.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Common.pm,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- Common.pm 29 Sep 2011 08:18:13 -0000 1.65
+++ Common.pm 29 Sep 2011 08:40:17 -0000 1.66
@@ -31,6 +31,9 @@
use Texinfo::Documentlanguages;
+# debugging
+use Carp qw(cluck);
+
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@@ -866,6 +869,59 @@
return $result;
}
+# find the innermost accent and the correspponding text contents
+sub find_innermost_accent_contents($;$)
+{
+ my $current = shift;
+ my $encoding = shift;
+ my @accent_commands = ();
+ my $debug = 0;
+ ACCENT:
+ while (1) {
+ # the following can happen if called with a bad tree
+ if (!$current->{'cmdname'}
+ or !$accent_commands{$current->{'cmdname'}}) {
+ #print STDERR "BUG: Not an accent command in accent\n";
+ cluck "BUG: Not an accent command in accent\n";
+ #print STDERR Texinfo::Convert::Texinfo::convert($current)."\n";
+ #print STDERR Data::Dumper->Dump([$current]);
+ last;
+ }
+ push @accent_commands, $current;
+ # A bogus accent
+ if (!$current->{'args'}) {
+ return ([], $current, address@hidden);
+ }
+ my $arg = $current->{'args'}->[0];
+ # a construct like @'e without content
+ if (defined($arg->{'text'})) {
+ return ([$arg], $current, address@hidden);
+ }
+ if (!$arg->{'contents'}) {
+ print STDERR "BUG: No content in accent command\n";
+ #print STDERR Data::Dumper->Dump([$current]);
+ #print STDERR Texinfo::Convert::Texinfo::convert($current)."\n";
+ last;
+ }
+ # inside the braces of an accent
+ my $text_contents = [];
+ foreach my $content (@{$arg->{'contents'}}) {
+ if (!($content->{'extra'} and $content->{'extra'}->{'invalid_nesting'})
+ and !($content->{'cmdname'} and ($content->{'cmdname'} eq 'c'
+ or $content->{'cmdname'} eq 'comment'))) {
+ if ($content->{'cmdname'} and $accent_commands{$content->{'cmdname'}})
{
+ $current = $content;
+ next ACCENT;
+ } else {
+ push @$text_contents, $content;
+ }
+ }
+ }
+ # we go here if there was no nested accent
+ return ($text_contents, $current, address@hidden);
+ }
+}
+
sub trim_spaces_comment_from_content($)
{
my $contents = shift;
Index: Encoding.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Encoding.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Encoding.pm 29 Sep 2011 08:18:13 -0000 1.1
+++ Encoding.pm 29 Sep 2011 08:40:17 -0000 1.2
@@ -44,6 +44,8 @@
@EXPORT = qw(
);
+$VERSION = '0.01';
+
# charset related definitions.
our %perl_charset_to_html = (
Index: Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- Convert/Converter.pm 29 Sep 2011 08:18:14 -0000 1.41
+++ Convert/Converter.pm 29 Sep 2011 08:40:18 -0000 1.42
@@ -25,9 +25,11 @@
use Texinfo::Report;
use Texinfo::Common;
-use vars qw(@ISA);
+use vars qw(@ISA $VERSION);
@ISA = qw(Texinfo::Report);
+$VERSION = '0.01';
+
my %defaults = (
'frenchspacing' => 'off',
'paragraphindent' => 3,
@@ -816,7 +818,7 @@
}
}
my ($contents, $innermost_accent, $stack)
- = Texinfo::Convert::Text::_find_innermost_accent_contents($accent);
+ = Texinfo::Common::find_innermost_accent_contents($accent);
my $result = $self->_convert({'contents' => $contents});
foreach my $accent_command (reverse(@$stack)) {
Index: Convert/Texinfo.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Texinfo.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- Convert/Texinfo.pm 20 Aug 2011 14:38:47 -0000 1.5
+++ Convert/Texinfo.pm 29 Sep 2011 08:40:18 -0000 1.6
@@ -95,8 +95,8 @@
$result = '@'.$cmdname if ($cmdname);
#print STDERR "Expand $result\n";
- #Â this is done here otherwise for some constructs, there are
- #Â no 'args', and so the space is never readded.
+ # this is done here otherwise for some constructs, there are
+ # no 'args', and so the space is never readded.
if ($cmd->{'extra'} and exists ($cmd->{'extra'}->{'spaces'})) {
$result .= $cmd->{'extra'}->{'spaces'};
}
Index: Convert/Text.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Text.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- Convert/Text.pm 29 Sep 2011 08:18:14 -0000 1.59
+++ Convert/Text.pm 29 Sep 2011 08:40:18 -0000 1.60
@@ -174,62 +174,6 @@
$ignored_types{$type} = 1;
}
-# find the innermost accent and the correspponding text contents
-# FIXME This is not output dependent, so could be in
-# Texinfo::Convert::Converter. However this would create a
-# dependency loop.
-sub _find_innermost_accent_contents($;$)
-{
- my $current = shift;
- my $encoding = shift;
- my @accent_commands = ();
- my $debug = 0;
- ACCENT:
- while (1) {
- # the following can happen if called with a bad tree
- if (!$current->{'cmdname'}
- or !$accent_commands{$current->{'cmdname'}}) {
- #print STDERR "BUG: Not an accent command in accent\n";
- cluck "BUG: Not an accent command in accent\n";
- print STDERR Texinfo::Convert::Texinfo::convert($current)."\n";
- print STDERR Data::Dumper->Dump([$current]);
- last;
- }
- push @accent_commands, $current;
- # A bogus accent
- if (!$current->{'args'}) {
- return ([], $current, address@hidden);
- }
- my $arg = $current->{'args'}->[0];
- # a construct like @'e without content
- if (defined($arg->{'text'})) {
- return ([$arg], $current, address@hidden);
- }
- if (!$arg->{'contents'}) {
- print STDERR "BUG: No content in accent command\n";
- print STDERR Data::Dumper->Dump([$current]);
- print STDERR Texinfo::Convert::Texinfo::convert($current)."\n";
- last;
- }
- # inside the braces of an accent
- my $text_contents = [];
- foreach my $content (@{$arg->{'contents'}}) {
- if (!($content->{'extra'} and $content->{'extra'}->{'invalid_nesting'})
- and !($content->{'cmdname'} and ($content->{'cmdname'} eq 'c'
- or $content->{'cmdname'} eq 'comment'))) {
- if ($content->{'cmdname'} and $accent_commands{$content->{'cmdname'}})
{
- $current = $content;
- next ACCENT;
- } else {
- push @$text_contents, $content;
- }
- }
- }
- # we go here if there was no nested accent
- return ($text_contents, $current, address@hidden);
- }
-}
-
# find the innermost accent and format the correspponding text contents
sub _find_innermost_accent($;$$)
{
@@ -237,7 +181,7 @@
my $encoding = shift;
my $in_upper_case = shift;
my ($contents, $innermost_accent, $stack)
- = _find_innermost_accent_contents($current);
+ = Texinfo::Common::find_innermost_accent_contents($current);
my $options = {};
$options->{'enabled_encoding'} = $encoding if (defined($encoding));
$options->{'sc'} = $in_upper_case if (defined($in_upper_case));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp/Texinfo Common.pm Encoding.pm Conver...,
Patrice Dumas <=