[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/options_data.txt (_INLINE_STYLE_WIDT
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/options_data.txt (_INLINE_STYLE_WIDTH), tp/ext/epub3.pm (epub_setup), tp/Texinfo/Convert/HTML.pm (_convert_tab_command) (_convert_def_command), tp/Texinfo/XS/convert/convert_html.c (convert_tab_command, convert_def_command): add _INLINE_STYLE_WIDTH customization variable. Replace width attribute by inline CSS if _INLINE_STYLE_WIDTH is set. Set _INLINE_STYLE_WIDTH in epub3.pm if EPUB_STRICT is set. |
Date: |
Sun, 08 Sep 2024 03:55:21 -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 8fa0960529 * tp/Texinfo/options_data.txt (_INLINE_STYLE_WIDTH),
tp/ext/epub3.pm (epub_setup), tp/Texinfo/Convert/HTML.pm (_convert_tab_command)
(_convert_def_command), tp/Texinfo/XS/convert/convert_html.c
(convert_tab_command, convert_def_command): add _INLINE_STYLE_WIDTH
customization variable. Replace width attribute by inline CSS if
_INLINE_STYLE_WIDTH is set. Set _INLINE_STYLE_WIDTH in epub3.pm if EPUB_STRICT
is set.
8fa0960529 is described below
commit 8fa0960529561092da9adc728ef812f9cdbe1cbc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 8 09:55:22 2024 +0200
* tp/Texinfo/options_data.txt (_INLINE_STYLE_WIDTH), tp/ext/epub3.pm
(epub_setup), tp/Texinfo/Convert/HTML.pm (_convert_tab_command)
(_convert_def_command), tp/Texinfo/XS/convert/convert_html.c
(convert_tab_command, convert_def_command): add _INLINE_STYLE_WIDTH
customization variable. Replace width attribute by inline CSS if
_INLINE_STYLE_WIDTH is set. Set _INLINE_STYLE_WIDTH in epub3.pm if
EPUB_STRICT is set.
---
ChangeLog | 10 ++++++++++
tp/Texinfo/Convert/HTML.pm | 16 ++++++++++++++--
tp/Texinfo/XS/convert/convert_html.c | 10 ++++++++--
tp/Texinfo/options_data.txt | 3 +++
tp/ext/epub3.pm | 5 +++++
5 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3ad9813392..7ba30b3253 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-09-08 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/options_data.txt (_INLINE_STYLE_WIDTH), tp/ext/epub3.pm
+ (epub_setup), tp/Texinfo/Convert/HTML.pm (_convert_tab_command)
+ (_convert_def_command), tp/Texinfo/XS/convert/convert_html.c
+ (convert_tab_command, convert_def_command): add _INLINE_STYLE_WIDTH
+ customization variable. Replace width attribute by inline CSS if
+ _INLINE_STYLE_WIDTH is set. Set _INLINE_STYLE_WIDTH in epub3.pm if
+ EPUB_STRICT is set.
+
2024-09-07 Gavin Smith <gavinsmith0123@gmail.com>
* README-hacking: manual build of pod2texi.html not required
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 7b77ad4e47..ba8fcef8f7 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6043,7 +6043,12 @@ sub _convert_tab_command($$$$$)
if (exists($cf->{'extra'}->{'misc_args'}->[$cell_nr-1])) {
my $percent = sprintf('%.0f',
100. *
$cf->{'extra'}->{'misc_args'}->[$cell_nr-1]);
- $fractions = " width=\"$percent%\"";
+ my $width = "$percent%";
+ if ($self->get_conf('_INLINE_STYLE_WIDTH')) {
+ $fractions = " style=\"width: $width\"";
+ } else {
+ $fractions = " width=\"$width\"";
+ }
}
}
@@ -6994,7 +6999,14 @@ sub _convert_def_command($$$$$) {
return $self->html_attribute_class('dl', \@classes).">\n"
. $content ."</dl>\n";
} else {
- return $self->html_attribute_class('table', \@classes)." width=\"100%\">\n"
+ my $width = '100%';
+ my $width_attr;
+ if ($self->get_conf('_INLINE_STYLE_WIDTH')) {
+ $width_attr = "style=\"width: $width\"";
+ } else {
+ $width_attr = "width=\"$width\"";
+ }
+ return $self->html_attribute_class('table', \@classes)." $width_attr>\n"
. $content . "</table>\n";
}
}
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 974ec0aa9d..8dbe031728 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -12100,7 +12100,10 @@ convert_tab_command (CONVERTER *self, const enum
command_id cmd,
const char *fraction_str
= cf_misc_args->contents.list[cell_nr -1]->text.text;
double fraction = strtod (fraction_str, NULL);
- text_printf (result, " width=\"%0.f%%\"", 100 * fraction);
+ if (self->conf->_INLINE_STYLE_WIDTH.o.integer > 0)
+ text_printf (result, " style=\"width: %0.f%%\"", 100 * fraction);
+ else
+ text_printf (result, " width=\"%0.f%%\"", 100 * fraction);
}
}
text_append_n (result, ">", 1);
@@ -13835,7 +13838,10 @@ convert_def_command (CONVERTER *self, const enum
command_id cmd,
{
attribute_class = html_attribute_class (self, "table", classes);
text_append (result, attribute_class);
- text_append_n (result, " width=\"100%\">\n", 15);
+ if (self->conf->_INLINE_STYLE_WIDTH.o.integer > 0)
+ text_append_n (result, " style=\"width: 100%\">\n", 22);
+ else
+ text_append_n (result, " width=\"100%\">\n", 15);
if (content)
text_append (result, content);
text_append_n (result, "</table>\n", 9);
diff --git a/tp/Texinfo/options_data.txt b/tp/Texinfo/options_data.txt
index 8e054bf558..a92628fd96 100644
--- a/tp/Texinfo/options_data.txt
+++ b/tp/Texinfo/options_data.txt
@@ -340,6 +340,9 @@ XS_EXTERNAL_FORMATTING converter_customization
undef integer
# used for development tests, not sure that it will stay in the long term
XS_STRXFRM_COLLATION_LOCALE converter_customization undef char
+# used internally for EPUB
+_INLINE_STYLE_WIDTH converter_customization undef integer
+
# Not strings
LINKS_BUTTONS converter_other undef buttons
TOP_BUTTONS converter_other undef buttons
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index b9c7ecd152..8f6d33bb69 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -463,6 +463,11 @@ sub epub_setup($)
$nav_filename = $default_nav_filename;
$epub_file_nr = 1;
+
+ if ($self->get_conf('EPUB_STRICT')) {
+ $self->set_conf('_INLINE_STYLE_WIDTH', 1);
+ }
+
if (not defined($self->get_conf('EPUB_CREATE_CONTAINER_FILE'))) {
if (not $self->get_conf('TEST')) {
$self->set_conf('EPUB_CREATE_CONTAINER_FILE', 1);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/options_data.txt (_INLINE_STYLE_WIDTH), tp/ext/epub3.pm (epub_setup), tp/Texinfo/Convert/HTML.pm (_convert_tab_command) (_convert_def_command), tp/Texinfo/XS/convert/convert_html.c (convert_tab_command, convert_def_command): add _INLINE_STYLE_WIDTH customization variable. Replace width attribute by inline CSS if _INLINE_STYLE_WIDTH is set. Set _INLINE_STYLE_WIDTH in epub3.pm if EPUB_STRICT is set.,
Patrice Dumas <=