[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Mon, 3 Jun 2024 07:23:12 -0400 (EDT) |
branch: release/7.1
commit b663f32bd343677b7aae11964d395ddf20279362
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jan 23 20:02:24 2024 +0100
* tp/Texinfo/Convert/HTML.pm (_convert_tab_command): round using
%.0f to be more accurate than with %d.
* tp/Makefile.tres, tp/t/html_tests.t (fractions_rounding): add a test
that shows an incorrect percent rounding with %d with perl.
---
ChangeLog | 8 +
tp/Makefile.tres | 1 +
tp/Texinfo/Convert/HTML.pm | 6 +-
tp/t/html_tests.t | 9 +
tp/t/results/html_tests/fractions_rounding.pl | 450 ++++++++++++++++++++++++++
5 files changed, 471 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1f511bdf30..f5e9fb09f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-01-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_tab_command): round using
+ %.0f to be more accurate than with %d.
+
+ * tp/Makefile.tres, tp/t/html_tests.t (fractions_rounding): add a test
+ that shows an incorrect percent rounding with %d with perl.
+
2024-05-01 Patrice Dumas <pertusus@free.fr>
Remove parent of @include or @setfilename source mark elements
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index dbe54a502a..24bdc50708 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -626,6 +626,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/html_tests/footnotestyle_separate_html_text_no_monolithic.pl \
t/results/html_tests/footnotestyle_separate_late.pl \
t/results/html_tests/footnotestyle_separate_late/res_html \
+ t/results/html_tests/fractions_rounding.pl \
t/results/html_tests/headings_after_lone_nodes.pl \
t/results/html_tests/html_in_copying.pl \
t/results/html_tests/image_link_prefix.pl \
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 5901e0db53..641ed95ceb 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5256,9 +5256,9 @@ sub _convert_tab_command($$$$$)
my $cf = $multitable->{'extra'}->{'columnfractions'};
if ($cf) {
if (exists($cf->{'extra'}->{'misc_args'}->[$cell_nr-1])) {
- my $fraction = sprintf('%d',
- 100*$cf->{'extra'}->{'misc_args'}->[$cell_nr-1]);
- $fractions = " width=\"$fraction%\"";
+ my $percent = sprintf('%.0f',
+ 100. *
$cf->{'extra'}->{'misc_args'}->[$cell_nr-1]);
+ $fractions = " width=\"$percent%\"";
}
}
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index 65435c7a1f..0db253a7a3 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -703,6 +703,15 @@ In top.
'
@titlefont{}
'],
+['end_of_line_in_uref',
+'See the @uref{https://gcc.gnu.org/codingconventions.html#Spelling
+Spelling, terminology and markup} section.'],
+['fractions_rounding',
+'@multitable @columnfractions .19 .30 .29 .22
+@item In contents @tab In contents @tab In
contents @tab Not in contents
+@item @code{@@chapter} @tab @code{@@unnumbered} @tab
@code{@@appendix} @tab @code{@@chapheading}
+@end multitable
+'],
['spaces_in_line_break_in_verb_w',
'@w{aaa bb
ccc}
diff --git a/tp/t/results/html_tests/fractions_rounding.pl
b/tp/t/results/html_tests/fractions_rounding.pl
new file mode 100644
index 0000000000..c55dfcfef8
--- /dev/null
+++ b/tp/t/results/html_tests/fractions_rounding.pl
@@ -0,0 +1,450 @@
+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{'fractions_rounding'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => '.19 .30 .29 .22'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'columnfractions',
+ 'extra' => {
+ 'misc_args' => [
+ '.19',
+ '.30',
+ '.29',
+ '.22'
+ ]
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'multitable',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => 'item',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'text' => 'In contents '
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 1
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ },
+ {
+ 'cmdname' => 'tab',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'text' => 'In contents '
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 2
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ },
+ {
+ 'cmdname' => 'tab',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'text' => 'In contents '
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 3
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ },
+ {
+ 'cmdname' => 'tab',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'text' => 'Not in contents
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 4
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ }
+ ],
+ 'extra' => {
+ 'row_number' => 1
+ },
+ 'type' => 'row'
+ },
+ {
+ 'contents' => [
+ {
+ 'cmdname' => 'item',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => '@'
+ },
+ {
+ 'text' => 'chapter'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'text' => ' '
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 1
+ },
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'cmdname' => 'tab',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => '@'
+ },
+ {
+ 'text' => 'unnumbered'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'text' => ' '
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 2
+ },
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'cmdname' => 'tab',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => '@'
+ },
+ {
+ 'text' => 'appendix'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'text' => ' '
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 3
+ },
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'cmdname' => 'tab',
+ 'contents' => [
+ {
+ 'text' => ' ',
+ 'type' => 'ignorable_spaces_after_command'
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => '@'
+ },
+ {
+ 'text' => 'chapheading'
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ {
+ 'text' => '
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'extra' => {
+ 'cell_number' => 4
+ },
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ }
+ ],
+ 'extra' => {
+ 'row_number' => 2
+ },
+ 'type' => 'row'
+ }
+ ],
+ 'type' => 'multitable_body'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'multitable'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'multitable'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 4
+ }
+ }
+ ],
+ 'extra' => {
+ 'columnfractions' => {},
+ 'max_columns' => 4
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'fractions_rounding'}{'contents'}[0]{'contents'}[0]{'extra'}{'columnfractions'}
=
$result_trees{'fractions_rounding'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+
+$result_texis{'fractions_rounding'} = '@multitable @columnfractions .19 .30
.29 .22
+@item In contents @tab In contents @tab In
contents @tab Not in contents
+@item @code{@@chapter} @tab @code{@@unnumbered} @tab
@code{@@appendix} @tab @code{@@chapheading}
+@end multitable
+';
+
+
+$result_texts{'fractions_rounding'} = 'In contents In contents
In contents Not in contents
+@chapter @unnumbered @appendix @chapheading
+';
+
+$result_errors{'fractions_rounding'} = [];
+
+
+$result_floats{'fractions_rounding'} = {};
+
+
+
+$result_converted{'html'}->{'fractions_rounding'} = '<!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>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+
+
+</head>
+
+<body lang="en">
+<table class="multitable">
+<tbody><tr><td width="19%">In contents</td><td width="30%">In contents</td><td
width="29%">In contents</td><td width="22%">Not in contents</td></tr>
+<tr><td width="19%"><code class="code">@chapter</code></td><td
width="30%"><code class="code">@unnumbered</code></td><td width="29%"><code
class="code">@appendix</code></td><td width="22%"><code
class="code">@chapheading</code></td></tr>
+</tbody>
+</table>
+
+
+
+</body>
+</html>
+';
+
+$result_converted_errors{'html'}->{'fractions_rounding'} = [
+ {
+ 'error_line' => 'warning: must specify a title with a title command or @top
+',
+ 'text' => 'must specify a title with a title command or @top',
+ 'type' => 'warning'
+ }
+];
+
+
+1;