texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Config.pm (texinfo_register_style_co


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Config.pm (texinfo_register_style_command_formatting), tp/init/html32.pm: use a separate argument for quotes and html element argument.
Date: Sun, 30 Jan 2022 10:15:09 -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 53c911c5a8 * tp/Texinfo/Config.pm 
(texinfo_register_style_command_formatting), tp/init/html32.pm: use a separate 
argument for quotes and html element argument.
53c911c5a8 is described below

commit 53c911c5a8889c73cfc10a12b876ae8124a9052a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 30 16:12:47 2022 +0100

    * tp/Texinfo/Config.pm (texinfo_register_style_command_formatting),
    tp/init/html32.pm: use a separate argument for quotes and
    html element argument.
    
    * tp/Texinfo/Convert/HTML.pm (%available_converter_info):
    add floats, global_commands and structuring.
    
    * tp/Texinfo/Convert/HTML.pm (_normalized_label_id_file):
    add converter as the first argument of 'label_target_name'
    user code reference call.
---
 ChangeLog                                 | 13 +++++++
 tp/Texinfo/Config.pm                      | 16 ++++++---
 tp/Texinfo/Convert/HTML.pm                | 58 +++++++++++++++++++------------
 tp/init/book.pm                           |  2 --
 tp/init/html32.pm                         |  2 +-
 tp/t/init/ignore_and_comments_output.init |  2 --
 tp/t/init/t2h_singular.init               |  6 ++--
 7 files changed, 62 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 387e9c2d18..c2007ff4ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-30  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Config.pm (texinfo_register_style_command_formatting),
+       tp/init/html32.pm: use a separate argument for quotes and
+       html element argument.
+
+       * tp/Texinfo/Convert/HTML.pm (%available_converter_info):
+       add floats, global_commands and structuring.
+
+       * tp/Texinfo/Convert/HTML.pm (_normalized_label_id_file): 
+       add converter as the first argument of 'label_target_name'
+       user code reference call.
+
 2022-01-28  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * info/info.c (info_short_help): Remove --show-options from
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index 099cf350b8..3aeab3b501 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -471,12 +471,11 @@ sub GNUT_get_no_arg_command_formatting($;$)
   return undef;
 }
 
-# the value should be a hash reference, possibly empty, with valid
-# keys 'attribute' and 'quote'.
-sub texinfo_register_style_command_formatting($$;$)
+sub texinfo_register_style_command_formatting($$;$$)
 {
   my $command = shift;
-  my $value = shift;
+  my $html_element = shift;
+  my $in_quotes = shift;
   my $context = shift;
 
   if (!defined($context)) {
@@ -486,7 +485,14 @@ sub texinfo_register_style_command_formatting($$;$)
                   'texinfo_register_style_command_formatting', $context));
     return 0;
   }
-  $GNUT_style_commands_formatting_info->{$context}->{$command} = $value;
+  my $specification = {};
+  if ($in_quotes) {
+    $specification->{'quotes'} = $in_quotes;
+  }
+  if (defined($html_element)) {
+    $specification->{'attribute'} = $html_element;
+  }
+  $GNUT_style_commands_formatting_info->{$context}->{$command} = 
$specification;
   return 1;
 }
 
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 0792f02477..f5d0d53885 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1494,12 +1494,16 @@ sub get_file_information($$;$)
 
 # information from converter available 'read-only', in general set up before
 # really starting the formatting (except for current_filename).
+# 'floats', 'global_commands' and 'structuring' are set up in the generic
+# converter
 my %available_converter_info;
 foreach my $converter_info ('copying_comment', 'current_filename',
    'destination_directory', 'document_name', 'documentdescription_string',
+   'floats', 'global_commands',
    'index_entries', 'index_entries_by_letter',
    'jslicenses', 'line_break_element', 'non_breaking_space', 
'paragraph_symbol',
-   'simpletitle_command_name', 'simpletitle_tree', 'title_string', 
'title_tree') {
+   'simpletitle_command_name', 'simpletitle_tree', 'structuring',
+   'title_string', 'title_tree') {
   $available_converter_info{$converter_info} = 1;
 }
 
@@ -3676,10 +3680,11 @@ sub _convert_heading_command($$$$$)
   $result .= $content if (defined($content));
 
   my $table_of_contents_was_output = 0.;
+  my $structuring = $self->get_info('structuring');
   if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_top'
       and $cmdname eq 'top'
