texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Parser.pm t/55conditionals.t...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Parser.pm t/55conditionals.t...
Date: Tue, 11 Jan 2011 22:29:40 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/01/11 22:29:39

Modified files:
        tp/Texinfo     : Parser.pm 
        tp/t           : 55conditionals.t 
Added files:
        tp/t/results/conditionals: ifnotinfo_exception.pl 
                                   info_ifinfo_ifnotplaintext.pl 
                                   info_ifplaintext.pl 
                                   plaintext_ifinfo.pl 
                                   plaintext_ifinfo_ifnotplaintext.pl 

Log message:
        Handle info and plaintext differently than other formats for @if and 
@ifnot,
        as explained in the manual.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.174&r2=1.175
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/55conditionals.t?cvsroot=texinfo&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/conditionals/ifnotinfo_exception.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/conditionals/info_ifinfo_ifnotplaintext.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/conditionals/info_ifplaintext.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/conditionals/plaintext_ifinfo.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/conditionals/plaintext_ifinfo_ifnotplaintext.pl?cvsroot=texinfo&rev=1.1

Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- Texinfo/Parser.pm   10 Jan 2011 01:08:57 -0000      1.174
+++ Texinfo/Parser.pm   11 Jan 2011 22:29:39 -0000      1.175
@@ -3175,11 +3175,16 @@
                                            ord('@'), $command), $line_nr);
               }
             } elsif ($command =~ /^ifnot(.*)/) {
-              $ifvalue_true = 1 if !($self->{'expanded_formats_hash'}->{$1});
+              $ifvalue_true = 1 if !($self->{'expanded_formats_hash'}->{$1}
+                    # exception as explained in the texinfo manual
+                    or ($1 eq 'info' 
+                        and $self->{'expanded_formats_hash'}->{'plaintext'}));
               print STDERR "CONDITIONAL address@hidden format $1: 
$ifvalue_true\n" if ($self->{'debug'});
             } else {
               die unless ($command =~ /^if(.*)/);
-              $ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1});
+              $ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
+                      or ($1 eq 'info' 
+                          and 
$self->{'expanded_formats_hash'}->{'plaintext'}));
               print STDERR "CONDITIONAL address@hidden format $1: 
$ifvalue_true\n" if ($self->{'debug'});
             }
             if ($ifvalue_true) {

Index: t/55conditionals.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/55conditionals.t,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- t/55conditionals.t  24 Oct 2010 08:45:27 -0000      1.9
+++ t/55conditionals.t  11 Jan 2011 22:29:39 -0000      1.10
@@ -116,8 +116,43 @@
 '@ignore
 
 This is ignored
-']
-
+'],
+['info_ifplaintext',
+'
address@hidden
+this text will only appear in plain text.
address@hidden ifplaintext
+', {'expanded_formats' => ['info']}
+],
+['plaintext_ifinfo',
+'
address@hidden
+this text will appear only in Info and plain text.
address@hidden ifinfo
+', {'expanded_formats' => ['plaintext']}
+],
+['ifnotinfo_exception',
+'@ifnotinfo
+in ifnotinfo
address@hidden ifnotinfo
+', {'expanded_formats' => ['plaintext']}
+],
+['info_ifinfo_ifnotplaintext',
+'@ifinfo
address@hidden
+This will be in Info, but not plain text.
address@hidden ifnotplaintext
address@hidden ifinfo
+', {'expanded_formats' => ['info']}
+],
+['plaintext_ifinfo_ifnotplaintext',
+'@ifinfo
address@hidden
+This will be in Info, but not plain text.
address@hidden ifnotplaintext
address@hidden ifinfo
+', {'expanded_formats' => ['plaintext']}
+],
 );
 
 our ($arg_test_case, $arg_generate, $arg_debug);

Index: t/results/conditionals/ifnotinfo_exception.pl
===================================================================
RCS file: t/results/conditionals/ifnotinfo_exception.pl
diff -N t/results/conditionals/ifnotinfo_exception.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/conditionals/ifnotinfo_exception.pl       11 Jan 2011 22:29:39 
-0000      1.1
@@ -0,0 +1,18 @@
+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);
+
+$result_trees{'ifnotinfo_exception'} = {
+  'contents' => [],
+  'type' => 'text_root'
+};
+
+$result_texis{'ifnotinfo_exception'} = '';
+
+
+$result_texts{'ifnotinfo_exception'} = '';
+
+$result_errors{'ifnotinfo_exception'} = [];
+
+
+1;

