texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * util/txixml2texi.pl (BEGIN): update by adapting


From: Patrice Dumas
Subject: branch master updated: * util/txixml2texi.pl (BEGIN): update by adapting texi2any.pl BEGIN block.
Date: Thu, 16 Feb 2023 12:26:26 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 5c0db52826 * util/txixml2texi.pl (BEGIN): update by adapting 
texi2any.pl BEGIN block.
5c0db52826 is described below

commit 5c0db528263dd5cbba168b1800a3f7a3cf9b67c4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Feb 16 18:26:16 2023 +0100

    * util/txixml2texi.pl (BEGIN): update by adapting texi2any.pl BEGIN
    block.
---
 ChangeLog                                          |   7 +-
 .../xml_tests/inlineifset_empty_second_arg.pl      | 131 +++++++++++++++++++++
 util/txixml2texi.pl                                |  71 +++++------
 3 files changed, 174 insertions(+), 35 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f43f1eb7c1..6792576761 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
+2023-02-16  Patrice Dumas  <pertusus@free.fr>
+
+       * util/txixml2texi.pl (BEGIN): update by adapting texi2any.pl BEGIN
+       block.
+
 2023-02-16  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
        tp/Texinfo/XS/parsetexi/separator.c (handle_comma): do not open
-       a brace command container if the second argument if inlinefmtifelse
+       a brace command container if the second argument of inlinefmtifelse
        does not exist.
 
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line): comments,
diff --git a/tp/t/results/xml_tests/inlineifset_empty_second_arg.pl 
b/tp/t/results/xml_tests/inlineifset_empty_second_arg.pl
new file mode 100644
index 0000000000..6f49ab8d4b
--- /dev/null
+++ b/tp/t/results/xml_tests/inlineifset_empty_second_arg.pl
@@ -0,0 +1,131 @@
+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_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'inlineifset_empty_second_arg'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Toto '
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'flag'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => '',
+                      'type' => 'raw'
+                    }
+                  ],
+                  'type' => 'elided_brace_command_arg'
+                }
+              ],
+              'cmdname' => 'inlineifset',
+              'extra' => {
+                'format' => 'flag'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 1,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '. After.
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'text' => 'Again with space '
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'flag'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => ' ',
+                      'type' => 'raw'
+                    }
+                  ],
+                  'type' => 'elided_brace_command_arg'
+                }
+              ],
+              'cmdname' => 'inlineifset',
+              'extra' => {
+                'format' => 'flag'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '. After.
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'inlineifset_empty_second_arg'} = 'Toto @inlineifset{flag,}. 
After.
+
+Again with space @inlineifset{flag, }. After.
+';
+
+
+$result_texts{'inlineifset_empty_second_arg'} = 'Toto . After.
+
+Again with space . After.
+';
+
+$result_errors{'inlineifset_empty_second_arg'} = [];
+
+
+$result_floats{'inlineifset_empty_second_arg'} = {};
+
+
+
+$result_converted{'xml'}->{'inlineifset_empty_second_arg'} = '<para>Toto 
<inlineifset><inlineifsetformat>flag</inlineifsetformat></inlineifset>. After.
+</para>
+<para>Again with space 
<inlineifset><inlineifsetformat>flag</inlineifsetformat><inlineifsetcontent> 
</inlineifsetcontent></inlineifset>. After.
+</para>';
+
+1;
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index cf7eb36523..d5e42ef1fc 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -35,47 +35,50 @@ BEGIN
   my ($real_command_name, $command_directory, $command_suffix)
      = fileparse($0, '.pl');
 
-  my $datadir = '@datadir@';
-  my $package = '@PACKAGE@';
   my $updir = File::Spec->updir();
 
-  my $texinfolibdir;
-  my $lib_dir;
+  my $datadir = '@datadir@';
+  my $package = '@PACKAGE@';
+  my $xsdir = '@pkglibdir@';
 
   # in-source run
