texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * doc/texi2any_api.texi (Simple Output Customizat


From: Patrice Dumas
Subject: branch master updated: * doc/texi2any_api.texi (Simple Output Customization for Simple Commands with Braces): fix example.
Date: Wed, 15 Nov 2023 06:27:10 -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 090c8f0e52 * doc/texi2any_api.texi (Simple Output Customization for 
Simple Commands with Braces): fix example.
090c8f0e52 is described below

commit 090c8f0e52c01cd6e455f6be60596542962081f6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Nov 15 12:27:01 2023 +0100

    * doc/texi2any_api.texi (Simple Output Customization for Simple
    Commands with Braces): fix example.
    
    * tp/init/documentation_examples.pm: new example for uppercase.
    
    * tp/Makefile.tres, tp/t/init_files_tests.t (sc_formatting_with_css),
    tp/init/sc_formatting_with_css.pm: example of init file to format
    small caps with CSS.
---
 ChangeLog                                          |  11 +
 doc/texi2any_api.texi                              |   2 +-
 tp/Makefile.tres                                   |   2 +
 tp/TODO                                            |   2 -
 tp/init/documentation_examples.pm                  |   3 +
 tp/init/sc_formatting_with_css.pm                  |  15 ++
 tp/t/init_files_tests.t                            |  13 ++
 .../init_files_tests/documentation_examples.pl     |  80 +++++--
 .../res_html/prepended_to_filenames-chapter.html   |   2 +
 .../init_files_tests/sc_formatting_with_css.pl     | 234 +++++++++++++++++++++
 .../sc_formatting_with_css/res_html/index.html     |  36 ++++
 11 files changed, 381 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 69500614a9..5412d7ecc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-11-15  Patrice Dumas  <pertusus@free.fr>
+
+       * doc/texi2any_api.texi (Simple Output Customization for Simple
+       Commands with Braces): fix example.
+
+       * tp/init/documentation_examples.pm: new example for uppercase.
+
+       * tp/Makefile.tres, tp/t/init_files_tests.t (sc_formatting_with_css),
+       tp/init/sc_formatting_with_css.pm: example of init file to format
+       small caps with CSS.
+
 2023-11-15  Patrice Dumas  <pertusus@free.fr>
 
        Customization of uppercasing commands
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index 44ff7a68ab..4f69f6256f 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -608,7 +608,7 @@ texinfo_register_style_command_formatting('sansserif', 
undef, 1,
 
 To output the formatted argument of @code{@@t} as is:
 @example
-foreach my $context ('normal', 'example', string') @{
+foreach my $context ('normal', 'preformatted', 'string') @{
   texinfo_register_style_command_formatting ('t', undef,
                                              undef, $context);
 @}
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index a7e70fd316..98c1121336 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -990,6 +990,8 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/init_files_tests/macro_defined_txiinternalvalue_in_translation.pl \
   t/results/init_files_tests/modified_translation.pl \
   t/results/init_files_tests/redefined_need.pl \
+  t/results/init_files_tests/sc_formatting_with_css.pl \
+  t/results/init_files_tests/sc_formatting_with_css/res_html \
   t/results/init_files_tests/translation_in_parser_in_translation.pl \
   t/results/init_files_tests/translation_in_parser_in_translation/res_html \
   t/results/init_files_tests/undefined_node_filename.pl \
diff --git a/tp/TODO b/tp/TODO
index a7b423a4fb..8a3bc510ae 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,8 +10,6 @@ This is the todo list for texi2any
 Before next release
 ===================
 
-     'span.sc'            => 'font-variant: small-caps',
-
 check $(native_tools) variable in Makefile.am does not seems to be
 set and seems useless.
 
diff --git a/tp/init/documentation_examples.pm 
b/tp/init/documentation_examples.pm
index 5d5454e0ed..fba1c57cb5 100644
--- a/tp/init/documentation_examples.pm
+++ b/tp/init/documentation_examples.pm
@@ -45,6 +45,9 @@ texinfo_register_style_command_formatting('sansserif', 
'code', 0, 'normal');
 texinfo_register_style_command_formatting('sansserif', 'code', 0, 
'preformatted');
 texinfo_register_style_command_formatting('sansserif', undef, 1, 'string');
 
+texinfo_register_upper_case_command('sc', 0);
+texinfo_register_upper_case_command('var', 1);
+
 texinfo_register_accent_command_formatting('dotless', 'nodot', 'ij');
 
 my $shown_styles;
diff --git a/tp/init/sc_formatting_with_css.pm 
b/tp/init/sc_formatting_with_css.pm
new file mode 100644
index 0000000000..a01ffc4a47
--- /dev/null
+++ b/tp/init/sc_formatting_with_css.pm
@@ -0,0 +1,15 @@
+use strict;
+
+texinfo_register_upper_case_command('sc', 0);
+
+foreach my $context ('normal', 'preformatted', 'string') {
+  texinfo_register_style_command_formatting ('sc', 'span',
+                                             undef, $context);
+}
+
+sub sc_formatting_with_css_set_css {
+  my $converter = shift;
+  $converter->css_add_info('styles', 'span.sc', 'font-variant: small-caps');
+  return 0;
+}
+texinfo_register_handler('structure', \&sc_formatting_with_css_set_css);
diff --git a/tp/t/init_files_tests.t b/tp/t/init_files_tests.t
index 7470b5d47a..3e4276abd5 100644
--- a/tp/t/init_files_tests.t
+++ b/tp/t/init_files_tests.t
@@ -102,6 +102,8 @@ Text@footnote{In footnote}.
 @xref{my node}@footnote{in footnote}.
 @titlefont{in titlefont}
 @email{a@@b.c, someone}
+@sc{in Sc}
+@var{in var}
 
 @math{@sansserif{in--math} @- a=b @error{} @equiv{}}
 
@@ -126,6 +128,17 @@ Text@footnote{In footnote}.
 
 ',{'init_files' => ['documentation_examples.pm']},
 ],
+['sc_formatting_with_css',
+'@settitle{In title @sc{my string} NEXT}
+
+@sc{in sc}. OUT.
+
+@example
+@sc{small case in example} MORE text.
+@end example
+
+',{'init_files' => ['sc_formatting_with_css.pm']},
+],
 # tests translation in parser of def object type index entry, when already
 # in a translation (of the Next button).
 ['translation_in_parser_in_translation',
diff --git a/tp/t/results/init_files_tests/documentation_examples.pl 
b/tp/t/results/init_files_tests/documentation_examples.pl
index 315e80bf4c..32ff509f45 100644
--- a/tp/t/results/init_files_tests/documentation_examples.pl
+++ b/tp/t/results/init_files_tests/documentation_examples.pl
@@ -454,6 +454,50 @@ $result_trees{'documentation_examples'} = {
             },
             {
               'text' => '
+'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'in Sc'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'sc',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 14,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
+'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'in var'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'var',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 15,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
 '
             }
           ],
@@ -484,7 +528,7 @@ $result_trees{'documentation_examples'} = {
                       'cmdname' => 'sansserif',
                       'source_info' => {
                         'file_name' => '',
-                        'line_nr' => 15,
+                        'line_nr' => 17,
                         'macro' => ''
                       }
                     },
@@ -506,7 +550,7 @@ $result_trees{'documentation_examples'} = {
                       'cmdname' => 'error',
                       'source_info' => {
                         'file_name' => '',
-                        'line_nr' => 15,
+                        'line_nr' => 17,
                         'macro' => ''
                       }
                     },
@@ -522,7 +566,7 @@ $result_trees{'documentation_examples'} = {
                       'cmdname' => 'equiv',
                       'source_info' => {
                         'file_name' => '',
-                        'line_nr' => 15,
+                        'line_nr' => 17,
                         'macro' => ''
                       }
                     }
@@ -533,7 +577,7 @@ $result_trees{'documentation_examples'} = {
               'cmdname' => 'math',
               'source_info' => {
                 'file_name' => '',
-                'line_nr' => 15,
+                'line_nr' => 17,
                 'macro' => ''
               }
             },
@@ -579,7 +623,7 @@ $result_trees{'documentation_examples'} = {
                   'cmdname' => 'sansserif',
                   'source_info' => {
                     'file_name' => '',
-                    'line_nr' => 18,
+                    'line_nr' => 20,
                     'macro' => ''
                   }
                 },
@@ -601,7 +645,7 @@ $result_trees{'documentation_examples'} = {
                   'cmdname' => 'error',
                   'source_info' => {
                     'file_name' => '',
-                    'line_nr' => 18,
+                    'line_nr' => 20,
                     'macro' => ''
                   }
                 },
@@ -617,7 +661,7 @@ $result_trees{'documentation_examples'} = {
                   'cmdname' => 'equiv',
                   'source_info' => {
                     'file_name' => '',
-                    'line_nr' => 18,
+                    'line_nr' => 20,
                     'macro' => ''
                   }
                 },
@@ -656,14 +700,14 @@ $result_trees{'documentation_examples'} = {
               },
               'source_info' => {
                 'file_name' => '',
-                'line_nr' => 19,
+                'line_nr' => 21,
                 'macro' => ''
               }
             }
           ],
           'source_info' => {
             'file_name' => '',
-            'line_nr' => 17,
+            'line_nr' => 19,
             'macro' => ''
           }
         },