Index: t/results/conditionals/info_ifinfo_ifnotplaintext.pl
===================================================================
RCS file: t/results/conditionals/info_ifinfo_ifnotplaintext.pl
diff -N t/results/conditionals/info_ifinfo_ifnotplaintext.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/conditionals/info_ifinfo_ifnotplaintext.pl        11 Jan 2011 
22:29:39 -0000      1.1
@@ -0,0 +1,34 @@
+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);
+
+$result_trees{'info_ifinfo_ifnotplaintext'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'parent' => {},
+          'text' => 'This will be in Info, but not plain text.
+'
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'info_ifinfo_ifnotplaintext'}{'contents'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'info_ifinfo_ifnotplaintext'}{'contents'}[0];
+$result_trees{'info_ifinfo_ifnotplaintext'}{'contents'}[0]{'parent'} = 
$result_trees{'info_ifinfo_ifnotplaintext'};
+
+$result_texis{'info_ifinfo_ifnotplaintext'} = 'This will be in Info, but not 
plain text.
+';
+
+
+$result_texts{'info_ifinfo_ifnotplaintext'} = 'This will be in Info, but not 
plain text.
+';
+
+$result_errors{'info_ifinfo_ifnotplaintext'} = [];
+
+
+1;

Index: t/results/conditionals/info_ifplaintext.pl
===================================================================
RCS file: t/results/conditionals/info_ifplaintext.pl
diff -N t/results/conditionals/info_ifplaintext.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/conditionals/info_ifplaintext.pl  11 Jan 2011 22:29:39 -0000      
1.1
@@ -0,0 +1,28 @@
+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);
+
+$result_trees{'info_ifplaintext'} = {
+  'contents' => [
+    {
+      'parent' => {},
+      'text' => '
+',
+      'type' => 'empty_line'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'info_ifplaintext'}{'contents'}[0]{'parent'} = 
$result_trees{'info_ifplaintext'};
+
+$result_texis{'info_ifplaintext'} = '
+';
+
+
+$result_texts{'info_ifplaintext'} = '
+';
+
+$result_errors{'info_ifplaintext'} = [];
+
+
+1;

Index: t/results/conditionals/plaintext_ifinfo.pl
===================================================================
RCS file: t/results/conditionals/plaintext_ifinfo.pl
diff -N t/results/conditionals/plaintext_ifinfo.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/conditionals/plaintext_ifinfo.pl  11 Jan 2011 22:29:39 -0000      
1.1
@@ -0,0 +1,43 @@
+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);
+
+$result_trees{'plaintext_ifinfo'} = {
+  'contents' => [
+    {
+      'parent' => {},
+      'text' => '
+',
+      'type' => 'empty_line'
+    },
+    {
+      'contents' => [
+        {
+          'parent' => {},
+          'text' => 'this text will appear only in Info and plain text.
+'
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'plaintext_ifinfo'}{'contents'}[0]{'parent'} = 
$result_trees{'plaintext_ifinfo'};
+$result_trees{'plaintext_ifinfo'}{'contents'}[1]{'contents'}[0]{'parent'} = 
$result_trees{'plaintext_ifinfo'}{'contents'}[1];
+$result_trees{'plaintext_ifinfo'}{'contents'}[1]{'parent'} = 
$result_trees{'plaintext_ifinfo'};
+
+$result_texis{'plaintext_ifinfo'} = '
+this text will appear only in Info and plain text.
+';
+
+
+$result_texts{'plaintext_ifinfo'} = '
+this text will appear only in Info and plain text.
+';
+
+$result_errors{'plaintext_ifinfo'} = [];
+
+
+1;

Index: t/results/conditionals/plaintext_ifinfo_ifnotplaintext.pl
===================================================================
RCS file: t/results/conditionals/plaintext_ifinfo_ifnotplaintext.pl
diff -N t/results/conditionals/plaintext_ifinfo_ifnotplaintext.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/conditionals/plaintext_ifinfo_ifnotplaintext.pl   11 Jan 2011 
22:29:39 -0000      1.1
@@ -0,0 +1,18 @@
+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);
+
+$result_trees{'plaintext_ifinfo_ifnotplaintext'} = {
+  'contents' => [],
+  'type' => 'text_root'
+};
+
+$result_texis{'plaintext_ifinfo_ifnotplaintext'} = '';
+
+
+$result_texts{'plaintext_ifinfo_ifnotplaintext'} = '';
+
+$result_errors{'plaintext_ifinfo_ifnotplaintext'} = [];
+
+
+1;



reply via email to

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