[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): correct 'quote'. |
Date: |
Wed, 02 Oct 2024 06:10:07 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 8f213a4078 * tp/Texinfo/Config.pm
(texinfo_register_style_command_formatting): correct 'quote'.
8f213a4078 is described below
commit 8f213a4078cb80c65a5d6a5551e2bb28183a2f2c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 31 09:08:11 2024 +0200
* tp/Texinfo/Config.pm (texinfo_register_style_command_formatting):
correct 'quote'.
* tp/Texinfo/Config.pm (GNUT_get_no_arg_command_formatting): use
GNUT_no_arg_commands_formatting_strings for context check.
* tp/Texinfo/Convert/HTML.pm (%default_style_commands_formatting):
rename %style_commands_formatting as
%default_style_commands_formatting.
* doc/texi2any_api.texi (Simple Output Customization for Simple
Commands with Braces), tp/Texinfo/Config.pm
(@all_style_commands_formatting_context)
(_GNUT_initialize_style_commands_formatting_info),
tp/Texinfo/Convert/HTML.pm (@style_commands_contexts)
(@no_args_commands_contexts), tp/init/documentation_examples.pm,
tp/init/sc_formatting_with_css.pm: do not set string context for style
commands. Use variables for the list of contexts.
* tp/Texinfo/Convert/HTML.pm (converter_initialize): get all the
style commands formatting customization in
%style_commands_customized_formatting_info before applying it.
---
ChangeLog | 33 ++++++++++--
doc/texi2any_api.texi | 26 +++++-----
tp/Texinfo/Config.pm | 10 ++--
tp/Texinfo/Convert/HTML.pm | 60 +++++++++++++++-------
tp/Texinfo/XS/main/converter_types.h | 3 ++
tp/init/documentation_examples.pm | 4 +-
tp/init/sc_formatting_with_css.pm | 2 +-
.../res_html/prepended_to_filenames-chapter.html | 2 +-
.../res_html/documentation_examples_texi2html.html | 2 +-
9 files changed, 96 insertions(+), 46 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 45bc09486f..5804c4d3a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,27 @@
-2024-10-02 Patrice Dumas <pertusus@free.fr>
+2024-07-31 Patrice Dumas <pertusus@free.fr>
- * tp/Texinfo/XS/convert/get_converter_perl_info.c
- (converter_initialize): readd converter_initialize that was mistakenly
- removed.
+ * tp/Texinfo/Config.pm (texinfo_register_style_command_formatting):
+ correct 'quote'.
+
+ * tp/Texinfo/Config.pm (GNUT_get_no_arg_command_formatting): use
+ GNUT_no_arg_commands_formatting_strings for context check.
+
+ * tp/Texinfo/Convert/HTML.pm (%default_style_commands_formatting):
+ rename %style_commands_formatting as
+ %default_style_commands_formatting.
+
+ * doc/texi2any_api.texi (Simple Output Customization for Simple
+ Commands with Braces), tp/Texinfo/Config.pm
+ (@all_style_commands_formatting_context)
+ (_GNUT_initialize_style_commands_formatting_info),
+ tp/Texinfo/Convert/HTML.pm (@style_commands_contexts)
+ (@no_args_commands_contexts), tp/init/documentation_examples.pm,
+ tp/init/sc_formatting_with_css.pm: do not set string context for style
+ commands. Use variables for the list of contexts.
+
+ * tp/Texinfo/Convert/HTML.pm (converter_initialize): get all the
+ style commands formatting customization in
+ %style_commands_customized_formatting_info before applying it.
2024-07-30 Patrice Dumas <pertusus@free.fr>
@@ -149,6 +168,12 @@
Add an init file to replace the button directions with the customized
special unit direction.
+2024-10-02 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/get_converter_perl_info.c
+ (converter_initialize): readd converter_initialize that was mistakenly
+ removed.
+
2024-07-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (direction_string)
diff --git a/doc/texi2any_api.texi b/doc/texi2any_api.texi
index d0cab68d4c..81ce3bbfc6 100644
--- a/doc/texi2any_api.texi
+++ b/doc/texi2any_api.texi
@@ -686,39 +686,37 @@ arguments (e.g., @code{@@asis}, @code{@@clicksequence},
@code{@@sup},
@defun texinfo_register_style_command_formatting ($command_name, @
$html_element, $in_quotes, $context)
@var{$command_name} is the @@-command name, without the leading @@.
-@var{$context} is @samp{normal}, @samp{preformatted} or @samp{string}.
+@var{$context} is @samp{normal} or @samp{preformatted}.
There is no separate math context, @samp{preformatted} should be used
-for math context. @xref{Init File Expansion Contexts}. If @var{$context}
+for math context. @xref{Init File Expansion Contexts}. There is no string
+context either, as in string context simple formatting without the need
+for per command information should be sufficient. If @var{$context}
is @code{undef}, the @samp{normal} context is assumed.
If @var{$html_element} is set, the argument is enclosed between the
@var{$html_element} element opening and the element closing.
-@var{$html_element} is always ignored in @samp{string} context. If
@var{$in_quotes}
-is true, the result is enclosed in quotes
-associated with customization variables @code{OPEN_QUOTE_SYMBOL} and
-@code{CLOSE_QUOTE_SYMBOL} (@pxref{Customization of HTML Code Inserted,,,
-texinfo, Texinfo}).
+If @var{$in_quotes} is true, the result is enclosed in quotes associated with
+customization variables @code{OPEN_QUOTE_SYMBOL} and @code{CLOSE_QUOTE_SYMBOL}
+(@pxref{Customization of HTML Code Inserted,,, texinfo, Texinfo}).
-If @var{$html_element} is undefined and @var{$in_quotes} is not set, the
formatted
-argument is output as is.
+If @var{$html_element} is undefined and @var{$in_quotes} is not set,
+the formatted argument is output as is.
@end defun
For example, to set @code{@@sansserif@{argument@}} to be formatted as
@code{<code>@var{argument}</code>} in normal and preformatted context,
-and as a quoted string in string context, use:
+with quotes in preformatted context, use:
@example
texinfo_register_style_command_formatting('sansserif', 'code', 0,
'normal');
-texinfo_register_style_command_formatting('sansserif', 'code', 0,
+texinfo_register_style_command_formatting('sansserif', 'code', 1,
'preformatted');
-texinfo_register_style_command_formatting('sansserif', undef, 1,
- 'string');
@end example
To output the formatted argument of @code{@@t} as is:
@example
-foreach my $context ('normal', 'preformatted', 'string') @{
+foreach my $context ('normal', 'preformatted') @{
texinfo_register_style_command_formatting ('t', undef,
undef, $context);
@}
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index 5f99809b56..8d9f7c43be 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -599,12 +599,16 @@ sub _GNUT_initialize_no_arg_commands_formatting_strings()
}
}
+my @all_style_commands_formatting_context = ($default_formatting_context,
+ 'preformatted');
+
_GNUT_initialize_no_arg_commands_formatting_strings();
sub _GNUT_initialize_style_commands_formatting_info()
{
$GNUT_style_commands_formatting_info = {};
- foreach my $possible_formatting_context (@all_possible_formatting_context) {
+ foreach my $possible_formatting_context
+ (@all_style_commands_formatting_context) {
$GNUT_style_commands_formatting_info->{$possible_formatting_context} = {};
}
}
@@ -673,7 +677,7 @@ sub GNUT_get_no_arg_command_formatting($;$)
if (!defined($context)) {
$context = $default_formatting_context;
- } elsif (not defined($GNUT_style_commands_formatting_info->{$context})) {
+ } elsif (not defined($GNUT_no_arg_commands_formatting_strings->{$context})) {
_GNUT_document_warn(sprintf(__("%s: unknown formatting context %s\n"),
'GNUT_get_no_arg_command_formatting', $context));
return undef;
@@ -702,7 +706,7 @@ sub texinfo_register_style_command_formatting($$;$$)
}
my $specification = {};
if ($in_quotes) {
- $specification->{'quotes'} = $in_quotes;
+ $specification->{'quote'} = $in_quotes;
}
if (defined($html_element)) {
$specification->{'element'} = $html_element;
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c85d8de289..f84e13caa6 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2633,6 +2633,10 @@ my %default_converted_directions_strings
my %default_translated_directions_strings
= %{ Texinfo::Data::get_default_translated_directions_strings() };
+my @style_commands_contexts = ('normal', 'preformatted');
+my @no_args_commands_contexts
+ = ('normal', 'preformatted', 'string', 'css_string');
+
sub _translate_names($)
{
my $self = shift;
@@ -2679,7 +2683,7 @@ sub _translate_names($)
}
my %translated_commands;
foreach my $command (keys(%{$self->{'no_arg_commands_formatting'}})) {
- foreach my $context ('normal', 'preformatted', 'string', 'css_string') {
+ foreach my $context (@no_args_commands_contexts) {
if (defined($self->{'no_arg_commands_formatting'}
->{$command}->{$context}->{'translated_converted'})
and not $self->{'no_arg_commands_formatting'}
@@ -3149,7 +3153,7 @@ my %default_upper_case_commands = ( 'sc' => 1 );
my %style_commands_element
= %{ Texinfo::Data::get_html_style_commands_element() };
-my %style_commands_formatting;
+my %default_style_commands_formatting;
my %style_brace_types = map {$_ => 1} ('style_other', 'style_code',
'style_no_code');
@@ -3163,30 +3167,33 @@ my @all_style_commands = keys %{{ map { $_ => 1 }
((grep {$style_brace_types{$brace_commands{$_}}} keys(%brace_commands)),
keys(%style_commands_element), keys(%quoted_style_commands)) }};
+# NOTE only normal and preformatted contexts are used. css strings
+# are formatted in string context, and in string context the argument
+# is returned as is.
foreach my $command (@all_style_commands) {
# indicateurl is formatted with a specific function
next if ($command eq 'indicateurl');
- $style_commands_formatting{$command} = {};
+ $default_style_commands_formatting{$command} = {};
# default is no element.
- foreach my $context ('normal', 'string', 'preformatted') {
- $style_commands_formatting{$command}->{$context} = {}
+ foreach my $context (@style_commands_contexts) {
+ $default_style_commands_formatting{$command}->{$context} = {}
}
if (exists($style_commands_element{$command})) {
my $html_element = $style_commands_element{$command};
- foreach my $context ('normal', 'preformatted') {
- $style_commands_formatting{$command}->{$context}
+ foreach my $context (@style_commands_contexts) {
+ $default_style_commands_formatting{$command}->{$context}
= {'element' => $html_element};
}
}
if ($quoted_style_commands{$command}) {
- foreach my $context ('normal', 'string', 'preformatted') {
- $style_commands_formatting{$command}->{$context}->{'quote'} = 1;
+ foreach my $context (@style_commands_contexts) {
+ $default_style_commands_formatting{$command}->{$context}->{'quote'} = 1;
}
}
$default_commands_conversion{$command} = \&_convert_style_command;
}
-$style_commands_formatting{'sc'}->{'preformatted'}->{'element'} = 'span';
+$default_style_commands_formatting{'sc'}->{'preformatted'}->{'element'} =
'span';
# currently unused, could be re-used if there is a need to have attributes
# specified in %style_commands_element
@@ -8859,18 +8866,33 @@ sub converter_initialize($)
}
}
- $self->{'style_commands_formatting'} = {};
- foreach my $command (keys(%style_commands_formatting)) {
- $self->{'style_commands_formatting'}->{$command} = {};
- foreach my $context (keys(%{$style_commands_formatting{$command}})) {
+ # get all the customization
+ my %style_commands_customized_formatting_info = ();
+ foreach my $command (keys(%default_style_commands_formatting)) {
+ foreach my $context (@style_commands_contexts) {
my $style_commands_formatting_info
= Texinfo::Config::GNUT_get_style_command_formatting($command,
$context);
if (defined($style_commands_formatting_info)) {
+ if (!$style_commands_customized_formatting_info{$command}) {
+ $style_commands_customized_formatting_info{$command} = {};
+ }
+ $style_commands_customized_formatting_info{$command}->{$context}
+ = $style_commands_formatting_info;
+ }
+ }
+ }
+
+ $self->{'style_commands_formatting'} = {};
+ foreach my $command (keys(%default_style_commands_formatting)) {
+ $self->{'style_commands_formatting'}->{$command} = {};
+ foreach my $context (@style_commands_contexts) {
+ if ($style_commands_customized_formatting_info{$command}
+ and
$style_commands_customized_formatting_info{$command}->{$context}) {
$self->{'style_commands_formatting'}->{$command}->{$context}
- = $style_commands_formatting_info;
- } elsif (exists($style_commands_formatting{$command}->{$context})) {
+ = $style_commands_customized_formatting_info{$command}->{$context};
+ } elsif
(exists($default_style_commands_formatting{$command}->{$context})) {
$self->{'style_commands_formatting'}->{$command}->{$context}
- = $style_commands_formatting{$command}->{$context};
+ = $default_style_commands_formatting{$command}->{$context};
}
}
}
@@ -8906,7 +8928,7 @@ sub converter_initialize($)
$self->{'customized_no_arg_commands_formatting'} = {};
foreach my $command (keys(%{$default_no_arg_commands_formatting{'normal'}}))
{
$self->{'customized_no_arg_commands_formatting'}->{$command} = {};
- foreach my $context ('normal', 'preformatted', 'string', 'css_string') {
+ foreach my $context (@no_args_commands_contexts) {
my $no_arg_command_customized_formatting
= Texinfo::Config::GNUT_get_no_arg_command_formatting($command,
$context);
@@ -11949,7 +11971,7 @@ sub conversion_initialization($$;$)
$self->{'no_arg_commands_formatting'} = {};
foreach my $command (keys(%{$default_no_arg_commands_formatting{'normal'}}))
{
$self->{'no_arg_commands_formatting'}->{$command} = {};
- foreach my $context ('normal', 'preformatted', 'string', 'css_string') {
+ foreach my $context (@no_args_commands_contexts) {
my $no_arg_command_customized_formatting
= $self->{'customized_no_arg_commands_formatting'}
->{$command}->{$context};
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index cef28b91f9..d43b4acf88 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -809,6 +809,9 @@ typedef struct CONVERTER {
HTML_STAGE_HANDLER_INFO_LIST html_stage_handlers[HSHT_type_finish +1];
HTML_COMMAND_CONVERSION
*customized_no_arg_commands_formatting[BUILTIN_CMD_NUMBER][HCC_type_css_string+1];
/* set for a converter, modified in a document */
+ /* for both no args commands and style commands.
+ Only normal and preformatted HCC_type are actually used for
+ style commands */
HTML_COMMAND_CONVERSION
html_command_conversion[BUILTIN_CMD_NUMBER][HCC_type_css_string+1];
char ***customized_directions_strings[(TDS_TYPE_MAX_NR) -
(TDS_TRANSLATED_MAX_NR)];
char ***directions_strings[TDS_TYPE_MAX_NR];
diff --git a/tp/init/documentation_examples.pm
b/tp/init/documentation_examples.pm
index 72b2690752..c0cde86752 100644
--- a/tp/init/documentation_examples.pm
+++ b/tp/init/documentation_examples.pm
@@ -54,9 +54,7 @@ $translations{'fr'}->{'is the @strong{same} as'}
= {'' => 'est la @strong{m@^eme} que',};
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_style_command_formatting('sansserif', 'code', 1,
'preformatted');
texinfo_register_upper_case_command('sc', 0);
texinfo_register_upper_case_command('var', 1);
diff --git a/tp/init/sc_formatting_with_css.pm
b/tp/init/sc_formatting_with_css.pm
index d78111131e..09adb5dfb9 100644
--- a/tp/init/sc_formatting_with_css.pm
+++ b/tp/init/sc_formatting_with_css.pm
@@ -2,7 +2,7 @@ use strict;
texinfo_register_upper_case_command('sc', 0);
-foreach my $context ('normal', 'preformatted', 'string') {
+foreach my $context ('normal', 'preformatted') {
texinfo_register_style_command_formatting ('sc', 'span',
undef, $context);
}
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 1adbacdb81..b125cc7f0c 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
@@ -50,7 +50,7 @@ Next: <a href="prepended_to_filenames-my-node.html"
accesskey="n" rel="next">New
<p><em class="math jax_p"><span class="math-arg"><code
class="sansserif">in--math</code> ­ a=b error--> is the <strong
class="strong">same</strong> as</span></em>
<code>HTML</code> text </p>
<table class="indentedblock"><tr><td> </tr></td><div class="example">
-<pre class="example-preformatted"><code class="sansserif">in--example</code>
­ c. error--> is the <strong class="strong">same</strong> as
+<pre class="example-preformatted">‘<code
class="sansserif">in--example</code>’ ­ c. error--> is the <strong
class="strong">same</strong> as
<var><a class="email" href="mailto:a@example">a@example Generated <em
class="emph">a sunny day</em> using <a class="uref"
href="http://www.gnu.org/software/texinfo/"><em class="emph"></em></a>. (<a
class="myurl" href="a@example">a@example</a>);</a> [undefined
text-align:center, is undef|end|separate]</var>
</pre></div>
</td></tr></table>
diff --git
a/tp/t/results/init_files_tests/documentation_examples_texi2html/res_html/documentation_examples_texi2html.html
b/tp/t/results/init_files_tests/documentation_examples_texi2html/res_html/documentation_examples_texi2html.html
index aecc20c7d8..0ecb3e39b4 100644
---
a/tp/t/results/init_files_tests/documentation_examples_texi2html/res_html/documentation_examples_texi2html.html
+++
b/tp/t/results/init_files_tests/documentation_examples_texi2html/res_html/documentation_examples_texi2html.html
@@ -115,7 +115,7 @@ Appendices
<p><em class="math jax_p"><span class="math-arg"><code
class="sansserif">in--math</code> ­ a=b error--> is the <strong
class="strong">same</strong> as</span></em>
<code>HTML</code> text </p>
<table class="indentedblock"><tr><td> </tr></td><div class="example">
-<pre class="example-preformatted"><code class="sansserif">in--example</code>
­ c. error--> is the <strong class="strong">same</strong> as
+<pre class="example-preformatted">‘<code
class="sansserif">in--example</code>’ ­ c. error--> is the <strong
class="strong">same</strong> as
<var><a class="email" href="mailto:a@example">a@example Generated <em
class="emph">a sunny day</em> using <a class="uref"
href="http://www.gnu.org/software/texinfo/"><em class="emph"></em></a>. (<a
class="myurl" href="a@example">a@example</a>);</a> [undefined
text-align:center, is undef|separate|separate]</var>
</pre></div>
</td></tr></table>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Config.pm (texinfo_register_style_command_formatting): correct 'quote'.,
Patrice Dumas <=