@@ -700,7 +744,7 @@ $result_trees{'documentation_examples'} = {
           },
           'source_info' => {
             'file_name' => '',
-            'line_nr' => 21,
+            'line_nr' => 23,
             'macro' => ''
           }
         },
@@ -720,7 +764,7 @@ $result_trees{'documentation_examples'} = {
               'cmdname' => 'error',
               'source_info' => {
                 'file_name' => '',
-                'line_nr' => 23,
+                'line_nr' => 25,
                 'macro' => ''
               }
             },
@@ -747,7 +791,7 @@ $result_trees{'documentation_examples'} = {
               'cmdname' => 'equiv',
               'source_info' => {
                 'file_name' => '',
-                'line_nr' => 25,
+                'line_nr' => 27,
                 'macro' => ''
               }
             },
@@ -830,7 +874,7 @@ $result_trees{'documentation_examples'} = {
           },
           'source_info' => {
             'file_name' => '',
-            'line_nr' => 29,
+            'line_nr' => 31,
             'macro' => ''
           }
         },
@@ -850,7 +894,7 @@ $result_trees{'documentation_examples'} = {
               'cmdname' => 'error',
               'source_info' => {
                 'file_name' => '',
-                'line_nr' => 31,
+                'line_nr' => 33,
                 'macro' => ''
               }
             },
