texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Common structure for non metasyntactic only argum


From: Patrice Dumas
Subject: branch master updated: Common structure for non metasyntactic only argument def commands
Date: Mon, 01 Aug 2022 06:32:40 -0400

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 5b713c2364 Common structure for non metasyntactic only argument def 
commands
5b713c2364 is described below

commit 5b713c23647c6649c2590e303febb3cb246e935f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Aug 1 12:32:09 2022 +0200

    Common structure for non metasyntactic only argument def commands
    
    * tp/Texinfo/Common.pm (%def_no_var_arg_commands),
    tp/Texinfo/Convert/HTML.pm (_convert_def_line_type),
    tp/Texinfo/Convert/LaTeX.pm (_convert): setup %def_no_var_arg_commands
    for @def* commands with non metasyntactic variables only
    argument.
---
 ChangeLog                   | 10 ++++++++++
 tp/Texinfo/Common.pm        | 12 ++++++++++++
 tp/Texinfo/Convert/HTML.pm  | 12 ++++--------
 tp/Texinfo/Convert/LaTeX.pm |  6 +-----
 4 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d8fc01653..8fa5a6e874 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-07-31  Patrice Dumas  <pertusus@free.fr>
+
+       Common structure for non metasyntactic only argument def commands
+
+       * tp/Texinfo/Common.pm (%def_no_var_arg_commands),
+       tp/Texinfo/Convert/HTML.pm (_convert_def_line_type),
+       tp/Texinfo/Convert/LaTeX.pm (_convert): setup %def_no_var_arg_commands
+       for @def* commands with non metasyntactic variables only
+       argument.
+
 2022-07-31  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_def_line_type): remove
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index a58ee53a63..379ee98e19 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -870,6 +870,8 @@ foreach my $index_type (keys %index_type_def) {
 
 our %def_commands;
 our %def_aliases;
+# Argument not metasyntactic variables only.
+our %def_no_var_arg_commands;
 foreach my $def_command(keys %def_map) {
   if (ref($def_map{$def_command}) eq 'HASH') {
     my ($real_command) = keys (%{$def_map{$def_command}});
@@ -882,6 +884,7 @@ foreach my $def_command(keys %def_map) {
   $def_commands{$def_command} = 1;
   $def_commands{$def_command.'x'} = 1;
   $command_index{$def_command.'x'} = $command_index{$def_command};
+  $def_no_var_arg_commands{$def_command} = 1 if ($def_command =~ /^deftype/);
 }
 
 $block_commands{'multitable'} = 'multitable';
@@ -2953,12 +2956,21 @@ whose argument is outside of the main text flow in one 
way or another.
 =item %def_commands
 
 =item %def_aliases
+
+=item %def_no_var_arg_commands
 X<C<%def_commands>>
 X<C<%def_aliases>>
+X<C<%def_no_var_arg_commands>>
 
 Definition commands.  C<%def_aliases> associates an aliased command
 to the original command, for example C<defun> is associated to C<deffn>.
 
+C<%def_no_var_arg_commands> associates a definition command name with
+a true value if the I<argument> on the definition command line can contain
+non-metasyntactic variables.  For instance, it is true for C<deftypevr>
+but false for C<defun>, since C<@defun> I<argument> is supposed to contain
+metasyntactic variables only.
+
 =item %default_index_commands
 X<C<%default_index_commands>>
 
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index e7cda05d87..8cb50ee917 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5916,12 +5916,8 @@ sub _convert_def_line_type($$$$)
     } else {
       $name = '';
     }
-    # metasyntactic argument
-    if ($command_name eq 'deffn'
-        or $command_name eq 'defvr'
-        or $command_name eq 'deftp'
-        or $command_name eq 'defop'
-        or $command_name eq 'defcv') {
+    # only metasyntactic variable arguments (deffn, defvr, deftp, defop, defcv)
+    if (not $Texinfo::Common::def_no_var_arg_commands{$command_name}) {
       if ($arguments) {
         $tree = $self->gdt("\@code{{name}} \@r{\@slanted{{arguments}}}", {
                 'name' => $name,
@@ -5929,8 +5925,8 @@ sub _convert_def_line_type($$$$)
       } else {
         $tree = $self->gdt("\@code{{name}}", {'name' => $name});
       }
-    # starting here, arguments not metasyntactic:
-    #   deftypefn, deftypevr, deftypeop, deftypecv
+    # arguments not only metasyntactic variables
+    # (deftypefn, deftypevr, deftypeop, deftypecv)
     } else {
       if (!$element->{'extra'}->{'def_parsed_hash'}->{'type'}) {
         if ($arguments) {
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 770fbdc8c0..4fd1f5b030 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -272,12 +272,8 @@ foreach my $kept_command (keys(%informative_commands),
   $formatted_misc_commands{$kept_command} = 1;
 }
 
-# def commands with types.  Argument not considered to consist in
-# metasyntactic variables.
-my %deftype_commands = ();
 foreach my $def_command (keys(%def_commands)) {
   $formatted_misc_commands{$def_command} = 1 if ($misc_commands{$def_command});
-  $deftype_commands{$def_command} = 1 if ($def_command =~ /^deftype/);
 }
 
 # There are stacks that define the context.
@@ -3568,7 +3564,7 @@ sub _convert($$)
         my $known_embrac_commands;
         if ($arguments) {
           $result .= $def_space;
-          if ($deftype_commands{$command}) {
+          if ($Texinfo::Common::def_no_var_arg_commands{$command}) {
             $result .= _convert($self, {'contents' => $arguments});
           } else {
             $self->{'packages'}->{'embrac'} = 1;



reply via email to

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