texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve...


From: Patrice Dumas
Subject: texinfo/tp TODO Texinfo/Parser.pm Texinfo/Conve...
Date: Sat, 19 Mar 2011 10:09:35 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/03/19 10:09:34

Modified files:
        tp             : TODO 
        tp/Texinfo     : Parser.pm 
        tp/Texinfo/Convert: Plaintext.pm 
        tp/t           : 02coverage.t 30sectioning.t 
        tp/t/results/sectioning: at_commands_in_refs.pl 
Added files:
        tp/t/results/coverage: test_today.pl 

Log message:
        Handle @today.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/TODO?cvsroot=texinfo&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.224&r2=1.225
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/02coverage.t?cvsroot=texinfo&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/30sectioning.t?cvsroot=texinfo&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage/test_today.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/sectioning/at_commands_in_refs.pl?cvsroot=texinfo&r1=1.36&r2=1.37

Patches:
Index: TODO
===================================================================
RCS file: /sources/texinfo/texinfo/tp/TODO,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- TODO        17 Mar 2011 21:01:01 -0000      1.112
+++ TODO        19 Mar 2011 10:09:33 -0000      1.113
@@ -72,6 +72,10 @@
 Use PREFIX to override setfilename/input file name to determine output
 name? Isn't -o sufficient? Or call it 'setfilename'?
 
+Punctuation and spaces before @image do not lead to a doubling of space.
+
+Use INLINE_INSERTCOPYING as the default for some formats?
+
 Force end lines before/after a menu?
 
 With something like

Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -b -r1.224 -r1.225
--- Texinfo/Parser.pm   19 Mar 2011 00:04:27 -0000      1.224
+++ Texinfo/Parser.pm   19 Mar 2011 10:09:33 -0000      1.225
@@ -73,6 +73,7 @@
   global_commands_information
   global_informations
   expand_verbatiminclude
+  expand_today
   gdt
 ) ] );
 
@@ -4417,6 +4418,47 @@
   return $verbatiminclude;
 }
 
+my @MONTH_NAMES =
+    (
+     'January', 'February', 'March', 'April', 'May',
+     'June', 'July', 'August', 'September', 'October',
+     'November', 'December'
+    );
+
+# This is not used as code, but used to mark months as strings to be
+# translated
+if (0) {
+  my $self;
+  my @mark_month_for_translation = (
+   $self->gdt('January'),
+   $self->gdt('February'),
+   $self->gdt('March'),
+   $self->gdt('April'),
+   $self->gdt('May'),
+   $self->gdt('June'),
+   $self->gdt('July'),
+   $self->gdt('August'),
+   $self->gdt('September'),
+   $self->gdt('October'),
+   $self->gdt('November'),
+   $self->gdt('December')
+  );
+}
+
+sub expand_today($)
+{
+  my $self = shift;
+  if ($self->{'TEST'}) {
+    return {'text' => 'a sunny day'};
+  }
+  my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)
+   = localtime(time);
+  $year += ($year < 70) ? 2000 : 1900;
+  return $self->gdt('{month} {day}, {year}', 
+          { 'month' => $self->gdt($MONTH_NAMES[$mon]),
+            'day' => $mday, 'year' => $year });
+}
+
 1;
 __END__
 # Below is stub documentation.

Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- Texinfo/Convert/Plaintext.pm        15 Mar 2011 22:27:49 -0000      1.117
+++ Texinfo/Convert/Plaintext.pm        19 Mar 2011 10:09:33 -0000      1.118
@@ -1294,6 +1294,9 @@
             
$formatter->{'container'}->add_text($text_no_brace_commands{$command}));
       }
       return $result;