@@ -877,7 +921,7 @@ $result_trees{'documentation_examples'} = {
               'cmdname' => 'equiv',
               'source_info' => {
                 'file_name' => '',
-                'line_nr' => 33,
+                'line_nr' => 35,
                 'macro' => ''
               }
             },
@@ -910,7 +954,7 @@ $result_trees{'documentation_examples'} = {
       },
       'source_info' => {
         'file_name' => '',
-        'line_nr' => 27,
+        'line_nr' => 29,
         'macro' => ''
       }
     }
@@ -932,6 +976,8 @@ $result_texis{'documentation_examples'} = '
 @xref{my node}@footnote{in footnote}.
 @titlefont{in titlefont}
 @email{a@@b.c, someone}
+@sc{in Sc}
+@var{in var}
 
 @math{@sansserif{in--math} @- a=b @error{} @equiv{}}
 
@@ -968,6 +1014,8 @@ in-text  p-n. error--> ==
 my node.
 in titlefont
 someone
+IN SC
+in var
 
 in--math  a=b error--> ==
 
diff --git 
a/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-chapter.html
 
b/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-chapter.html
index 3310279bd9..b4a86e7565 100644
--- 
a/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-chapter.html
+++ 
b/tp/t/results/init_files_tests/documentation_examples/res_html/prepended_to_filenames-chapter.html
@@ -39,6 +39,8 @@ Previous: <a href="index.html" accesskey="p" 
rel="prev">top</a>, Up: <a href="in
 See <a class="xref" href="prepended_to_filenames-my-node.html">my node</a><a 