-      and $self->{'structuring'} and 
$self->{'structuring'}->{'sectioning_root'}
-      and scalar(@{$self->{'structuring'}->{'sections_list'}}) > 1) {
+      and $structuring and $structuring->{'sectioning_root'}
+      and scalar(@{$structuring->{'sections_list'}}) > 1) {
     foreach my $content_command_name ('contents', 'shortcontents') {
       if ($self->get_conf($content_command_name)) {
         my $contents_text
@@ -4064,14 +4069,15 @@ sub _convert_insertcopying_command($$$$)
   my $cmdname = shift;
   my $command = shift;
 
-  if ($self->{'global_commands'} and $self->{'global_commands'}->{'copying'}) {
-    return $self->convert_tree({'contents' 
-               => $self->{'global_commands'}->{'copying'}->{'contents'}},
+  my $global_commands = $self->get_info('global_commands');
+  if ($global_commands and $global_commands->{'copying'}) {
+    return $self->convert_tree({'contents'
+               => $global_commands->{'copying'}->{'contents'}},
                                'convert insertcopying');
   }
   return '';
 }
-$default_commands_conversion{'insertcopying'} 
+$default_commands_conversion{'insertcopying'}
    = \&_convert_insertcopying_command;
 
 sub _convert_listoffloats_command($$$$)
@@ -4081,15 +4087,16 @@ sub _convert_listoffloats_command($$$$)
   my $command = shift;
   my $args = shift;
 
+  my $floats = $self->get_info('floats');
   if (!$self->in_string()
       and $command->{'extra'} and $command->{'extra'}->{'type'}
       and defined($command->{'extra'}->{'type'}->{'normalized'})
-      and $self->{'floats'}
-      and $self->{'floats'}->{$command->{'extra'}->{'type'}->{'normalized'}}
-      and 
@{$self->{'floats'}->{$command->{'extra'}->{'type'}->{'normalized'}}}) { 
+      and $floats
+      and $floats->{$command->{'extra'}->{'type'}->{'normalized'}}
+      and @{$floats->{$command->{'extra'}->{'type'}->{'normalized'}}}) {
     my $listoffloats_name = $command->{'extra'}->{'type'}->{'normalized'};
     my $result = $self->html_attribute_class('dl', [$cmdname]).">\n" ;
-    foreach my $float (@{$self->{'floats'}->{$listoffloats_name}}) {
+    foreach my $float (@{$floats->{$listoffloats_name}}) {
       my $float_href = $self->command_href($float);
       next if (!$float_href);
       $result .= '<dt>';
@@ -4207,7 +4214,7 @@ sub _convert_float_command($$$$$)
     my $caption_text = '';
     if ($caption) {
       $caption_text = $self->convert_tree_new_formatting_context(
-        {'contents' => $caption->{'args'}->[0]->{'contents'}}, 
+        {'contents' => $caption->{'args'}->[0]->{'contents'}},
         'float caption');
     }
     return $prepended.$content.$caption_text;
@@ -5082,11 +5089,12 @@ sub _convert_contents_command
 
   Texinfo::Common::set_informative_command_value($self, $command);
 
+  my $structuring = $self->get_info('structuring');
   if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'inline'
       and ($cmdname eq 'contents' or $cmdname eq 'shortcontents')
       and $self->get_conf($cmdname)
-      and $self->{'structuring'} and 
$self->{'structuring'}->{'sectioning_root'}
-      and scalar(@{$self->{'structuring'}->{'sections_list'}}) > 1) {
+      and $structuring and $structuring->{'sectioning_root'}
+      and scalar(@{$structuring->{'sections_list'}}) > 1) {
     return $self->_contents_inline_element($cmdname, $command);
   }
   return '';
@@ -6027,8 +6035,9 @@ sub _contents_shortcontents_in_title($)
 
   my $result = '';
 
-  if ($self->{'structuring'} and $self->{'structuring'}->{'sectioning_root'}
-      and scalar(@{$self->{'structuring'}->{'sections_list'}}) > 1
+  my $structuring = $self->get_info('structuring');
+  if ($structuring and $structuring->{'sectioning_root'}
+      and scalar(@{$structuring->{'sections_list'}}) > 1
       and $self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_title') {
     foreach my $command ('contents', 'shortcontents') {
       if ($self->get_conf($command)) {
@@ -6048,9 +6057,10 @@ sub _default_format_titlepage($)
   my $self = shift;
 
   my $titlepage_text;
-  if ($self->{'global_commands'}->{'titlepage'}) {
+  my $global_commands = $self->get_info('global_commands');
+  if ($global_commands->{'titlepage'}) {
     $titlepage_text = $self->convert_tree({'contents'
-               => $self->{'global_commands'}->{'titlepage'}->{'contents'}},
+               => $global_commands->{'titlepage'}->{'contents'}},
                                           'convert titlepage');
   } else {
     my $simpletitle_tree = $self->get_info('simpletitle_tree');
@@ -6306,7 +6316,7 @@ sub _default_format_element_footer($$$$)
 # is not done within the document formatting flow, but the formatted
 # output may still end up in the document.  In particular for
 # command_text() which caches its computations.
-sub _new_document_context($$;$)
+sub _new_document_context($;$$)
 {
   my $self = shift;
   my $cmdname = shift;
@@ -7211,7 +7221,7 @@ sub _normalized_label_id_file($$)
   }
   # to find out the Top node, one could check $label_info->{'normalized'}
   if (defined($self->{'file_id_setting'}->{'label_target_name'})) {
-    $target = &{$self->{'file_id_setting'}->{'label_target_name'}}(
+    $target = &{$self->{'file_id_setting'}->{'label_target_name'}}($self,
                                                        $label_info, $target);
   }
 
@@ -8155,10 +8165,11 @@ sub _default_format_contents($$;$$)
 
   $filename = $self->get_info('current_filename') if (!defined($filename));
 
+  my $structuring = $self->get_info('structuring');
   return ''
-   if (!$self->{'structuring'} or 
!$self->{'structuring'}->{'sectioning_root'});
+   if (!$structuring or !$structuring->{'sectioning_root'});
 
-  my $section_root = $self->{'structuring'}->{'sectioning_root'};
+  my $section_root = $structuring->{'sectioning_root'};
   my $contents;
   $contents = 1 if ($cmdname eq 'contents');
 
@@ -8963,8 +8974,9 @@ EOT
 sub _has_contents_or_shortcontents($)
 {
   my $self = shift;
+  my $global_commands = $self->get_info('global_commands');
   foreach my $cmdname ('contents', 'shortcontents') {
-    if ($self->{'global_commands'} and $self->{'global_commands'}->{$cmdname}) 
{
+    if ($global_commands and $global_commands->{$cmdname}) {
       return 1;
     }
   }
diff --git a/tp/init/book.pm b/tp/init/book.pm
index 01b3f6ced2..09812a2584 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -21,8 +21,6 @@
 
 use strict;
 
-use vars qw($element_file_name);
-
 use Texinfo::Common;
 use Texinfo::Convert::Texinfo;
 use Texinfo::Structuring;
diff --git a/tp/init/html32.pm b/tp/init/html32.pm
index e38c08245a..48ea4009cd 100644
--- a/tp/init/html32.pm
+++ b/tp/init/html32.pm
@@ -90,7 +90,7 @@ foreach my $dots ('dots') {
 
 foreach my $context ('preformatted', 'normal') {
   foreach my $command('sansserif', 'r') {
-    texinfo_register_style_command_formatting($command, {}, $context);
+    texinfo_register_style_command_formatting($command, undef, undef, 
$context);
   }
 }
 
diff --git a/tp/t/init/ignore_and_comments_output.init 
b/tp/t/init/ignore_and_comments_output.init
index 4f79e44972..4abaaec686 100644
--- a/tp/t/init/ignore_and_comments_output.init
+++ b/tp/t/init/ignore_and_comments_output.init
@@ -1,7 +1,5 @@
 use strict;
 
-use vars qw(%commands_conversion);
-
 sub convert_comment_command($$$)
 {
   my $self = shift;
diff --git a/tp/t/init/t2h_singular.init b/tp/t/init/t2h_singular.init
index b61a07950e..df5e5f9617 100644
--- a/tp/t/init/t2h_singular.init
+++ b/tp/t/init/t2h_singular.init
@@ -6,8 +6,6 @@
 
 use strict;
 
-use vars qw($node_file_name);
-
 my $T2H_BLUE_BUTTONS = 0;
 
 # we only redefine things which ar of relevance to singular
@@ -63,11 +61,11 @@ sub singular_format_footer($$$$)
 
 
   my $end_page = (!$element->{'structure'}->{'unit_next'}
-   # FIXME API
    or (defined($element->{'structure'}->{'unit_filename'})
        and $element->{'structure'}->{'unit_filename'}
            ne 
$element->{'structure'}->{'unit_next'}->{'structure'}->{'unit_filename'}
-       and 
$self->{'file_counters'}->{$element->{'structure'}->{'unit_filename'}} == 1));
+       and $self->count_elements_in_filename('current',
+                   $element->{'structure'}->{'unit_filename'}) == 1));
 
   if ($self->element_is_tree_unit_top($element)) {
     my $buttons = $self->get_conf('TOP_BUTTONS');



reply via email to

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