texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Tue, 1 Oct 2024 14:38:27 -0400 (EDT)

branch: master
commit 34aaf84b25a7f499754c0d364bbf252163733282
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jul 28 01:00:01 2024 +0200

    Use CSV files to store data relevant for Perl and C
    
    * tp/Texinfo/Data/default_css_element_class_styles.csv,
    tp/Texinfo/Data/default_direction_strings.csv,
    tp/Texinfo/Data/default_special_unit_info.csv,
    tp/Texinfo/Data/html_style_commands_element.csv,
    tp/maintain/generate_convert_data_perl_code.pl, tp/Makefile.am
    (dist_modules_DATA, dist_noinst_DATA, maintenance_files)
    (Texinfo/Data.pm), tp/Texinfo/Convert/HTML.pm: move
    %default_special_unit_info, %default_translated_special_unit_info,
    %default_converted_directions_strings,
    %default_translated_directions_strings,
    %default_css_element_class_styles and %style_commands_element to CSV
    files separated by | in tp/Texinfo/Data/.  Add
    maintain/generate_convert_data_perl_code.pl to generate Perl data
    in Texinfo/Data.pm based on the CSV files data.
---
 ChangeLog                                          |  19 +
 tp/Makefile.am                                     |  11 +-
 tp/TODO                                            |   7 +-
 tp/Texinfo/Convert/HTML.pm                         | 397 +--------------------
 tp/Texinfo/Data.pm                                 | 323 +++++++++++++++++
 .../Data/default_css_element_class_styles.csv      |  51 +++
 tp/Texinfo/Data/default_direction_strings.csv      |  24 ++
 tp/Texinfo/Data/default_special_unit_info.csv      |   5 +
 tp/Texinfo/Data/html_style_commands_element.csv    |  26 ++
 tp/maintain/generate_convert_data_perl_code.pl     | 375 +++++++++++++++++++
 10 files changed, 854 insertions(+), 384 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index edfc6c4907..9f3b50e182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,25 @@
        * doc/texinfo.texi (HTML Xref Configuration): edit description
        of splitting search order.
 
+2024-07-27  Patrice Dumas  <pertusus@free.fr>
+
+       Use CSV files to store data relevant for Perl and C
+
+       * tp/Texinfo/Data/default_css_element_class_styles.csv,
+       tp/Texinfo/Data/default_direction_strings.csv,
+       tp/Texinfo/Data/default_special_unit_info.csv,
+       tp/Texinfo/Data/html_style_commands_element.csv,
+       tp/maintain/generate_convert_data_perl_code.pl, tp/Makefile.am
+       (dist_modules_DATA, dist_noinst_DATA, maintenance_files)
+       (Texinfo/Data.pm), tp/Texinfo/Convert/HTML.pm: move
+       %default_special_unit_info, %default_translated_special_unit_info,
+       %default_converted_directions_strings,
+       %default_translated_directions_strings,
+       %default_css_element_class_styles and %style_commands_element to CSV
+       files separated by | in tp/Texinfo/Data/.  Add
+       maintain/generate_convert_data_perl_code.pl to generate Perl data
+       in Texinfo/Data.pm based on the CSV files data.
+
 2024-07-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (html_get_css_elements_classes)
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 058d0b8606..7be3896b62 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -70,6 +70,7 @@ dist_modules_DATA = \
  Texinfo/Common.pm \
  Texinfo/Commands.pod \
  Texinfo/Commands.pm \
+ Texinfo/Data.pm \
  Texinfo/DebugTree.pm \
  Texinfo/Document.pm \
  Texinfo/DocumentXS.pm \
@@ -91,7 +92,11 @@ dist_modules_DATA = \
  Texinfo/XSLoader.pm
 
 dist_noinst_DATA = \
- Texinfo/ModulePath.pm.in
+ Texinfo/ModulePath.pm.in \
+ Texinfo/Data/default_css_element_class_styles.csv \
+ Texinfo/Data/default_direction_strings.csv \
+ Texinfo/Data/default_special_unit_info.csv \
+ Texinfo/Data/html_style_commands_element.csv
 
 modules_DATA = \
  Texinfo/ModulePath.pm
@@ -324,6 +329,7 @@ maintenance_files = \
   maintain/change_perl_modules_version.sh \
   maintain/copy_change_file_name_encoding.pl \
   maintain/language-subtag-registry \
+  maintain/generate_convert_data_perl_code.pl \
   maintain/regenerate_cmd_tests.sh \
   maintain/regenerate_converters_documentation.sh \
   maintain/regenerate_docstr.sh \
@@ -379,6 +385,9 @@ $(srcdir)/Texinfo/Commands.pm: Texinfo/command_data.txt 
$(srcdir)/maintain/regen
 $(srcdir)/Texinfo/Options.pm: Texinfo/options_data.txt 
$(srcdir)/maintain/regenerate_perl_options_info.pl
        $(srcdir)/maintain/regenerate_perl_options_info.pl 
$(srcdir)/Texinfo/Options.pm < $(srcdir)/Texinfo/options_data.txt
 
+$(srcdir)/Texinfo/Data.pm: Texinfo/Data/default_css_element_class_styles.csv 
Texinfo/Data/default_direction_strings.csv 
Texinfo/Data/default_special_unit_info.csv 
Texinfo/Data/html_style_commands_element.csv 
$(srcdir)/maintain/generate_convert_data_perl_code.pl
+       $(srcdir)/maintain/generate_convert_data_perl_code.pl 
$(srcdir)/Texinfo/Data/default_css_element_class_styles.csv 
$(srcdir)/Texinfo/Data/default_direction_strings.csv 
$(srcdir)/Texinfo/Data/default_special_unit_info.csv 
$(srcdir)/Texinfo/Data/html_style_commands_element.csv $@
+
 libsrcdir = $(srcdir)/maintain/lib
 
 install-data-local:
diff --git a/tp/TODO b/tp/TODO
index c5e1a4b162..34a652d3b7 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,7 +10,12 @@ This is the todo list for texi2any
 Before next release
 ===================
 
-free stage_handlers structure in html converter in C
+HTML data
+%defaults
+
+to check
+%quoted_style_commands
+%default_upper_case_commands
 
 Bugs
 ====
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 63dacf5a20..30c776c541 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -65,6 +65,7 @@ use Texinfo::XSLoader;
 
 use Texinfo::Commands;
 use Texinfo::Common;
+use Texinfo::Data;
 use Texinfo::Config;
 use Texinfo::Convert::Unicode;
 use Texinfo::Convert::Texinfo;
@@ -2603,59 +2604,12 @@ foreach my $buttons ('CHAPTER_FOOTER_BUTTONS', 
'TOP_FOOTER_BUTTONS') {
 }
 
 
-my %default_special_unit_info = (
+my %default_special_unit_info
+  = %{ Texinfo::Data::get_default_special_unit_info() };
 
-  'class' => {
-    'about'       => 'about',
-    'contents'    => 'contents',
-    'shortcontents'    => 'shortcontents',
-    'footnotes'   => 'footnotes',
-  },
-
-  'direction' => {
-     'about'       => 'About',
-     'contents'    => 'Contents',
-     'shortcontents'    => 'Overview',
-     'footnotes'   => 'Footnotes',
-   },
-
-   'order' => {
-     'contents' => 30,
-     'shortcontents' => 20,
-     'footnotes' => 10,
-     'about' => 40,
-   },
-
-   'file_string' => {
-     'contents' => '_toc',
-     'shortcontents' => '_ovr',
-     'footnotes' => '_fot',
-     'about' => '_abt',
-   },
-
-   'target' => {
-     'shortcontents' => 'SEC_Shortcontents',
-     'contents' => 'SEC_Contents',
-     'footnotes' => 'SEC_Footnotes',
-     'about' => 'SEC_About',
-   },
-);
-
-# translation context should be consistent with special_unit_info()
-%default_translated_special_unit_info = (
-
-   'heading' => {
-     'about'       => Texinfo::Common::pgdt('about section heading',
-                                            'About This Document'),
-     'contents'    => Texinfo::Common::pgdt('contents section heading',
-                                            'Table of Contents'),
-     'shortcontents' => Texinfo::Common::pgdt(
-                                           'shortcontents section heading',
-                                           'Short Table of Contents'),
-     'footnotes'   => Texinfo::Common::pgdt('footnotes section heading',
-                                            'Footnotes'),
-   },
-);
+# TODO translation context should be consistent with special_unit_info()
+%default_translated_special_unit_info
+  = %{ Texinfo::Data::get_default_translated_special_unit_info() };
 
 # to be kept in the same order as C code HTML_GLOBAL_DIRECTIONS_LIST.
 my @global_directions = ('First', 'Top', 'Index', 'Last');
