texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo/tp Texinfo/Parser.pm Texinfo/Structurin...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Parser.pm Texinfo/Structurin...
Date: Tue, 05 Apr 2011 00:01:47 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/04/05 00:01:47

Modified files:
        tp/Texinfo     : Parser.pm Structuring.pm 
        tp/Texinfo/Convert: Converter.pm HTML.pm 
        tp/t           : 03coverage_braces.t 
Added files:
        tp/t/results/coverage_braces: empty_command_argument.pl 

Log message:
        Prepare information for the html file beginning.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.233&r2=1.234
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Structuring.pm?cvsroot=texinfo&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Converter.pm?cvsroot=texinfo&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/HTML.pm?cvsroot=texinfo&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/03coverage_braces.t?cvsroot=texinfo&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage_braces/empty_command_argument.pl?cvsroot=texinfo&rev=1.1

Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -b -r1.233 -r1.234
--- Texinfo/Parser.pm   3 Apr 2011 22:44:56 -0000       1.233
+++ Texinfo/Parser.pm   5 Apr 2011 00:01:45 -0000       1.234
@@ -406,7 +406,7 @@
   'kbdinputstyle', 'paragraphindent', 'firstparagraphindent',
   'frenchspacing', 'footnotestyle', 'hyphenation', 'urefbreakstyle',
   'xrefautomaticsectiontitle', 'codequoteundirected',
-  'codequotebacktick') {
+  'codequotebacktick', 'titlefont') {
   $global_multiple_commands{$global_multiple_command} = 1;
 }
 

Index: Texinfo/Structuring.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Structuring.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- Texinfo/Structuring.pm      3 Apr 2011 17:04:31 -0000       1.45
+++ Texinfo/Structuring.pm      5 Apr 2011 00:01:46 -0000       1.46
@@ -548,6 +548,8 @@
         $current->{'extra'}->{'node'} = $content;
       } else {
         $current = { 'type' => 'element', 'extra' => {'node' => $content}};
+        $current->{'element_prev'} = $elements->[-1];
+        $elements->[-1]->{'element_next'} = $current;
         push @$elements, $current;
       }
     }

Index: Texinfo/Convert/Converter.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Converter.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Texinfo/Convert/Converter.pm        3 Apr 2011 22:44:56 -0000       1.7
+++ Texinfo/Convert/Converter.pm        5 Apr 2011 00:01:46 -0000       1.8
@@ -381,6 +381,14 @@
     = $Texinfo::Convert::Text::text_no_brace_commands{$text_no_brace_command};
 }
 
+sub xml_default_comment($$)
+{
+  my $self = shift;
+  my $text = shift;
+  $text =~ s/--+/-/go;
+  return '<!-- ' . $text . ' -->' . "\n";
+}
+
 my %xml_accent_entities = (
           '"',  'uml',
           '~',  'tilde',

Index: Texinfo/Convert/HTML.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/HTML.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Texinfo/Convert/HTML.pm     3 Apr 2011 22:44:56 -0000       1.7
+++ Texinfo/Convert/HTML.pm     5 Apr 2011 00:01:46 -0000       1.8
@@ -519,6 +519,12 @@
   $default_commands_conversion{$command} = \&accent_commands;
 }
 
+sub default_comment($$) {
+  my $self = shift;
+  my $text = shift;
+  return $self->xml_default_comment($text);
+}
+
 my $DEFAULT_RULE = '<hr>';
 
 sub default_heading_text($$$$$)
@@ -752,6 +758,7 @@
 
   foreach my $formatting_references (
      ['heading_text', \&default_heading_text, $Texinfo::Config::heading_text],
+     ['comment', \&default_comment, $Texinfo::Config::comment],
   ) {
     if (defined($formatting_references->[2])) {
       $self->{$formatting_references->[0]} = $formatting_references->[2];
@@ -954,10 +961,18 @@
       $self->_set_page_file($node_top_page, $filename);
     }
   }