-  if (($command_suffix eq '.pl' and !(defined($ENV{'TEXINFO_DEV_SOURCE'})
-       and $ENV{'TEXINFO_DEV_SOURCE'} eq 0)) or $ENV{'TEXINFO_DEV_SOURCE'}) {
-    my $srcdir = defined $ENV{'srcdir'} ? $ENV{'srcdir'} : $command_directory;
-    $texinfolibdir = File::Spec->catdir($srcdir, $updir, 'tp');
-    $lib_dir = File::Spec->catdir($texinfolibdir, 'maintain');
-    unshift @INC, $texinfolibdir;
-  } elsif ($datadir ne '@' .'datadir@' and $package ne '@' . 'PACKAGE@'
-           and $datadir ne '') {
-    $texinfolibdir = File::Spec->catdir($datadir, $package);
-    # try to make package relocatable, will only work if standard relative 
paths
-    # are used
-    if (! -f File::Spec->catfile($texinfolibdir, 'Texinfo', 'Parser.pm')
-        and -f File::Spec->catfile($command_directory, $updir, 'share',
-                                   'texinfo', 'Texinfo', 'Parser.pm')) {
-      $texinfolibdir = File::Spec->catdir($command_directory, $updir,
-                                          'share', 'texinfo');
-    }
-    $lib_dir = $texinfolibdir;
-    unshift @INC, $texinfolibdir;
-  }
+  if ($datadir eq '@' .'datadir@'
+      or defined($ENV{'TEXINFO_DEV_SOURCE'})
+         and $ENV{'TEXINFO_DEV_SOURCE'} ne '0') {
 
-  # '@USE_EXTERNAL_LIBINTL @ and similar are substituted in the
-  # makefile using values from configure
-  if (defined($texinfolibdir)) {
-    if ('@USE_EXTERNAL_LIBINTL@' ne 'yes') {
-      unshift @INC, (File::Spec->catdir($lib_dir, 'lib', 'libintl-perl', 
'lib'));
-    }
-    if ('@USE_EXTERNAL_EASTASIANWIDTH@' ne 'yes') {
-      unshift @INC, (File::Spec->catdir($lib_dir, 'lib', 
'Unicode-EastAsianWidth', 'lib'));
+    # Use uninstalled modules
+
+    if (defined($ENV{'top_builddir'})) {
+      unshift @INC, File::Spec->catdir($ENV{'top_builddir'}, 'tp');
+    } else {
+      unshift @INC, File::Spec->catdir($command_directory, $updir, 'tp');
     }
-    if ('@USE_EXTERNAL_UNIDECODE@' ne 'yes') {
-      unshift @INC, (File::Spec->catdir($lib_dir, 'lib', 'Text-Unidecode', 
'lib'));
+
+    require Texinfo::ModulePath;
+    Texinfo::ModulePath::init(undef, undef, undef, 'updirs' => 1);
+  } else {
+    # Look for modules in their installed locations.
+    my $lib_dir = File::Spec->catdir($datadir, $package);
+    # look for package data in the installed location.
+    my $modules_pkgdatadir = $lib_dir;
+
+    # try to make package relocatable, will only work if
+    # standard relative paths are used
+    if (! -f File::Spec->catfile($lib_dir, 'Texinfo', 'Parser.pm')
+        and -f File::Spec->catfile($command_directory, $updir, 'share',
+                                   $package, 'Texinfo', 'Parser.pm')) {
+      $lib_dir = File::Spec->catdir($command_directory, $updir,
+                                          'share', $package);
+      $modules_pkgdatadir = File::Spec->catdir($command_directory, $updir,
+                                          'share', $package);
+      $xsdir = File::Spec->catdir($command_directory, $updir,
+                                          'lib', $package);
     }
+    unshift @INC, $lib_dir;
+
+    require Texinfo::ModulePath;
+    Texinfo::ModulePath::init($lib_dir, $xsdir, $modules_pkgdatadir,
+                              'installed' => 1);
   }
 }
 



reply via email to

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