class="footnote" id="DOCF1_2" 
href="documentation_examples_fot.html#FOOT1_2"><sup>2</sup></a>.
  <code>HTML</code> text </p><h1 class="titlefont">in titlefont</h1>
 <p><a class="email" href="mailto:a@b.c";>someone</a> [undefined 
text-align:center, is undef|end|separate]
+<small class="sc">in Sc</small>
+<var class="var">IN VAR</var>
  <code>HTML</code> text </p>
 <p><em class="math"><code class="sansserif">in--math</code> &shy; a=b 
error--&gt; is the <strong class="strong">same</strong> as</em>
  <code>HTML</code> text </p>
diff --git a/tp/t/results/init_files_tests/sc_formatting_with_css.pl 
b/tp/t/results/init_files_tests/sc_formatting_with_css.pl
new file mode 100644
index 0000000000..31db2c69fa
--- /dev/null
+++ b/tp/t/results/init_files_tests/sc_formatting_with_css.pl
@@ -0,0 +1,234 @@
+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{'sc_formatting_with_css'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'In title '
+                    },
+                    {
+                      'args' => [
+                        {
+                          'contents' => [
+                            {
+                              'text' => 'my string'
+                            }
+                          ],
+                          'type' => 'brace_command_arg'
+                        }
+                      ],
+                      'cmdname' => 'sc',
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 1,
+                        'macro' => ''
+                      }
+                    },
+                    {
+                      'text' => ' NEXT'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'settitle',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 1,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
+',
+              'type' => 'empty_line'
+            }
+          ],
+          'type' => 'preamble_before_content'
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'in sc'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'sc',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '. OUT.
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'example',
+          'contents' => [
+            {
+              'contents' => [
+                {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'small case in example'
+                        }
+                      ],
+                      'type' => 'brace_command_arg'
+                    }
+                  ],
+                  'cmdname' => 'sc',
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 6,
+                    'macro' => ''
+                  }
+                },
+                {
+                  'text' => ' MORE text.
+'
+                }
+              ],
+              'type' => 'preformatted'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'example'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'example'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 7,
+                'macro' => ''
+              }
+            }
+          ],
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'sc_formatting_with_css'} = '@settitleIn title @sc{my string} 
NEXT
+
+@sc{in sc}. OUT.
+
+@example
+@sc{small case in example} MORE text.
+@end example
+
+';
+
+
+$result_texts{'sc_formatting_with_css'} = '
+IN SC. OUT.
+
+SMALL CASE IN EXAMPLE MORE text.
+
+';
+
+$result_errors{'sc_formatting_with_css'} = [
+  {
+    'error_line' => 'misplaced {
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'misplaced {',
+    'type' => 'error'
+  },
+  {
+    'error_line' => 'misplaced }
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'misplaced }',
+    'type' => 'error'
+  }
+];
+
+
+$result_floats{'sc_formatting_with_css'} = {};
+
+
+1;
diff --git 
a/tp/t/results/init_files_tests/sc_formatting_with_css/res_html/index.html 
b/tp/t/results/init_files_tests/sc_formatting_with_css/res_html/index.html
new file mode 100644
index 0000000000..e11496ff09
--- /dev/null
+++ b/tp/t/results/init_files_tests/sc_formatting_with_css/res_html/index.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>In title my string NEXT</title>
+
+<meta name="description" content="In title my string NEXT">
+<meta name="keywords" content="In title my string NEXT">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<style type="text/css">
+<!--
+div.example {margin-left: 3.2em}
+span.sc {font-variant: small-caps}
+-->
+</style>
+
+
+</head>
+
+<body lang="en">
+
+<p><span class="sc">in sc</span>. OUT.
+</p>
+<div class="example">
+<pre class="example-preformatted"><span class="sc">small case in 
example</span> MORE text.
+</pre></div>
+
+
+
+
+</body>
+</html>



reply via email to

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