+  # FIXME add a number for each page?
   my $file_nr = 0;
+  my $previous_page;
   if ($self->{'NODE_FILENAMES'}) {
    PAGE:
     foreach my $page(@$pages) {
+      if (defined($previous_page)) {
+        $page->{'page_prev'} = $previous_page;
+        $previous_page->{'page_next'} = $page;
+      }
+      $previous_page = $page;
+      # For Top node.
       next if (defined($page->{'filename'}));
       foreach my $element (@{$page->{'contents'}}) {
         foreach my $root_comand (@{$element->{'contents'}}) {
@@ -976,7 +991,13 @@
       $file_nr++;
     }
   } else {
+    my $previous_page;
     foreach my $page(@$pages) {
+      if (defined($previous_page)) {
+        $page->{'page_prev'} = $previous_page;
+        $previous_page->{'page_next'} = $page;
+      }
+      $previous_page = $page;
       my $filename = $self->{'document_name'} . "_$file_nr";
       $filename .= '.'.$self->{'EXTENSION'} 
           if (defined($self->{'EXTENSION'}) and $self->{'EXTENSION'} ne '');
@@ -1096,6 +1117,53 @@
   # determine file names associated with the different pages.
   $self->_set_page_files($pages);
 
+  # FIXME set language and documentencoding/encoding_name
+  # title
+  my $fulltitle;
+  foreach my $fulltitle_command('settitle', 'title', 
+     'shorttitlepage', 'top') {
+    if ($self->{'extra'}->{$fulltitle_command}) {
+      my $command = $self->{'extra'}->{$fulltitle_command};
+      next if ($command->{'extra'} 
+               and $command->{'extra'}->{'missing_argument'});
+      $fulltitle = $command;
+      last;
+    }
+  }
+  if (!$fulltitle and $self->{'extra'}->{'titlefont'}
+      and $self->{'extra'}->{'titlefont'}->[0]->{'extra'}
+      and 
$self->{'extra'}->{'titlefont'}->[0]->{'extra'}->{'brace_command_contents'}
+      and 
defined($self->{'extra'}->{'titlefont'}->[0]->{'extra'}->{'brace_command_contents'}->[0]))
 {
+    $fulltitle = $self->{'extra'}->{'titlefont'}->[0];
+  }
+  my $simpletitle;
+  foreach my $simpletitle_command('settitle', 'shorttitlepage') {
+    if ($self->{'extra'}->{$simpletitle_command}) {
+      my $command = $self->{'extra'}->{$simpletitle_command};
+      next if ($command->{'extra'} 
+               and $command->{'extra'}->{'missing_argument'});
+      $simpletitle = $command;
+      last;
+    }
+  }
+
+  my $default_title = $self->gdt('Untitled Document');
+  $self->{'context'}->[-1]->{'string'} = 1;
+  my $html_default_title = $self->_convert($default_title);
+  delete $self->{'context'}->[-1]->{'string'};
+  if ($self->{'extra'}->{'copying'}) {
+    my $options;
+    if ($self->{'ENABLE_ENCODING'} and $self->{'encoding_name'}) {
+      $options->{'enabled_encoding'} = $self->{'encoding_name'};
+    }
+
+    my $copying_comment = Texinfo::Convert::Text::convert(
+     {'contents' => $self->{'extra'}->{'copying'}->{'contents'}}, $options);
+    if ($copying_comment ne '') {
+      $copying_comment = &{$self->{'comment'}}($self, $copying_comment);
+    }
+  }
+
   my $fh;
   my $output = '';
   if (!$pages) {

Index: t/03coverage_braces.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/03coverage_braces.t,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- t/03coverage_braces.t       19 Mar 2011 16:20:31 -0000      1.33
+++ t/03coverage_braces.t       5 Apr 2011 00:01:46 -0000       1.34
@@ -36,6 +36,11 @@
 '@ref{(file)node, cross ref with uref 
@uref{href://http/myhost.com/index.html,uref1}, title with uref2 
@uref{href://http/myhost.com/index2.html,uref2}, info file with uref3 
@uref{href://http/myhost.com/index3.html,uref3}, printed manual with uref4 
@uref{href://http/myhost.com/index4.html,uref4}}
 '],
 ['too_much_args', '@abbr{AZE, A truc Z b, E eep}'],
+['empty_command_argument',
+'@titlefont{}
+
address@hidden@footnote{}. @verb{::}.
+'],
 ['footnote', 'address@hidden footnote.
 
 @r{in footnote r}. } after footnote.'],

Index: t/results/coverage_braces/empty_command_argument.pl
===================================================================
RCS file: t/results/coverage_braces/empty_command_argument.pl
diff -N t/results/coverage_braces/empty_command_argument.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/coverage_braces/empty_command_argument.pl 5 Apr 2011 00:01:47 
-0000       1.1
@@ -0,0 +1,142 @@
+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);
+
+use utf8;
+
+$result_trees{'empty_command_argument'} = {
+  'contents' => [
+    {
+      'args' => [
+        {
+          'contents' => [],
+          'parent' => {},
+          'type' => 'brace_command_arg'
+        }
+      ],
+      'cmdname' => 'titlefont',
+      'contents' => [],
+      'extra' => {
+        'brace_command_contents' => [
+          undef
+        ]
+      },
+      'line_nr' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      },
+      'parent' => {}
+    },
+    {
+      'parent' => {},
+      'text' => '
+'
+    },
+    {
+      'parent' => {},
+      'text' => '
+',
+      'type' => 'empty_line'
+    },
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'parent' => {},
+              'type' => 'brace_command_arg'
+            }
+          ],
+          'cmdname' => 'code',
+          'contents' => [],
+          'line_nr' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          },
+          'parent' => {}
+        },
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'parent' => {},
+              'type' => 'brace_command_context'
+            }
+          ],
+          'cmdname' => 'footnote',
+          'contents' => [],
+          'line_nr' => {},
+          'parent' => {}
+        },
+        {
+          'parent' => {},
+          'text' => '. '
+        },
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'parent' => {},
+              'type' => 'brace_command_arg'
+            }
+          ],
+          'cmdname' => 'verb',
+          'contents' => [],
+          'line_nr' => {},
+          'parent' => {},
+          'type' => ':'
+        },
+        {
+          'parent' => {},
+          'text' => '.
+'
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'empty_command_argument'}{'contents'}[0]{'args'}[0]{'parent'} = 
$result_trees{'empty_command_argument'}{'contents'}[0];
+$result_trees{'empty_command_argument'}{'contents'}[0]{'parent'} = 
$result_trees{'empty_command_argument'};
+$result_trees{'empty_command_argument'}{'contents'}[1]{'parent'} = 
$result_trees{'empty_command_argument'};
+$result_trees{'empty_command_argument'}{'contents'}[2]{'parent'} = 
$result_trees{'empty_command_argument'};
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[0];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[0]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[1]{'args'}[0]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[1];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[1]{'line_nr'}
 = 
$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[0]{'line_nr'};
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[1]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[2]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[3]{'args'}[0]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[3];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[3]{'line_nr'}
 = 
$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[0]{'line_nr'};
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[3]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'contents'}[4]{'parent'}
 = $result_trees{'empty_command_argument'}{'contents'}[3];
+$result_trees{'empty_command_argument'}{'contents'}[3]{'parent'} = 
$result_trees{'empty_command_argument'};
+
+$result_texis{'empty_command_argument'} = '@titlefont{}
+
address@hidden@footnote{}. @verb{::}.
+';
+
+
+$result_texts{'empty_command_argument'} = '
+
+. .
+';
+
+$result_errors{'empty_command_argument'} = [];
+
+
+
+$result_converted{'plaintext'}->{'empty_command_argument'} = '`\'(1).  .
+
+   ---------- Footnotes ----------
+
+   (1) 
+';
+
+1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]