@@ -2668,246 +2622,16 @@ foreach my $special_direction (values(
   $global_and_special_directions{$special_direction} = 1;
 }
 
-my %default_converted_directions_strings = (
-
-  # see http://www.w3.org/TR/REC-html40/types.html#type-links
-  'rel' =>
-   {
-     'Top',         'start',
-     'Contents',    'contents',
-     'Overview',    '',
-     'Index',       'index',
-     'This',        '',
-     'Back',        'prev',
-     'FastBack',    '',
-     'Prev',        'prev',
-     'Up',          'up',
-     'Next',        'next',
-     'NodeUp',      'up',
-     'NodeNext',    'next',
-     'NodePrev',    'prev',
-     'NodeForward', '',
-     'NodeBack',    '',
-     'Forward',     'next',
-     'FastForward', '',
-     'About' ,      'help',
-     'First',       '',
-     'Last',        '',
-     'NextFile',    'next',
-     'PrevFile',    'prev',
-   },
-
-  'accesskey' =>
-   {
-     'Top',         '',
-     # this direction is set undef to make sure that it does not break
-     # any code.
-     #'Contents',    '',
-     'Overview',    '',
-     'Index',       '',
-     'This',        '',
-     'Back',        'p',
-     'FastBack',    '',
-     'Prev',        'p',
-     'Up',          'u',
-     'Next',        'n',
-     'NodeUp',      'u',
-     'NodeNext',    'n',
-     'NodePrev',    'p',
-     'NodeForward', '',
-     'NodeBack',    '',
-     'Forward',     'n',
-     'FastForward', '',
-     'About' ,      '',
-     'First',       '',
-     'Last',        '',
-     'NextFile',    '',
-     'PrevFile',    '',
-   },
-
-  'example' =>
-   {
-     'Top',         ' '.$html_default_entity_nbsp.' ',
-     'Contents',    ' '.$html_default_entity_nbsp.' ',
-     'Overview',    ' '.$html_default_entity_nbsp.' ',
-     'Index',       ' '.$html_default_entity_nbsp.' ',
-     'This',        '1.2.3',
-     'Back',        '1.2.2',
-     'FastBack',    '1',
-     'Prev',        '1.2.2',
-     'Up',          '1.2',
-     'Next',        '1.2.4',
-     'NodeUp',      '1.2',
-     'NodeNext',    '1.2.4',
-     'NodePrev',    '1.2.2',
-     'NodeForward', '1.2.4',
-     'NodeBack',    '1.2.2',
-     'Forward',     '1.2.4',
-     'FastForward', '2',
-     'About',       ' '.$html_default_entity_nbsp.' ',
-     'First',       '1.',
-     'Last',        '1.2.4',
-     'NextFile',    ' '.$html_default_entity_nbsp.' ',
-     'PrevFile',    ' '.$html_default_entity_nbsp.' ',
-   },
-);
+# for rel, see http://www.w3.org/TR/REC-html40/types.html#type-links
+my %default_converted_directions_strings
+  = %{ Texinfo::Data::get_default_converted_directions_strings() };
 
 # translation contexts should be consistent with
 # %direction_type_translation_context.  If the direction is not used
 # as is, it should also be taken into account in direction_string().
 # For now 'This' becomes 'This (current section)'.
-my %default_translated_directions_strings = (
-  'text' => {
-     ' ' =>           {'converted' => ' '.$html_default_entity_nbsp.' '},
-     'Top' =>         {'to_convert'
-        => Texinfo::Common::pgdt('Top direction string', 'Top')},
-     'Contents' =>    {'to_convert'
-        => Texinfo::Common::pgdt('Contents direction string', 'Contents')},
-     'Overview' =>    {'to_convert'
-        => Texinfo::Common::pgdt(
-                          'Overview direction string', 'Overview')},
-     'Index' =>       {'to_convert'
-        => Texinfo::Common::pgdt('Index direction string', 'Index')},
-     'This' =>        {'to_convert'
-        => Texinfo::Common::pgdt('This (current section) direction string',
-                                 'current')},
-     'Back' =>        {'converted' => ' &lt; '},
-     'FastBack' =>    {'converted' => ' &lt;&lt; '},
-     'Prev' =>        {'to_convert'
-        => Texinfo::Common::pgdt('Prev direction string', 'Prev')},
-     'Up' =>          {'to_convert'
-        => Texinfo::Common::pgdt('Up direction string', ' Up ')},
-     'Next' =>        {'to_convert'
-        => Texinfo::Common::pgdt('Next direction string', 'Next')},
-     'NodeUp' =>      {'to_convert'
-        => Texinfo::Common::pgdt('NodeUp direction string', 'Up')},
-     'NodeNext' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NodeNext direction string', 'Next')},
-     'NodePrev' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NodePrev direction string', 'Previous')},
-     'NodeForward' => {'to_convert'
-        => Texinfo::Common::pgdt('NodeForward direction string', 'Forward 
node')},
-     'NodeBack' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NodeBack direction string', 'Back node')},
-     'Forward' =>     {'converted' => ' &gt; '},
-     'FastForward' => {'converted' => ' &gt;&gt; '},
-     'About' =>       {'converted' => ' ? '},
-     'First' =>       {'converted' => ' |&lt; '},
-     'Last' =>        {'converted' => ' &gt;| '},
-     'NextFile' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NextFile direction string', 'Next file')},
-     'PrevFile' =>    {'to_convert'
-        => Texinfo::Common::pgdt('PrevFile direction string', 'Previous 
file')},
-  },
-
-  'description' => {
-     'Top' =>         {'to_convert' => Texinfo::Common::pgdt(
-                      'Top direction description', 'Cover (top) of document')},
-     'Contents' =>    {'to_convert' => Texinfo::Common::pgdt(
-                                            'Contents direction description',
-                                            'Table of contents')},
-     'Overview' =>    {'to_convert' => Texinfo::Common::pgdt(
-                                              'Overview direction description',
-                                              'Short table of contents')},
-     'Index' =>       {'to_convert' => Texinfo::Common::pgdt(
-                                       'Index direction description', 
'Index')},
-     'This' =>        {'to_convert' => Texinfo::Common::pgdt(
-                                 'This (current section) direction 
description',
-                                 'Current section')},
-     'Back' =>        {'to_convert' => Texinfo::Common::pgdt(
-                                        'Back direction description',
-                                        'Previous section in reading order')},
-     'FastBack' =>    {'to_convert' => Texinfo::Common::pgdt(
-                              'FastBack direction description',
-                              'Beginning of this chapter or previous 
chapter')},
-     'Prev' =>        {'to_convert' => Texinfo::Common::pgdt(
-                                          'Prev direction description',
-                                          'Previous section on same level')},
-     'Up' =>          {'to_convert' => Texinfo::Common::pgdt(
-                            'Up direction description', 'Up section')},
-     'Next' =>        {'to_convert' => Texinfo::Common::pgdt(
-                    'Next direction description', 'Next section on same 
level')},
-     'NodeUp' =>      {'to_convert' => Texinfo::Common::pgdt(
-                                   'NodeUp direction description', 'Up node')},
-     'NodeNext' =>    {'to_convert' => Texinfo::Common::pgdt(
-                               'NodeNext direction description', 'Next node')},
-     'NodePrev' =>    {'to_convert' => Texinfo::Common::pgdt(
-                            'NodePrev direction description', 'Previous 
node')},
-     'NodeForward' => {'to_convert' => Texinfo::Common::pgdt(
-                                           'NodeForward direction description',
-                                           'Next node in node reading order')},
-     'NodeBack' =>    {'to_convert' => Texinfo::Common::pgdt(
-                                        'NodeBack direction description',
-                                        'Previous node in node reading 
order')},
-     'Forward' =>     {'to_convert' => Texinfo::Common::pgdt(
-                                               'Forward direction description',
-                                               'Next section in reading 
order')},
-     'FastForward' => {'to_convert' => Texinfo::Common::pgdt(
-                            'FastForward direction description', 'Next 
chapter')},
-     'About'  =>      {'to_convert' => Texinfo::Common::pgdt(
-                            'About direction description', 'About (help)')},
-     'First' =>       {'to_convert' => Texinfo::Common::pgdt(
-                                          'First direction description',
-                                          'First section in reading order')},
-     'Last' =>        {'to_convert' => Texinfo::Common::pgdt(
-                                            'Last direction description',
-                                            'Last section in reading order')},
-     'NextFile' =>    {'to_convert' => Texinfo::Common::pgdt(
-                                             'NextFile direction description',
-                                             'Forward section in next file')},
-     'PrevFile' =>    {'to_convert' => Texinfo::Common::pgdt(
-                                             'PrevFile direction description',
-                                             'Back section in previous file')},
-  },
-
-  'button' => {
-     ' ' =>           {'converted' => ' '},
-     'Top' =>         {'to_convert'
-        => Texinfo::Common::pgdt('Top direction button label', 'Top')},
-     'Contents' =>    {'to_convert'
-        => Texinfo::Common::pgdt('Contents direction button label', 
'Contents')},
-     'Overview' =>    {'to_convert'
-        => Texinfo::Common::pgdt('Overview direction button label', 
'Overview')},
-     'Index' =>       {'to_convert'
-        => Texinfo::Common::pgdt('Index direction button label', 'Index')},
-     'This' =>        {'to_convert'
-        => Texinfo::Common::pgdt('This direction button label', 'This')},
-     'Back' =>        {'to_convert'
-        => Texinfo::Common::pgdt('Back direction button label', 'Back')},
-     'FastBack' =>    {'to_convert'
-        => Texinfo::Common::pgdt('FastBack direction button label', 
'FastBack')},
-     'Prev' =>        {'to_convert'
-        => Texinfo::Common::pgdt('Prev direction button label', 'Prev')},
-     'Up' =>          {'to_convert'
-        => Texinfo::Common::pgdt('Up direction button label', 'Up')},
-     'Next' =>        {'to_convert'
-        => Texinfo::Common::pgdt('Next direction button label', 'Next')},
-     'NodeUp' =>      {'to_convert'
-        => Texinfo::Common::pgdt('NodeUp direction button label', 'NodeUp')},
-     'NodeNext' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NodeNext direction button label', 
'NodeNext')},
-     'NodePrev' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NodePrev direction button label', 
'NodePrev')},
-     'NodeForward' => {'to_convert'
-        => Texinfo::Common::pgdt('NodeForward direction button label', 
'NodeForward')},
-     'NodeBack' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NodeBack direction button label', 
'NodeBack')},
-     'Forward' =>     {'to_convert'
-        => Texinfo::Common::pgdt('Forward direction button label', 'Forward')},
-     'FastForward' => {'to_convert'
-        => Texinfo::Common::pgdt('FastForward direction button label', 
'FastForward')},
-     'About' =>       {'to_convert'
-        => Texinfo::Common::pgdt('About direction button label', 'About')},
-     'First' =>       {'to_convert'
-        => Texinfo::Common::pgdt('First direction button label', 'First')},
-     'Last' =>        {'to_convert'
-        => Texinfo::Common::pgdt('Last direction button label', 'Last')},
-     'NextFile' =>    {'to_convert'
-        => Texinfo::Common::pgdt('NextFile direction button label', 
'NextFile')},
-     'PrevFile' =>    {'to_convert'
-        => Texinfo::Common::pgdt('PrevFile direction button label', 
'PrevFile')},
-  }
-);
+my %default_translated_directions_strings
+   = %{ Texinfo::Data::get_default_translated_directions_strings() };
 
 sub _translate_names($)
 {
@@ -3050,71 +2774,8 @@ sub converter_defaults($$)
   return %defaults;
 }
 
-my %default_css_element_class_styles = (
-     'ul.toc-numbered-mark'   => 'list-style: none',
-     'pre.menu-comment-preformatted' => 'font-family: serif',
-     # using display: inline is an attempt to avoid a line break when in
-     # preformatted in menu.  In 2022 it does not seems to work in firefox,
-     # there is still a line break.
-     'pre.menu-entry-description-preformatted' => 'font-family: serif; 
display: inline',
-     'pre.menu-preformatted'  => 'font-family: serif',
-     'a.summary-letter-printindex'  => 'text-decoration: none',
-     'pre.display-preformatted'     => 'font-family: inherit',
-     # 'display: flex; justify-content: center' centers the pre as a whole
-     'pre.displaymath'
-           => 'font-style: italic; font-family: serif; display: flex; 
justify-content: center',
-     'table.cartouche'    => 'border-style: solid; border-radius: 0.5em',
-     'span.program-in-footer' => 'font-size: smaller', # used with 
PROGRAM_NAME_IN_FOOTER
-     'span.sansserif'     => 'font-family: sans-serif; font-weight: normal',
-     'span.r'             => 'font-family: initial; font-weight: normal; 
font-style: normal',
-     'td.index-entry-level-1'  => 'padding-left: 1.5em',
-     'td.index-entry-level-2'  => 'padding-left: 3.0em',
-     'kbd.key'            => 'font-style: normal',
-     'kbd.kbd'            => 'font-style: oblique',
-     'strong.def-name'    => 'font-family: monospace; font-weight: bold; '
-                            .'font-size: larger',
-     'p.flushleft-paragraph'   => 'text-align:left',
-     'p.flushright-paragraph'  => 'text-align:right',
-     'h1.centerchap'      => 'text-align:center',
-     'h2.centerchap'      => 'text-align:center',
-     'h3.centerchap'      => 'text-align:center',
-     'h1.settitle'        => 'text-align:center',
-     'h1.shorttitlepage'  => 'text-align:center',
-     'h3.subtitle'        => 'text-align:right',
-     'h4.centerchap'      => 'text-align:center',
-     'div.center'         => 'text-align:center',
-     'blockquote.indentedblock' => 'margin-right: 0em',
-     'td.printindex-index-entry'     => 'vertical-align: top',
-     'td.printindex-index-section'   => 'vertical-align: top; padding-left: 
1em',
-     'td.printindex-index-see-also'  => 'vertical-align: top; padding-left: 
1em',
-     'td.menu-entry-destination'     => 'vertical-align: top',
-     'td.menu-entry-description'     => 'vertical-align: top; padding-left: 
1em',
-     'th.entries-header-printindex'  => 'text-align:left',
-     'th.sections-header-printindex' => 'text-align:left; padding-left: 1em',
-     'th.menu-comment'               => 'text-align:left',
-     'td.category-def'               => 'text-align:right',
-     'td.call-def'                   => 'text-align:left',
-     'table.direction-about'         => 'border-collapse: collapse',
-     'th.button-direction-about'     => 'border-width: thin; 
border-bottom-style: solid; border-right-style: solid',
-     'th.name-direction-about'       => 'border-width: thin; 
border-bottom-style: solid; border-right-style: solid; border-left-style: 
solid',
-     'th.description-direction-about' => 'border-width: thin; 
border-bottom-style: solid; border-right-style: solid; border-left-style: 
solid',
-     'th.example-direction-about'    => 'border-width: thin; 
border-bottom-style: solid; border-left-style: solid',
-     'td.button-direction-about'     => 'text-align: center; border-width: 
thin; border-right-style: solid',
-     'td.name-direction-about'       => 'text-align: center; border-width: 
thin; border-right-style: solid; border-left-style: solid',
-     'td.description-direction-about' => 'border-width: thin; 
border-right-style: solid; border-left-style: solid',
-     'td.example-direction-about'    => 'border-width: thin; 
border-left-style: solid',
-     'img.nav-icon'                  => 'vertical-align: middle',
-     'table.def-block'               => 'width: 100%',
-
-     # The anchor element is wrapped in a <span> rather than a block level
-     # element to avoid it appearing unless the mouse pointer is directly
-     # over the text, as it is annoying for anchors to flicker when
-     # you are moving your pointer elsewhere. "line-height: 0em" stops the
-     # invisible text from changing vertical spacing.
-     'a.copiable-link' => 'visibility: hidden; '
-                           .'text-decoration: none; line-height: 0em',
-     'span:hover a.copiable-link'         => 'visibility: visible',
-);
+my %default_css_element_class_styles
+  = %{ Texinfo::Data::get_base_default_css_info() };
 
 $default_css_element_class_styles{'pre.format-preformatted'}
   = $default_css_element_class_styles{'pre.display-preformatted'};
@@ -3485,36 +3146,8 @@ foreach my $quoted_command ('samp') {
 
 my %default_upper_case_commands = ( 'sc' => 1 );
 
-my %style_commands_element = (
-      'b'           => 'b',
-      'cite'        => 'cite',
-      'code'        => 'code',
-      'command'     => 'code',
-      'dfn'         => 'em',
-      'dmn'         => 'span',
-      'emph'        => 'em',
-      'env'         => 'code',
-      'file'        => 'samp',
-      'headitemfont' => 'b', # no effect: the @multitable prototypes are 
ignored
-                             # and headitem are in <th> rather than <td>.
-                             # The mapping is based on style used in other
-                             # formats.
-      'i'           => 'i',
-      'slanted'     => 'i',
-      'sansserif'   => 'span',
-      'kbd'         => 'kbd',
-      'key'         => 'kbd',
-      'option'      => 'samp',
-      'r'           => 'span',
-      'samp'        => 'samp',
-      'sc'          => 'small',
-      'strong'      => 'strong',
-      'sub'         => 'sub',
-      'sup'         => 'sup',
-      't'           => 'code',
-      'var'         => 'var',
-      'verb'        => 'code', # other brace command
-);
+my %style_commands_element
+   = %{ Texinfo::Data::get_html_style_commands_element() };
 
 my %style_commands_formatting;
 
diff --git a/tp/Texinfo/Data.pm b/tp/Texinfo/Data.pm
new file mode 100644
index 0000000000..db0604ba06
--- /dev/null
+++ b/tp/Texinfo/Data.pm
@@ -0,0 +1,323 @@
+# Automatically generated from ./maintain/generate_convert_data_perl_code.pl
+
+package Texinfo::Data;
+
+use Texinfo::Common;
+
+my %base_default_css_element_class_styles = (
+    'ul.toc-numbered-mark'    => 'list-style: none',
+    'pre.menu-comment-preformatted'    => 'font-family: serif',
+ # using display: inline is an attempt to avoid a line break when in
+ # preformatted in menu.  In 2022 it does not seems to work in firefox,
+ # there is still a line break.
+    'pre.menu-entry-description-preformatted'    => 'font-family: serif; 
display: inline',
+    'pre.menu-preformatted'    => 'font-family: serif',
+    'a.summary-letter-printindex'    => 'text-decoration: none',
+    'pre.display-preformatted'    => 'font-family: inherit',
+ # used with PROGRAM_NAME_IN_FOOTER
+    'span.program-in-footer'    => 'font-size: smaller',
+    'span.sansserif'    => 'font-family: sans-serif; font-weight: normal',
+    'span.r'    => 'font-family: initial; font-weight: normal; font-style: 
normal',
+    'td.index-entry-level-1'    => 'padding-left: 1.5em',
+    'td.index-entry-level-2'    => 'padding-left: 3.0em',
+    'kbd.key'    => 'font-style: normal',
+    'kbd.kbd'    => 'font-style: oblique',
+    'strong.def-name'    => 'font-family: monospace; font-weight: bold; 
font-size: larger',
+    'p.flushleft-paragraph'    => 'text-align:left',
+    'p.flushright-paragraph'    => 'text-align:right',
+    'h1.centerchap'    => 'text-align:center',
+    'h2.centerchap'    => 'text-align:center',
+    'h3.centerchap'    => 'text-align:center',
+    'h1.settitle'    => 'text-align:center',
+    'h1.shorttitlepage'    => 'text-align:center',
+    'h3.subtitle'    => 'text-align:right',
+    'h4.centerchap'    => 'text-align:center',
+    'div.center'    => 'text-align:center',
+    'blockquote.indentedblock'    => 'margin-right: 0em',
+    'td.printindex-index-entry'    => 'vertical-align: top',
+    'td.printindex-index-section'    => 'vertical-align: top; padding-left: 
1em',
+    'td.printindex-index-see-also'    => 'vertical-align: top; padding-left: 
1em',
+    'td.menu-entry-destination'    => 'vertical-align: top',
+    'td.menu-entry-description'    => 'vertical-align: top',
+    'th.entries-header-printindex'    => 'text-align:left',
+    'th.sections-header-printindex'    => 'text-align:left; padding-left: 1em',
+    'th.menu-comment'    => 'text-align:left',
+    'td.category-def'    => 'text-align:right',
+    'td.call-def'    => 'text-align:left',
+    'td.button-direction-about'    => 'text-align:center',
+    'td.name-direction-about'    => 'text-align:center',
+ # The anchor element is wrapped in a <span> rather than a block level
+ # element to avoid it appearing unless the mouse pointer is directly over
+ # the text, as it is annoying for anchors to flicker when you are moving
+ # your pointer elsewhere. "line-height: 0em" stops the invisible text from
+ # changing vertical spacing.
+    'a.copiable-link'    => 'visibility: hidden; text-decoration: none; 
line-height: 0em',
+    'span:hover a.copiable-link'    => 'visibility: visible',
+);
+
+sub get_base_default_css_info() {
+  return \%base_default_css_element_class_styles;
+}
+
+my %default_converted_directions_strings = (
+
+  'rel' => {
+    ' ' => '',
+    'Top' => 'start',
+    'Contents' => 'contents',
+    'Overview' => '',
+    'Index' => 'index',
+    'This' => '',
+    'Back' => 'prev',
+    'FastBack' => '',
+    'Prev' => 'prev',
+    'Up' => 'up',
+    'Next' => 'next',
+    'NodeUp' => 'up',
+    'NodeNext' => 'next',
+    'NodePrev' => 'prev',
+    'NodeForward' => '',
+    'NodeBack' => '',
+    'Forward' => 'next',
+    'FastForward' => '',
+    'About' => 'help',
+    'First' => '',
+    'Last' => '',
+    'NextFile' => 'next',
+    'PrevFile' => 'prev',
+  },
+
+  'accesskey' => {
+    ' ' => '',
+    'Top' => '',
+    'Contents' => '',
+    'Overview' => '',
+    'Index' => '',
+    'This' => '',
+    'Back' => 'p',
+    'FastBack' => '',
+    'Prev' => 'p',
+    'Up' => 'u',
+    'Next' => 'n',
+    'NodeUp' => 'u',
+    'NodeNext' => 'n',
+    'NodePrev' => 'p',
+    'NodeForward' => '',
+    'NodeBack' => '',
+    'Forward' => 'n',
+    'FastForward' => '',
+    'About' => '',
+    'First' => '',
+    'Last' => '',
+    'NextFile' => '',
+    'PrevFile' => '',
+  },
+
+  'example' => {
+    ' ' => '',
+    'Top' => ' &nbsp; ',
+    'Contents' => ' &nbsp; ',
+    'Overview' => ' &nbsp; ',
+    'Index' => ' &nbsp; ',
+    'This' => '1.2.3',
+    'Back' => '1.2.2',
+    'FastBack' => '1',
+    'Prev' => '1.2.2',
+    'Up' => '1.2',
+    'Next' => '1.2.4',
+    'NodeUp' => '1.2',
+    'NodeNext' => '1.2.4',
+    'NodePrev' => '1.2.2',
+    'NodeForward' => '1.2.4',
+    'NodeBack' => '1.2.2',
+    'Forward' => '1.2.4',
+    'FastForward' => '2',
+    'About' => ' &nbsp; ',
+    'First' => '1.',
+    'Last' => '1.2.4',
+    'NextFile' => ' &nbsp; ',
+    'PrevFile' => ' &nbsp; ',
+  },
+);
+
+sub get_default_converted_directions_strings() {
+  return \%default_converted_directions_strings;
+}
+
+my %default_translated_directions_strings = (
+
+  'text' => {
+    ' ' => {'converted' => ' &nbsp; '},
+    'Top' => {'to_convert' => Texinfo::Common::pgdt('Top direction string', 
'Top')},
+    'Contents' => {'to_convert' => Texinfo::Common::pgdt('Contents direction 
string', 'Contents')},
+    'Overview' => {'to_convert' => Texinfo::Common::pgdt('Overview direction 
string', 'Overview')},
+    'Index' => {'to_convert' => Texinfo::Common::pgdt('Index direction 
string', 'Index')},
+    'This' => {'to_convert' => Texinfo::Common::pgdt('This (current section) 
direction string', 'current')},
+    'Back' => {'converted' => ' &lt; '},
+    'FastBack' => {'converted' => ' &lt;&lt; '},
+    'Prev' => {'to_convert' => Texinfo::Common::pgdt('Prev direction string', 
'Prev')},
+    'Up' => {'to_convert' => Texinfo::Common::pgdt('Up direction string', ' Up 
')},
+    'Next' => {'to_convert' => Texinfo::Common::pgdt('Next direction string', 
'Next')},
+    'NodeUp' => {'to_convert' => Texinfo::Common::pgdt('NodeUp direction 
string', 'Up')},
+    'NodeNext' => {'to_convert' => Texinfo::Common::pgdt('NodeNext direction 
string', 'Next')},
+    'NodePrev' => {'to_convert' => Texinfo::Common::pgdt('NodePrev direction 
string', 'Previous')},
+    'NodeForward' => {'to_convert' => Texinfo::Common::pgdt('NodeForward 
direction string', 'Forward node')},
+    'NodeBack' => {'to_convert' => Texinfo::Common::pgdt('NodeBack direction 
string', 'Back node')},
+    'Forward' => {'converted' => ' &gt; '},
+    'FastForward' => {'converted' => ' &gt;&gt; '},
+    'About' => {'converted' => ' ? '},
+    'First' => {'converted' => ' |&lt; '},
+    'Last' => {'converted' => ' &gt;| '},
+    'NextFile' => {'to_convert' => Texinfo::Common::pgdt('NextFile direction 
string', 'Next file')},
+    'PrevFile' => {'to_convert' => Texinfo::Common::pgdt('PrevFile direction 
string', 'Previous file')},
+  },
+
+  'description' => {
+    'Top' => {'to_convert' => Texinfo::Common::pgdt('Top direction 
description', 'Cover (top) of document')},
+    'Contents' => {'to_convert' => Texinfo::Common::pgdt('Contents direction 
description', 'Table of contents')},
+    'Overview' => {'to_convert' => Texinfo::Common::pgdt('Overview direction 
description', 'Short table of contents')},
+    'Index' => {'to_convert' => Texinfo::Common::pgdt('Index direction 
description', 'Index')},
+    'This' => {'to_convert' => Texinfo::Common::pgdt('This (current section) 
direction description', 'Current section')},
+    'Back' => {'to_convert' => Texinfo::Common::pgdt('Back direction 
description', 'Previous section in reading order')},
+    'FastBack' => {'to_convert' => Texinfo::Common::pgdt('FastBack direction 
description', 'Beginning of this chapter or previous chapter')},
+    'Prev' => {'to_convert' => Texinfo::Common::pgdt('Prev direction 
description', 'Previous section on same level')},
+    'Up' => {'to_convert' => Texinfo::Common::pgdt('Up direction description', 
'Up section')},
+    'Next' => {'to_convert' => Texinfo::Common::pgdt('Next direction 
description', 'Next section on same level')},
+    'NodeUp' => {'to_convert' => Texinfo::Common::pgdt('NodeUp direction 
description', 'Up node')},
+    'NodeNext' => {'to_convert' => Texinfo::Common::pgdt('NodeNext direction 
description', 'Next node')},
+    'NodePrev' => {'to_convert' => Texinfo::Common::pgdt('NodePrev direction 
description', 'Previous node')},
+    'NodeForward' => {'to_convert' => Texinfo::Common::pgdt('NodeForward 
direction description', 'Next node in node reading order')},
+    'NodeBack' => {'to_convert' => Texinfo::Common::pgdt('NodeBack direction 
description', 'Previous node in node reading order')},
+    'Forward' => {'to_convert' => Texinfo::Common::pgdt('Forward direction 
description', 'Next section in reading order')},
+    'FastForward' => {'to_convert' => Texinfo::Common::pgdt('FastForward 
direction description', 'Next chapter')},
+    'About' => {'to_convert' => Texinfo::Common::pgdt('About direction 
description', 'About (help)')},
+    'First' => {'to_convert' => Texinfo::Common::pgdt('First direction 
description', 'First section in reading order')},
+    'Last' => {'to_convert' => Texinfo::Common::pgdt('Last direction 
description', 'Last section in reading order')},
+    'NextFile' => {'to_convert' => Texinfo::Common::pgdt('NextFile direction 
description', 'Forward section in next file')},
+    'PrevFile' => {'to_convert' => Texinfo::Common::pgdt('PrevFile direction 
description', 'Back section in previous file')},
+  },
+
+  'button' => {
+    ' ' => {'converted' => ' '},
+    'Top' => {'to_convert' => Texinfo::Common::pgdt('Top direction button 
label', 'Top')},
+    'Contents' => {'to_convert' => Texinfo::Common::pgdt('Contents direction 
button label', 'Contents')},
+    'Overview' => {'to_convert' => Texinfo::Common::pgdt('Overview direction 
button label', 'Overview')},
+    'Index' => {'to_convert' => Texinfo::Common::pgdt('Index direction button 
label', 'Index')},
+    'This' => {'to_convert' => Texinfo::Common::pgdt('This direction button 
label', 'This')},
+    'Back' => {'to_convert' => Texinfo::Common::pgdt('Back direction button 
label', 'Back')},
+    'FastBack' => {'to_convert' => Texinfo::Common::pgdt('FastBack direction 
button label', 'FastBack')},
+    'Prev' => {'to_convert' => Texinfo::Common::pgdt('Prev direction button 
label', 'Prev')},
+    'Up' => {'to_convert' => Texinfo::Common::pgdt('Up direction button 
label', 'Up')},
+    'Next' => {'to_convert' => Texinfo::Common::pgdt('Next direction button 
label', 'Next')},
+    'NodeUp' => {'to_convert' => Texinfo::Common::pgdt('NodeUp direction 
button label', 'NodeUp')},
+    'NodeNext' => {'to_convert' => Texinfo::Common::pgdt('NodeNext direction 
button label', 'NodeNext')},
+    'NodePrev' => {'to_convert' => Texinfo::Common::pgdt('NodePrev direction 
button label', 'NodePrev')},
+    'NodeForward' => {'to_convert' => Texinfo::Common::pgdt('NodeForward 
direction button label', 'NodeForward')},
+    'NodeBack' => {'to_convert' => Texinfo::Common::pgdt('NodeBack direction 
button label', 'NodeBack')},
+    'Forward' => {'to_convert' => Texinfo::Common::pgdt('Forward direction 
button label', 'Forward')},
+    'FastForward' => {'to_convert' => Texinfo::Common::pgdt('FastForward 
direction button label', 'FastForward')},
+    'About' => {'to_convert' => Texinfo::Common::pgdt('About direction button 
label', 'About')},
+    'First' => {'to_convert' => Texinfo::Common::pgdt('First direction button 
label', 'First')},
+    'Last' => {'to_convert' => Texinfo::Common::pgdt('Last direction button 
label', 'Last')},
+    'NextFile' => {'to_convert' => Texinfo::Common::pgdt('NextFile direction 
button label', 'NextFile')},
+    'PrevFile' => {'to_convert' => Texinfo::Common::pgdt('PrevFile direction 
button label', 'PrevFile')},
+  },
+);
+
+sub get_default_translated_directions_strings() {
+  return \%default_translated_directions_strings;
+}
+
+my %default_special_unit_info = (
+
+  'class' => {
+    'contents' => 'contents',
+    'shortcontents' => 'shortcontents',
+    'footnotes' => 'footnotes',
+    'about' => 'about',
+  },
+
+  'direction' => {
+    'contents' => 'Contents',
+    'shortcontents' => 'Overview',
+    'footnotes' => 'Footnotes',
+    'about' => 'About',
+  },
+
+  'order' => {
+    'contents' => '30',
+    'shortcontents' => '20',
+    'footnotes' => '10',
+    'about' => '40',
+  },
+
+  'file_string' => {
+    'contents' => '_toc',
+    'shortcontents' => '_ovr',
+    'footnotes' => '_fot',
+    'about' => '_abt',
+  },
+
+  'target' => {
+    'contents' => 'SEC_Contents',
+    'shortcontents' => 'SEC_Shortcontents',
+    'footnotes' => 'SEC_Footnotes',
+    'about' => 'SEC_About',
+  },
+);
+
+sub get_default_special_unit_info() {
+  return \%default_special_unit_info;
+}
+
+my %default_translated_special_unit_info = (
+
+  'heading' => {
+    'contents' => Texinfo::Common::pgdt('contents section heading', 'Table of 
Contents'),
+    'shortcontents' => Texinfo::Common::pgdt('shortcontents section heading', 
'Short Table of Contents'),
+    'footnotes' => Texinfo::Common::pgdt('footnotes section heading', 
'Footnotes'),
+    'about' => Texinfo::Common::pgdt('about section heading', 'About This 
Document'),
+  },
+);
+
+sub get_default_translated_special_unit_info() {
+  return \%default_translated_special_unit_info;
+}
+
+my %html_style_commands_element = (
+    'b'    => 'b',
+    'cite'    => 'cite',
+    'code'    => 'code',
+    'command'    => 'code',
+    'dfn'    => 'em',
+    'dmn'    => 'span',
+    'emph'    => 'em',
+    'env'    => 'code',
+    'file'    => 'samp',
+ # no effect: the @multitable prototypes are ignored and headitem are in
+ # <th> rather than <td>. The mapping is based on style used in other
+ # formats.
+    'headitemfont'    => 'b',
+    'i'    => 'i',
+    'slanted'    => 'i',
+    'sansserif'    => 'span',
+    'kbd'    => 'kbd',
+    'key'    => 'kbd',
+    'option'    => 'samp',
+    'r'    => 'span',
+    'samp'    => 'samp',
+    'sc'    => 'small',
+    'strong'    => 'strong',
+    'sub'    => 'sub',
+    'sup'    => 'sup',
+    't'    => 'code',
+    'var'    => 'var',
+ # other brace command
+    'verb'    => 'code',
+);
+
+sub get_html_style_commands_element() {
+  return \%html_style_commands_element;
+}
+
+1;
diff --git a/tp/Texinfo/Data/default_css_element_class_styles.csv 
b/tp/Texinfo/Data/default_css_element_class_styles.csv
new file mode 100644
index 0000000000..c9a65472b8
--- /dev/null
+++ b/tp/Texinfo/Data/default_css_element_class_styles.csv
@@ -0,0 +1,51 @@
+selector|style|notes
+ul.toc-numbered-mark|list-style: none|
+pre.menu-comment-preformatted|font-family: serif|
+pre.menu-entry-description-preformatted|font-family: serif; display: 
inline|using display: inline is an attempt to avoid a line break when in 
preformatted in menu.  In 2022 it does not seems to work in firefox, there is 
still a line break.
+pre.menu-preformatted|font-family: serif|
+a.summary-letter-printindex|text-decoration: none|
+pre.display-preformatted|font-family: inherit|
+pre.displaymath|font-style: italic; font-family: serif; display: flex; 
justify-content: center|'display: flex; justify-content: center' centers the 
pre as a whole
+table.cartouche|border-style: solid; border-radius: 0.5em|
+span.program-in-footer|font-size: smaller|used with PROGRAM_NAME_IN_FOOTER
+span.sansserif|font-family: sans-serif; font-weight: normal|
+span.r|font-family: initial; font-weight: normal; font-style: normal|
+td.index-entry-level-1|padding-left: 1.5em|
+td.index-entry-level-2|padding-left: 3.0em|
+kbd.key|font-style: normal|
+kbd.kbd|font-style: oblique|
+strong.def-name|font-family: monospace; font-weight: bold; font-size: larger|
+p.flushleft-paragraph|text-align:left|
+p.flushright-paragraph|text-align:right|
+h1.centerchap|text-align:center|
+h2.centerchap|text-align:center|
+h3.centerchap|text-align:center|
+h1.settitle|text-align:center|
+h1.shorttitlepage|text-align:center|
+h3.subtitle|text-align:right|
+h4.centerchap|text-align:center|
+div.center|text-align:center|
+blockquote.indentedblock|margin-right: 0em|
+td.printindex-index-entry|vertical-align: top|
+td.printindex-index-section|vertical-align: top; padding-left: 1em|
+td.printindex-index-see-also|vertical-align: top; padding-left: 1em|
+td.menu-entry-destination|vertical-align: top|
+td.menu-entry-description|vertical-align: top; padding-left: 1em|
+th.entries-header-printindex|text-align:left|
+th.sections-header-printindex|text-align:left; padding-left: 1em|
+th.menu-comment|text-align:left|
+td.category-def|text-align:right|
+td.call-def|text-align:left|
+table.direction-about|border-collapse: collapse|
+th.button-direction-about|border-width: thin; border-bottom-style: solid; 
border-right-style: solid|
+th.name-direction-about|border-width: thin; border-bottom-style: solid; 
border-right-style: solid; border-left-style: solid|
+th.description-direction-about|border-width: thin; border-bottom-style: solid; 
border-right-style: solid; border-left-style: solid|
+th.example-direction-about|border-width: thin; border-bottom-style: solid; 
border-left-style: solid|
+td.button-direction-about|text-align: center; border-width: thin; 
border-right-style: solid|
+td.name-direction-about|text-align: center; border-width: thin; 
border-right-style: solid; border-left-style: solid|
+td.description-direction-about|border-width: thin; border-right-style: solid; 
border-left-style: solid|
+td.example-direction-about|border-width: thin; border-left-style: solid|
+img.nav-icon|vertical-align: middle|
+table.def-block|width: 100%|
+a.copiable-link|visibility: hidden; text-decoration: none; line-height: 
0em|The anchor element is wrapped in a <span> rather than a block level element 
to avoid it appearing unless the mouse pointer is directly over the text, as it 
is annoying for anchors to flicker when you are moving your pointer elsewhere. 
"line-height: 0em" stops the invisible text from changing vertical spacing.
+span:hover a.copiable-link|visibility: visible|
diff --git a/tp/Texinfo/Data/default_direction_strings.csv 
b/tp/Texinfo/Data/default_direction_strings.csv
new file mode 100644
index 0000000000..1ab9e11851
--- /dev/null
+++ b/tp/Texinfo/Data/default_direction_strings.csv
@@ -0,0 +1,24 @@
+direction|rel|accesskey|example|text converted|text to_convert context|text 
to_convert string|description converted|description to_convert 
context|description to_convert string|button converted|button to_convert 
context|button to_convert string|
+ |||| $html_default_entity_nbsp |||||| |||
+Top|start|| $html_default_entity_nbsp ||Top direction string|Top||Top 
direction description|Cover (top) of document||Top direction button label|Top|
+Contents|contents|| $html_default_entity_nbsp ||Contents direction 
string|Contents||Contents direction description|Table of contents||Contents 
direction button label|Contents|
+Overview||| $html_default_entity_nbsp ||Overview direction 
string|Overview||Overview direction description|Short table of 
contents||Overview direction button label|Overview|
+Index|index|| $html_default_entity_nbsp ||Index direction string|Index||Index 
direction description|Index||Index direction button label|Index|
+This|||1.2.3||This (current section) direction string|current||This (current 
section) direction description|Current section||This direction button 
label|This|
+Back|prev|p|1.2.2| &lt; ||||Back direction description|Previous section in 
reading order||Back direction button label|Back|
+FastBack|||1| &lt;&lt; ||||FastBack direction description|Beginning of this 
chapter or previous chapter||FastBack direction button label|FastBack|
+Prev|prev|p|1.2.2||Prev direction string|Prev||Prev direction 
description|Previous section on same level||Prev direction button label|Prev|
+Up|up|u|1.2||Up direction string| Up ||Up direction description|Up section||Up 
direction button label|Up|
+Next|next|n|1.2.4||Next direction string|Next||Next direction description|Next 
section on same level||Next direction button label|Next|
+NodeUp|up|u|1.2||NodeUp direction string|Up||NodeUp direction description|Up 
node||NodeUp direction button label|NodeUp|
+NodeNext|next|n|1.2.4||NodeNext direction string|Next||NodeNext direction 
description|Next node||NodeNext direction button label|NodeNext|
+NodePrev|prev|p|1.2.2||NodePrev direction string|Previous||NodePrev direction 
description|Previous node||NodePrev direction button label|NodePrev|
+NodeForward|||1.2.4||NodeForward direction string|Forward node||NodeForward 
direction description|Next node in node reading order||NodeForward direction 
button label|NodeForward|
+NodeBack|||1.2.2||NodeBack direction string|Back node||NodeBack direction 
description|Previous node in node reading order||NodeBack direction button 
label|NodeBack|
+Forward|next|n|1.2.4| &gt; ||||Forward direction description|Next section in 
reading order||Forward direction button label|Forward|
+FastForward|||2| &gt;&gt; ||||FastForward direction description|Next 
chapter||FastForward direction button label|FastForward|
+About|help|| $html_default_entity_nbsp | ? ||||About direction 
description|About (help)||About direction button label|About|
+First|||1.| ${bar}&lt; ||||First direction description|First section in 
reading order||First direction button label|First|
+Last|||1.2.4| &gt;${bar} ||||Last direction description|Last section in 
reading order||Last direction button label|Last|
+NextFile|next|| $html_default_entity_nbsp ||NextFile direction string|Next 
file||NextFile direction description|Forward section in next file||NextFile 
direction button label|NextFile|
+PrevFile|prev|| $html_default_entity_nbsp ||PrevFile direction string|Previous 
file||PrevFile direction description|Back section in previous file||PrevFile 
direction button label|PrevFile|
diff --git a/tp/Texinfo/Data/default_special_unit_info.csv 
b/tp/Texinfo/Data/default_special_unit_info.csv
new file mode 100644
index 0000000000..b334c447b0
--- /dev/null
+++ b/tp/Texinfo/Data/default_special_unit_info.csv
@@ -0,0 +1,5 @@
+type|class|direction|order|file_string|target|heading context|heading string|
+contents|contents|Contents|30|_toc|SEC_Contents|contents section heading|Table 
of Contents|
+shortcontents|shortcontents|Overview|20|_ovr|SEC_Shortcontents|shortcontents 
section heading|Short Table of Contents|
+footnotes|footnotes|Footnotes|10|_fot|SEC_Footnotes|footnotes section 
heading|Footnotes|
+about|about|About|40|_abt|SEC_About|about section heading|About This Document|
diff --git a/tp/Texinfo/Data/html_style_commands_element.csv 
b/tp/Texinfo/Data/html_style_commands_element.csv
new file mode 100644
index 0000000000..d924b3a04c
--- /dev/null
+++ b/tp/Texinfo/Data/html_style_commands_element.csv
@@ -0,0 +1,26 @@
+command|html_element|notes
+b|b|
+cite|cite|
+code|code|
+command|code|
+dfn|em|
+dmn|span|
+emph|em|
+env|code|
+file|samp|
+headitemfont|b|no effect: the @multitable prototypes are ignored and headitem 
are in <th> rather than <td>. The mapping is based on style used in other 
formats.
+i|i|
+slanted|i|
+sansserif|span|
+kbd|kbd|
+key|kbd|
+option|samp|
+r|span|
+samp|samp|
+sc|small|
+strong|strong|
+sub|sub|
+sup|sup|
+t|code|
+var|var|
+verb|code|other brace command
diff --git a/tp/maintain/generate_convert_data_perl_code.pl 
b/tp/maintain/generate_convert_data_perl_code.pl
new file mode 100755
index 0000000000..286b50d6fb
--- /dev/null
+++ b/tp/maintain/generate_convert_data_perl_code.pl
@@ -0,0 +1,375 @@
+#! /usr/bin/env perl
+
+# generate_convert_data_perl_code.pl: generate perl hashes based on
+# data information also used in XS.
+#
+# Copyright 2024 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# ./maintain/generate_convert_html_perl_code.pl 
Texinfo/Data/default_css_element_class_styles.csv 
Texinfo/Data/default_direction_strings.csv 
Texinfo/Data/default_special_unit_info.csv 
Texinfo/Data/html_style_commands_element.csv Texinfo/Data.pm
+
+use strict;
+
+use warnings;
+
+use Text::Wrap;
+
+my $base_default_css_element_class_styles_file = $ARGV[0];
+
+open (BDCSS, "<$base_default_css_element_class_styles_file") 
+  or die "open $base_default_css_element_class_styles_file failed: $!";
+
+my $default_direction_strings_file = $ARGV[1];
+open (DDS, "<$default_direction_strings_file") 
+  or die "open $default_direction_strings_file failed: $!";
+
+my $default_special_unit_info_file = $ARGV[2];
+open (DSUI, "<$default_special_unit_info_file")
+  or die "open $default_special_unit_info_file failed: $!";
+
+my $style_commands_element_file = $ARGV[3];
+open (SCE, "<$style_commands_element_file")
+  or die "open $style_commands_element_file failed: $!";
+
+
+my $header_line = <BDCSS>;
+chomp($header_line);
+#print STDERR "$header_line\n";
+my @header = split(/\|/, $header_line);
+my ($selector_index, $style_index, $notes_index);
+my $header_index = 0;
+foreach my $header (@header) {
+  if ($header eq 'selector') {
+    $selector_index = $header_index;
+  } elsif ($header eq 'style') {
+    $style_index = $header_index;
+  } elsif ($header eq 'notes') {
+    $notes_index = $header_index;
+  }
+  $header_index++;
+}
+if (!defined($selector_index) or !defined($style_index)
+    or !defined($notes_index)) {
+  die "missing header column ($selector_index, $style_index, $notes_index)\n";
+}
+
+my $out_file = $ARGV[4];
+
+die "Need an output file\n" if (!defined($out_file));
+
+open(OUT, ">$out_file") or die "Open $out_file: $!\n";
+    
+print OUT "# Automatically generated from $0\n\n";
+
+print OUT "package Texinfo::Data;\n\n";
+
+print OUT "use Texinfo::Common;\n\n";
+
+print OUT "my %base_default_css_element_class_styles = (\n";
+
+my $initial_notes_tab = ' # ';
+my $subsequent_notes_tab = ' # ';
+while (<BDCSS>) {
+  chomp;
+  my @data = split (/\|/);
+  my $notes = $data[$notes_index];
+  if (defined($notes) and $notes ne '') {
+    my $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes));
+    print OUT $lines."\n";
+  }
+  my $selector = $data[$selector_index];
+  if (!defined($selector) or $selector eq '') {
+    die "$base_default_css_element_class_styles_file: Bad selector\n";
+  }
+  my $style = $data[$style_index];
+  if (!defined($style) or $style eq '') {
+    die "$base_default_css_element_class_styles_file: Bad style\n";
+  }
+  print OUT "    '$selector'    => '$style',\n";
+}
+
+print OUT ");\n\n";
+
+print OUT 'sub get_base_default_css_info() {
+  return \%base_default_css_element_class_styles;
+}'."\n\n";
+
+
+my @d_ordered_untranslated_hashes;
+my @d_ordered_translated_hashes;
+
+my $d_header_line = <DDS>;
+chomp($d_header_line);
+#print STDERR "$d_header_line\n";
+my @d_header = split(/\|/, $d_header_line);
+my $direction_header = shift @d_header;
+
+my $d_header_index = 1;
+my $type;
+my %d_header_indices;
+foreach my $header (@d_header) {
+  if ($header =~ /^([^ ]+) converted$/) {
+    $type = $1;
+    push @d_ordered_translated_hashes, $type;
+    $d_header_indices{$type} = {'converted' => $d_header_index};
+  } elsif ($header =~ /^([^ ]+) to_convert ([^ ]+)$/) {
+    if ($1 ne $type) {
+      die "Non matching type $1 ne $type\n";
+    }
+    my $spec = $2;
+    if ($spec ne 'context' and $spec ne 'string') {
+      die "Unknown to_convert spec $spec\n";
+    }
+    if (!defined($d_header_indices{$type}->{'to_convert'})) {
+      $d_header_indices{$type}->{'to_convert'} = {};
+    }
+    $d_header_indices{$type}->{'to_convert'}->{$spec} = $d_header_index;
+  } elsif ($header eq '') {
+    continue;
+  } else {
+    push @d_ordered_untranslated_hashes, $header;
+    $type = undef;
+    $d_header_indices{$header} = $d_header_index;
+  }
+  $d_header_index++;
+}
+
+sub substitute_direction_value
+{
+  my $input = shift;
+  $input =~ s/\$html_default_entity_nbsp/&nbsp;/;
+  $input =~ s/\$\{bar\}/\|/;
+  return $input;
+}
+
+my %hash_lines;
+foreach my $type (@d_ordered_untranslated_hashes, 
@d_ordered_translated_hashes) {
+  $hash_lines{$type} = '';
+}
+my @d_ordered;
+while (<DDS>) {
+  chomp;
+  my @data = split (/\|/);
+  my $direction = $data[0];
+  push @d_ordered, $direction;
+  foreach my $untranslated_type (@d_ordered_untranslated_hashes) {
+    my $index = $d_header_indices{$untranslated_type};
+    my $value = '';
+    if (defined($data[$index])) {
+      $value = substitute_direction_value($data[$index]);
+    }
+    $hash_lines{$untranslated_type} .= "    '$direction' => '$value',\n";
+  }
+  foreach my $translated_type (@d_ordered_translated_hashes) {
+    my $converted_value = 
$data[$d_header_indices{$translated_type}->{'converted'}];
+    if (defined($converted_value) and $converted_value ne '') {
+      $hash_lines{$translated_type} 
+        .= "    '$direction' => {'converted' => '"
+                   .substitute_direction_value($converted_value)."'},\n";
+    } else {
+      my $context = 
$data[$d_header_indices{$translated_type}->{'to_convert'}->{'context'}];
+      my $string = 
$data[$d_header_indices{$translated_type}->{'to_convert'}->{'string'}];
+      if (defined($string) and $string ne '') {
+        if (!defined($context) or $context eq '') {
+          print STDERR "ERROR: '$direction': '$string' but no context\n";
+        } else {
+          $hash_lines{$translated_type}
+           .= "    '$direction' => {'to_convert' => 
Texinfo::Common::pgdt('$context', '"
+             . substitute_direction_value($string)."')},\n";
+        }
+      } else {
+        print STDERR "REMARK: '$direction': no $translated_type\n";
+      }
+    }
+  }
+}
+
+print OUT "my %default_converted_directions_strings = (\n";
+
+foreach my $type (@d_ordered_untranslated_hashes) {
+  print OUT "\n  '$type' => {\n";
+  print OUT $hash_lines{$type};
+  print OUT "  },\n";
+}
+
+print OUT ");\n\n";
+
+print OUT 'sub get_default_converted_directions_strings() {
+  return \%default_converted_directions_strings;
+}'."\n\n";
+
+print OUT "my %default_translated_directions_strings = (\n";
+foreach my $type (@d_ordered_translated_hashes) {
+  print OUT "\n  '$type' => {\n";
+  print OUT $hash_lines{$type};
+  print OUT "  },\n";
+}
+print OUT ");\n\n";
+
+print OUT 'sub get_default_translated_directions_strings() {
+  return \%default_translated_directions_strings;
+}'."\n\n";
+
+
+my @su_ordered_untranslated_hashes;
+my @su_ordered_translated_hashes;
+
+my $su_header_line = <DSUI>;
+chomp($su_header_line);
+#print STDERR "$su_header_line\n";
+my @su_header = split(/\|/, $su_header_line);
+my $special_unit_header = shift @su_header;
+
+my $su_header_index = 1;
+my $su_type;
+my %su_header_indices;
+foreach my $header (@su_header) {
+  if ($header =~ /^([^ ]+) ([^ ]+)$/) {
+    my $spec = $2;
+    if ($spec ne 'context' and $spec ne 'string') {
+      die "Unknown special unit column spec $spec\n";
+    }
+    if ($spec eq 'context') {
+      $su_type = $1;
+      push @su_ordered_translated_hashes, $su_type;
+      $su_header_indices{$su_type} = {}; 
+    } elsif ($1 ne $su_type) {
+      die "Non matching type $1 ne $su_type\n";
+    }
+    $su_header_indices{$su_type}->{$spec} = $su_header_index;
+  } elsif ($header eq '') {
+    continue;
+  } else {
+    push @su_ordered_untranslated_hashes, $header;
+    $su_type = undef;
+    $su_header_indices{$header} = $su_header_index;
+  }
+  $su_header_index++;
+}
+
+my %su_hash_lines;
+foreach my $type (@su_ordered_untranslated_hashes, 
@su_ordered_translated_hashes) {
+  $su_hash_lines{$type} = '';
+}
+my @su_ordered;
+while (<DSUI>) {
+  chomp;
+  my @data = split (/\|/);
+  my $special_unit = $data[0];
+  push @su_ordered, $special_unit;
+  foreach my $untranslated_type (@su_ordered_untranslated_hashes) {
+    my $index = $su_header_indices{$untranslated_type};
+    my $value = '';
+    if (defined($data[$index])) {
+      $value = $data[$index];
+    }
+    $su_hash_lines{$untranslated_type} .= "    '$special_unit' => '$value',\n";
+  }
+  foreach my $translated_type (@su_ordered_translated_hashes) {
+    my $context = $data[$su_header_indices{$translated_type}->{'context'}];
+    my $string = $data[$su_header_indices{$translated_type}->{'string'}];
+    if (defined($string) and $string ne '') {
+      if (!defined($context) or $context eq '') {
+        print STDERR "ERROR: '$special_unit': '$string' but no context\n";
+      } else {
+        $su_hash_lines{$translated_type}
+         .= "    '$special_unit' => Texinfo::Common::pgdt('$context', 
'$string'),\n";
+      }
+    } else {
+      print STDERR "REMARK: '$special_unit': no $translated_type\n";
+    }
+  }
+}
+
+print OUT "my %default_special_unit_info = (\n";
+
+foreach my $type (@su_ordered_untranslated_hashes) {
+  print OUT "\n  '$type' => {\n";
+  print OUT $su_hash_lines{$type};
+  print OUT "  },\n";
+}
+
+print OUT ");\n\n";
+
+print OUT 'sub get_default_special_unit_info() {
+  return \%default_special_unit_info;
+}'."\n\n";
+
+print OUT "my %default_translated_special_unit_info = (\n";
+foreach my $type (@su_ordered_translated_hashes) {
+  print OUT "\n  '$type' => {\n";
+  print OUT $su_hash_lines{$type};
+  print OUT "  },\n";
+}
+print OUT ");\n\n";
+
+print OUT 'sub get_default_translated_special_unit_info() {
+  return \%default_translated_special_unit_info;
+}'."\n\n";
+
+
+my $sce_header_line = <SCE>;
+chomp($sce_header_line);
+#print STDERR "$sce_header_line\n";
+my @sce_header = split(/\|/, $sce_header_line);
+my ($sce_command_index, $sce_html_element_index, $sce_notes_index);
+my $sce_header_index = 0; 
+foreach my $header (@sce_header) {
+  if ($header eq 'command') {
+    $sce_command_index = $sce_header_index;
+  } elsif ($header eq 'html_element') {
+    $sce_html_element_index = $sce_header_index;
+  } elsif ($header eq 'notes') { 
+    $sce_notes_index = $sce_header_index;
+  } 
+  $sce_header_index++;
+} 
+if (!defined($sce_command_index) or !defined($sce_html_element_index)
+    or !defined($notes_index)) {
+  die "missing header column ($sce_command_index, "
+                   ."$sce_html_element_index, $sce_notes_index)\n";
+}
+
+print OUT "my %html_style_commands_element = (\n";
+
+my $line_nr = 1;
+while (<SCE>) {
+  $line_nr++;
+  chomp;
+  my @data = split (/\|/); 
+  my $notes = $data[$sce_notes_index];
+  if (defined($notes) and $notes ne '') {
+    my $lines = wrap($initial_notes_tab, $subsequent_notes_tab, ($notes));
+    print OUT $lines."\n";
+  }
+  my $sce_command = $data[$sce_command_index];
+  if (!defined($sce_command) or $sce_command eq '') {
+    die "$style_commands_element_file: $line_nr: Bad command\n";
+  } 
+  my $sce_html_element = $data[$sce_html_element_index];
+  if (!defined($sce_html_element) or $sce_html_element eq '') {
+    die "$style_commands_element_file: $line_nr: Bad html_element\n";
+  }   
+  print OUT "    '$sce_command'    => '$sce_html_element',\n";
+}   
+    
+print OUT ");\n\n";
+    
+print OUT 'sub get_html_style_commands_element() {
+  return \%html_style_commands_element;
+}'."\n\n";
+
+print OUT "1;\n";
+



reply via email to

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