texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Common.pm (%small_block_associated_c


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm (%small_block_associated_command), tp/Texinfo/Convert/HTML.pm, tp/init/highlight_syntax.pm: move %small_alias to Texinfo::Common and rename as %small_block_associated_command.
Date: Tue, 25 Jan 2022 07:40:11 -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 ddea7b6ced * tp/Texinfo/Common.pm (%small_block_associated_command), 
tp/Texinfo/Convert/HTML.pm, tp/init/highlight_syntax.pm: move %small_alias to 
Texinfo::Common and rename as %small_block_associated_command.
ddea7b6ced is described below

commit ddea7b6cedbec8ced46df90c99fc652529fa2ee7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jan 25 13:40:00 2022 +0100

    * tp/Texinfo/Common.pm (%small_block_associated_command),
    tp/Texinfo/Convert/HTML.pm, tp/init/highlight_syntax.pm:
    move %small_alias to Texinfo::Common and rename as
    %small_block_associated_command.
---
 ChangeLog                   |  8 ++++++++
 tp/TODO                     |  4 ----
 tp/Texinfo/Common.pm        | 10 ++++++++++
 tp/Texinfo/Convert/HTML.pm  | 34 +++++++++++++++-------------------
 tp/init/highlight_syntax.pm | 21 +++++++++++++--------
 5 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a61162c04c..de492d9460 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-01-25  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (%small_block_associated_command),
+       tp/Texinfo/Convert/HTML.pm, tp/init/highlight_syntax.pm:
+       move %small_alias to Texinfo::Common and rename as
+       %small_block_associated_command.
+
+
 2022-01-25  Patrice Dumas  <pertusus@free.fr>
 
        * doc/texinfo.texi (HTML Customization Variables),
diff --git a/tp/TODO b/tp/TODO
index 71e5654f25..9ed9c4a2b7 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -37,10 +37,6 @@ Some private variables/private state used in conversion
   $foot_num, %footnote_id_numbers
  _contents_inline_element
   %contents_command_element_type
- _convert_preformatted_command
- _convert_indented_command
- _convert_quotation_command
-  %small_alias
  _convert_printindex_command
   %formatted_index_entries
  _convert_menu_command
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index a5b0ae8c1a..5f3537d591 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -998,6 +998,11 @@ foreach my $unformatted_block_command ('ignore', 'macro', 
'rmacro') {
   $unformatted_block_commands{$unformatted_block_command} = 1;
 }
 
+our %small_block_associated_command;
+for my $cmd ('example', 'display', 'format', 'lisp', 'quotation',
+             'indentedblock') {
+  $small_block_associated_command{'small'.$cmd} = $cmd;
+};
 
 # commands that should only appear at the root level and contain up to
 # the next root command.  @node and sectioning commands.
@@ -2971,6 +2976,11 @@ C<@node> and sectioning commands, except heading 
commands.
 
 All the sectioning and heading commands.
 
+=item %small_block_associated_command
+
+Associate small command like C<smallexample> to the regular command
+C<example>.
+
 =item %style_commands
 
 Commands that mark a fragment of texinfo, like C<@strong>,
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 0ff8f1dff0..c3de314273 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -116,12 +116,7 @@ my %align_commands = %Texinfo::Common::align_commands;
 my %region_commands = %Texinfo::Common::region_commands;
 my %context_brace_commands = %Texinfo::Common::context_brace_commands;
 my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
-
-my %small_alias;
-for my $cmd ('example', 'display', 'format', 'lisp', 'quotation',
-             'indentedblock') {
-  $small_alias{'small'.$cmd} = $cmd;
-};
+my %small_block_associated_command = 
%Texinfo::Common::small_block_associated_command;
 
 foreach my $def_command (keys(%def_commands)) {
   $formatted_misc_commands{$def_command} = 1 if ($misc_commands{$def_command});
@@ -2006,8 +2001,9 @@ $preformatted_commands_context{'verbatim'} = 1;
 my %pre_class_commands;
 foreach my $preformatted_command (keys(%preformatted_commands_context)) {
   # no class for the @small* variants
-  if ($small_alias{$preformatted_command}) {
-    $pre_class_commands{$preformatted_command} = 
$small_alias{$preformatted_command};
+  if ($small_block_associated_command{$preformatted_command}) {
+    $pre_class_commands{$preformatted_command}
+      = $small_block_associated_command{$preformatted_command};
   } else {
     $pre_class_commands{$preformatted_command} = $preformatted_command;
   }
@@ -3750,8 +3746,8 @@ sub _convert_preformatted_command($$$$)
   # this is mainly for classes as there are purprosely no classes 
   # for small*
   my $main_cmdname;
-  if ($small_alias{$cmdname}) {
-    $main_cmdname = $small_alias{$cmdname};
+  if ($small_block_associated_command{$cmdname}) {
+    $main_cmdname = $small_block_associated_command{$cmdname};
     push @classes, $cmdname;
   } else {
     $main_cmdname = $cmdname;
@@ -3802,9 +3798,9 @@ sub _convert_indented_command($$$$)
   my @classes;
 
   my $main_cmdname;
-  if ($small_alias{$cmdname}) {
+  if ($small_block_associated_command{$cmdname}) {
     push @classes, $cmdname;
-    $main_cmdname = $small_alias{$cmdname};
+    $main_cmdname = $small_block_associated_command{$cmdname};
   } else {
     $main_cmdname = $cmdname;
   }
@@ -4232,9 +4228,9 @@ sub _convert_quotation_command($$$$$)
   my @classes;
 
   my $main_cmdname;
-  if ($small_alias{$cmdname}) {
+  if ($small_block_associated_command{$cmdname}) {
     push @classes, $cmdname;
-    $main_cmdname = $small_alias{$cmdname};
+    $main_cmdname = $small_block_associated_command{$cmdname};
   } else {
     $main_cmdname = $cmdname;
   }
@@ -5056,9 +5052,9 @@ foreach my $contents_comand (@contents_commands) {
 
 # associate same formatting function for @small* command
 # as for the associated @-command
-foreach my $small_command (keys(%small_alias)) {
+foreach my $small_command (keys(%small_block_associated_command)) {
   $default_commands_conversion{$small_command}
-    = $default_commands_conversion{$small_alias{$small_command}};
+    = 
$default_commands_conversion{$small_block_associated_command{$small_command}};
 }
 
 sub _open_quotation_command($$$)
@@ -5085,10 +5081,10 @@ $default_commands_open{'quotation'} = 
\&_open_quotation_command;
 
 # associate same opening function for @small* command
 # as for the associated @-command
-foreach my $small_command (keys(%small_alias)) {
-  if (exists($default_commands_open{$small_alias{$small_command}})) {
+foreach my $small_command (keys(%small_block_associated_command)) {
+  if 
(exists($default_commands_open{$small_block_associated_command{$small_command}}))
 {
     $default_commands_open{$small_command}
-      = $default_commands_open{$small_alias{$small_command}};
+      = 
$default_commands_open{$small_block_associated_command{$small_command}};
   }
 }
 
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 458821e8db..1cb0abc010 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -327,13 +327,21 @@ sub highlight_preformatted_command($$)
       # need to do all the formatting done for content inside
       # of @example as it is discarded.  So need to do the preformatted
       # type formatting, from _convert_preformatted_type() and 
_preformatted_class()
-      my $pre_class;
-      my @pre_classes = $self->preformatted_classes_stack();
       # since we are formatting @example itself, it is not in the preformatted
       # context anymore, so we readd.
-      # FIXME should be $pre_class_commands{$cmdname}, which is set using
-      # %small_alias.  Both are private.
-      push @pre_classes, $cmdname;
+      my @pre_classes = $self->preformatted_classes_stack();
+      # NOTE $pre_class_format is setup to match as 
$pre_class_commands{$cmdname}
+      # which is private
+      my $pre_class_format = $cmdname;
+      my $main_cmdname = $cmdname;
+      if (defined($Texinfo::Common::small_block_associated_command{$cmdname})) 
{
+        $pre_class_format
+          = $Texinfo::Common::small_block_associated_command{$cmdname};
+        $main_cmdname
+          = $Texinfo::Common::small_block_associated_command{$cmdname};
+      }
+      push @pre_classes, $pre_class_format;
+      my $pre_class;
       foreach my $class (@pre_classes) {
         # FIXME maybe add   or $pre_class eq 'menu'  to override
         # 'menu' with 'menu-comment'?
@@ -344,9 +352,6 @@ sub highlight_preformatted_command($$)
       }
       $pre_class = $pre_class.'-preformatted';
 
-      # TODO if needed, aliasing small variants could be done
-      # with the difficulty that the %small_alias hash is private
-      my $main_cmdname = $cmdname;
       # FIXME not clear on that.  What to do with @example arguments?
       my @classes;
       if ($cmdname eq 'example') {



reply via email to

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