+    } elsif ($root->{'cmdname'} eq 'today') {
+      my $today = Texinfo::Parser::expand_today($self);
+      unshift @{$self->{'current_contents'}->[-1]}, $today;
     } elsif (defined($text_brace_no_arg_commands{$root->{'cmdname'}})) {
       my $text = Texinfo::Convert::Text::brace_no_arg_command($root, 
                                               $self->{'encoding_name'});

Index: t/02coverage.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/02coverage.t,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- t/02coverage.t      17 Mar 2011 21:01:02 -0000      1.43
+++ t/02coverage.t      19 Mar 2011 10:09:34 -0000      1.44
@@ -484,6 +484,8 @@
 ['test_tie',
 'address@hidden
 '],
+['test_today',
+'@today{}.', {}, {'TEST' => 1}]
 );
 
 my @test_invalid = (
@@ -662,7 +664,7 @@
 );
 
 foreach my $test (@test_cases) {
-  $test->[2]->{'test_formats'} = ['plaintext'];
+  push @{$test->[2]->{'test_formats'}}, 'plaintext';
 }
 
 our ($arg_test_case, $arg_generate, $arg_debug);

Index: t/30sectioning.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/30sectioning.t,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- t/30sectioning.t    13 Mar 2011 22:01:23 -0000      1.32
+++ t/30sectioning.t    19 Mar 2011 10:09:34 -0000      1.33
@@ -483,7 +483,7 @@
 @address@hidden://somewhere_aaa} @url{url, text} @uref{/man.cgi/1/ls,,ls}}
 
 @bye
-'],
+', {}, {'TEST' => 1}],
 ['double_node_anchor_float',
 '@node node1
 
@@ -1235,7 +1235,7 @@
 );
 
 foreach my $test (@tests_converted) {
-  $test->[2]->{'test_formats'} = ['plaintext'];
+  push @{$test->[2]->{'test_formats'}}, 'plaintext';
 }
 foreach my $test (@tests_info) {
   push @{$test->[2]->{'test_formats'}}, 'info';

Index: t/results/sectioning/at_commands_in_refs.pl
===================================================================
RCS file: 
/sources/texinfo/texinfo/tp/t/results/sectioning/at_commands_in_refs.pl,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- t/results/sectioning/at_commands_in_refs.pl 6 Mar 2011 14:44:08 -0000       
1.36
+++ t/results/sectioning/at_commands_in_refs.pl 19 Mar 2011 10:09:34 -0000      
1.37
@@ -19608,7 +19608,7 @@
 * == error--> Euro ! ==> -::
 * >= <= ->::
 * a o -!- # -| ? (R)::
-* => o a b  aa::
+* => o a b a sunny day aa::
 * AA ae oe AE OE /o /O ss /l /L D d TH th::
 * a" e~ i^ a^ a` e\' c, e= e* e\'\' e;::
 * e. e( e_ .e e< j ee[::
@@ -19662,19 +19662,19 @@
 **********
 
 
-File: ,  Node: a o -!- # -| ? (R),  Next: => o a b aa,  Prev: >= <= ->,  Up: 
Top
+File: ,  Node: a o -!- # -| ? (R),  Next: => o a b a sunny day aa,  Prev: >= 
<= ->,  Up: Top
 
 6 a o -!- # -| ? (R)
 ********************
 
 
-File: ,  Node: => o a b aa,  Next: AA ae oe AE OE /o /O ss /l /L D d TH th,  
Prev: a o -!- # -| ? (R),  Up: Top
+File: ,  Node: => o a b a sunny day aa,  Next: AA ae oe AE OE /o /O ss /l /L D 
d TH th,  Prev: a o -!- # -| ? (R),  Up: Top
 
-7 => o a b aa
-*************
+7 => o a b a sunny day aa
+*************************
 
 
-File: ,  Node: AA ae oe AE OE /o /O ss /l /L D d TH th,  Next: a" e~ i^ a^ a` 
e\' c, e= e* e\'\' e;,  Prev: => o a b aa,  Up: Top
+File: ,  Node: AA ae oe AE OE /o /O ss /l /L D d TH th,  Next: a" e~ i^ a^ a` 
e\' c, e= e* e\'\' e;,  Prev: => o a b a sunny day aa,  Up: Top
 
 8 AA ae oe AE OE /o /O ss /l /L D d TH th
 *****************************************
@@ -19784,45 +19784,45 @@
 
    *note >= <= ->::
 
-   *note a o -!- # -| ? (R):: *note => o a b aa:: *note AA ae oe AE OE
-/o /O ss /l /L D d TH th:: *note a" e~ i^ a^ a` e\' c, e= e* e\'\' e;::
-*note e. e( e_ .e e< j ee[:: *note `` \'\' ` \' ,, ,:: *note << >> << >> <
->:: *note `` \'\' --- --:: *note AAA (fff) AAA BBB:: *note CCC (rrr) CCC
-DDD:: *note the someone <address@hidden> <address@hidden>:: *note  [image 
src="f--ile.png" alt="alt" text="[Image description\\"\\"\\\\.]"]
-:: *note  @ {} . :: *note `cite asis\' in @w b in r SC *str* t VAR "dfn"
-i:: *note `env\' `code\' `option\' `samp\' `command\' `file\' `C-x <ESC>\'::
-*note 8.27in:: *note sansserif slanted:: *note <indicateurl>:: *note
-`http://somewhere_aaa\' text (url) ls::
+   *note a o -!- # -| ? (R):: *note => o a b a sunny day aa:: *note AA
+ae oe AE OE /o /O ss /l /L D d TH th:: *note a" e~ i^ a^ a` e\' c, e= e*
+e\'\' e;:: *note e. e( e_ .e e< j ee[:: *note `` \'\' ` \' ,, ,:: *note << >>
+<< >> < >:: *note `` \'\' --- --:: *note AAA (fff) AAA BBB:: *note CCC
+(rrr) CCC DDD:: *note the someone <address@hidden>
+<address@hidden>:: *note  [image src="f--ile.png" alt="alt" text="[Image 
description\\"\\"\\\\.]"]:: *note  @ {} . :: *note `cite asis\' in @w b
+in r SC *str* t VAR "dfn" i:: *note `env\' `code\' `option\' `samp\'
+`command\' `file\' `C-x <ESC>\':: *note 8.27in:: *note sansserif slanted::
+*note <indicateurl>:: *note `http://somewhere_aaa\' text (url) ls::
 
 
 
 Tag Table:
 Node: Top52
-Node: { }819
+Node: { }830
 Node:     !
-. . ? @898
-Node: LaTeX TeX * , (C) ... ...1019
-Node: == error--> Euro ! ==> -1185
-Node: >= <= ->1344
-Node: a o -!- # -| ? (R)1464
-Node: => o a b aa1591
-Node: AA ae oe AE OE /o /O ss /l /L D d TH th1735
-Node: a" e~ i^ a^ a` e\' c, e= e* e\'\' e;1950
-Node: e. e( e_ .e e< j ee[2162
-Node: `` \'\' ` \' ,, ,2325
-Node: << >> << >> < >2458
-Node: `` \'\' --- --2585
-Node: AAA (fff) AAA BBB2701
-Node: CCC (rrr) CCC DDD2837
-Node: the someone <address@hidden> <address@hidden>3010
-Node:  [image src="f--ile.png" alt="alt" text="[Image 
description\\"\\"\\\\.]"]3303
-Node:  @ {} . 3632
-Node: `cite asis\' in @w b in r SC *str* t VAR "dfn" i3832
-Node: `env\' `code\' `option\' `samp\' `command\' `file\' `C-x <ESC>\'4094
-Node: 8.27in4374
-Node: sansserif slanted4522
-Node: <indicateurl>4648
-Node: `http://somewhere_aaa\' text (url) ls4796
+. . ? @909
+Node: LaTeX TeX * , (C) ... ...1030
+Node: == error--> Euro ! ==> -1196
+Node: >= <= ->1355
+Node: a o -!- # -| ? (R)1475
+Node: => o a b a sunny day aa1614
+Node: AA ae oe AE OE /o /O ss /l /L D d TH th1794
+Node: a" e~ i^ a^ a` e\' c, e= e* e\'\' e;2021
+Node: e. e( e_ .e e< j ee[2233
+Node: `` \'\' ` \' ,, ,2396
+Node: << >> << >> < >2529
+Node: `` \'\' --- --2656
+Node: AAA (fff) AAA BBB2772
+Node: CCC (rrr) CCC DDD2908
+Node: the someone <address@hidden> <address@hidden>3081
+Node:  [image src="f--ile.png" alt="alt" text="[Image 
description\\"\\"\\\\.]"]3374
+Node:  @ {} . 3703
+Node: `cite asis\' in @w b in r SC *str* t VAR "dfn" i3903
+Node: `env\' `code\' `option\' `samp\' `command\' `file\' `C-x <ESC>\'4165
+Node: 8.27in4445
+Node: sansserif slanted4593
+Node: <indicateurl>4719
+Node: `http://somewhere_aaa\' text (url) ls4867
 
 End Tag Table
 ';

Index: t/results/coverage/test_today.pl
===================================================================
RCS file: t/results/coverage/test_today.pl
diff -N t/results/coverage/test_today.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/coverage/test_today.pl    19 Mar 2011 10:09:34 -0000      1.1
@@ -0,0 +1,51 @@
+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{'test_today'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'parent' => {},
+              'type' => 'brace_command_arg'
+            }
+          ],
+          'cmdname' => 'today',
+          'contents' => [],
+          'parent' => {}
+        },
+        {
+          'parent' => {},
+          'text' => '.'
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'test_today'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'} 
= $result_trees{'test_today'}{'contents'}[0]{'contents'}[0];
+$result_trees{'test_today'}{'contents'}[0]{'contents'}[0]{'parent'} = 
$result_trees{'test_today'}{'contents'}[0];
+$result_trees{'test_today'}{'contents'}[0]{'contents'}[1]{'parent'} = 
$result_trees{'test_today'}{'contents'}[0];
+$result_trees{'test_today'}{'contents'}[0]{'parent'} = 
$result_trees{'test_today'};
+
+$result_texis{'test_today'} = '@today{}.';
+
+
+$result_texts{'test_today'} = '.';
+
+$result_errors{'test_today'} = [];
+
+
+
+$result_converted{'plaintext'}->{'test_today'} = 'a sunny day.
+';
+
+1;



reply via email to

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