texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/ext/tex4ht.pm (tex4ht_process_format): remov


From: Patrice Dumas
Subject: branch master updated: * tp/ext/tex4ht.pm (tex4ht_process_format): remove leading and trailing spaces in case of @math. Report from Vincent Lefèvre.
Date: Sat, 15 Oct 2022 08:22:50 -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 d4859fe1fd * tp/ext/tex4ht.pm (tex4ht_process_format): remove leading 
and trailing spaces in case of @math.  Report from Vincent Lefèvre.
d4859fe1fd is described below

commit d4859fe1fd4fe94e0fd7790e50489de48079bffe
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 15 14:22:40 2022 +0200

    * tp/ext/tex4ht.pm (tex4ht_process_format): remove leading and
    trailing spaces in case of @math.  Report from Vincent Lefèvre.
---
 ChangeLog                                            |  5 +++++
 tp/ext/tex4ht.pm                                     |  8 +++++++-
 .../encod\303\251/tex_complex.html"                  | 16 ++++++++--------
 .../encod\303\251/tex_encod\303\251_utf8.html"       |  4 ++--
 tp/tests/many_input_files/tex_t4ht_res/tex.html      | 20 ++++++++++----------
 .../many_input_files/tex_t4ht_res/tex_complex.html   | 16 ++++++++--------
 .../res_parser/tex_complex_httex/tex_complex.html    | 16 ++++++++--------
 .../tex_encoded_latin1_httex/tex_encode_latin1.html  |  4 ++--
 .../tex_encod\303\251_utf8.html"                     |  4 ++--
 .../tex_html/res_parser/tex_gdef_httex/tex_gdef.html |  4 ++--
 tp/tests/tex_html/res_parser/tex_httex/tex.html      | 20 ++++++++++----------
 11 files changed, 64 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index eb18e40417..f72063b3a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-10-15  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/ext/tex4ht.pm (tex4ht_process_format): remove leading and
+       trailing spaces in case of @math.  Report from Vincent Lefèvre.
+
 2022-10-15  Patrice Dumas  <pertusus@free.fr>
 
        add @latex to t4h and some customization
diff --git a/tp/ext/tex4ht.pm b/tp/ext/tex4ht.pm
index 772d9977e7..6fb0e27ebf 100644
--- a/tp/ext/tex4ht.pm
+++ b/tp/ext/tex4ht.pm
@@ -417,7 +417,13 @@ sub tex4ht_process_format($$) {
         #print STDERR "while search $cmdname $count $line";
         if ($line =~ /!-- tex4ht_end $formats{$format}->{'basename'} $cmdname 
$count --/) {
           $got_count++;
-          chomp($text) if ($cmdname eq 'math');
+          if ($cmdname eq 'math') {
+            chomp($text);
+            # tex4ht may add spaces that we do not need.  Actual content
+            # should in any case be in HTML elements.
+            $text =~ s/^\s*//;
+            $text =~ s/\s*$//;
+          }
           $commands{$cmdname}->{'results'}->{
                            $formats{$format}->{'commands'}->[$count-1]} = 
$text;
           $end_found = 1;
diff --git 
"a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_complex.html"
 
"b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_complex.html"
index 9f29f50179..703428e14c 100644
--- 
"a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_complex.html"
+++ 
"b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_complex.html"
@@ -37,12 +37,12 @@ src="tex_complex_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x03C6;(t
 " class="math-display" ></div>
 <!--l. 6--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p><hr>
 
 
@@ -56,12 +56,12 @@ src="tex_complex_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x03C6;(t
 " class="math-display" ></div>
 <!--l. 6--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p>
 <p>Tex:
 
@@ -72,9 +72,9 @@ UwV
 " class="math-display" ></div>
 <!--l. 13--><p class="indent" >     
 </p>
-<p>and math  <span 
+<p>and math <span 
 class="cmmi-10">&#x03D5;wV</span> <sup><span 
-class="cmmi-7">t</span></sup> .
+class="cmmi-7">t</span></sup>.
 </p>
 <p>Now there is a footnote<a class="footnote" id="DOCF1" 
href="#FOOT1"><sup>1</sup></a>
 </p>
@@ -90,10 +90,10 @@ src="tex_complex_tex4ht_tex2x.png" alt="&#x03C9; = 
h(&#x03B7;,&#x03C6; )
 " class="math-display" ></div>
 <!--l. 20--><p class="indent" >     
 
-<p>and math  <span 
+<p>and math <span 
 class="cmmi-10">h</span><img 
 src="tex_complex_tex4ht_tex3x.png" alt="&#x03C8;&#x02D9;"  class="dot" 
><sup><span 
-class="cmmi-7">&#x03D5;</span></sup> .
+class="cmmi-7">&#x03D5;</span></sup>.
 </p>
 </div>
 <hr>
diff --git 
"a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
 
"b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
index 7636e8de23..cea19bc99e 100644
--- 
"a/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
+++ 
"b/tp/tests/many_input_files/tex_t4ht_output_dir_non_ascii_res/encod\303\251/tex_encod\303\251_utf8.html"
@@ -63,12 +63,12 @@ src="tex_encodé_utf8_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x
 " class="math-display" ></div>
 <!--l. 7--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p>
 
     <div class="math-display" >
diff --git a/tp/tests/many_input_files/tex_t4ht_res/tex.html 
b/tp/tests/many_input_files/tex_t4ht_res/tex.html
index f6cc8b0f03..93c167f0a3 100644
--- a/tp/tests/many_input_files/tex_t4ht_res/tex.html
+++ b/tp/tests/many_input_files/tex_t4ht_res/tex.html
@@ -45,44 +45,44 @@ Some text one the line following @end tex
 <p>Same that @html (but empty following line not ignored).
 </p>
 <p>Test of @math
-Here some    <span 
+Here some <span 
 class="cmmi-7">x</span><sup><span 
 class="cmmi-5">i</span></sup> __
 <span 
 class="cmr-7">tan</span> <span 
-class="cmmi-7">y</span> .
+class="cmmi-7">y</span>.
 </p>
 <p>Maths with protected \:
- <span 
+<span 
 class="cmmi-10">a</span>@<span 
-class="cmmi-10">&#x00A0;b</span> .
+class="cmmi-10">&#x00A0;b</span>.
 </p>
 <p>Maths with code @-command:
 </p>
-<p> @<span 
+<p>@<span 
 class="cmmi-10">code</span><span 
 class="cmmi-10">mathcode</span><span 
-class="cmmi-10">a &#x003C; b</span> 
+class="cmmi-10">a &#x003C; b</span>
 </p>
 <p>Maths with code @-command and braces:
 </p>
-<p> <span class="underline">@<span 
+<p><span class="underline">@<span 
 class="cmmi-10">code</span><span 
 class="cmmi-10">math</span> code </span><span 
 class="cmex-10">&#x2211;</span>
   <sub><span 
 class="cmmi-7">i</span></sub><span class="underline"><span 
-class="cmmi-10">f</span></span> 
+class="cmmi-10">f</span></span>
 </p>
 <p>Maths with @-sup
 </p>
-<p> <span 
+<p><span 
 class="cmex-10">&#x2211;</span>
   <sub><span 
 class="cmmi-7">i</span></sub><span 
 class="cmmi-10">f</span>(<span 
 class="cmmi-10">x</span>)@<span 
-class="cmmi-10">sup</span>2 
+class="cmmi-10">sup</span>2
 </p>
 <p>@\ outside of math
 </p>
diff --git a/tp/tests/many_input_files/tex_t4ht_res/tex_complex.html 
b/tp/tests/many_input_files/tex_t4ht_res/tex_complex.html
index 9f29f50179..703428e14c 100644
--- a/tp/tests/many_input_files/tex_t4ht_res/tex_complex.html
+++ b/tp/tests/many_input_files/tex_t4ht_res/tex_complex.html
@@ -37,12 +37,12 @@ src="tex_complex_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x03C6;(t
 " class="math-display" ></div>
 <!--l. 6--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p><hr>
 
 
@@ -56,12 +56,12 @@ src="tex_complex_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x03C6;(t
 " class="math-display" ></div>
 <!--l. 6--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p>
 <p>Tex:
 
@@ -72,9 +72,9 @@ UwV
 " class="math-display" ></div>
 <!--l. 13--><p class="indent" >     
 </p>
-<p>and math  <span 
+<p>and math <span 
 class="cmmi-10">&#x03D5;wV</span> <sup><span 
-class="cmmi-7">t</span></sup> .
+class="cmmi-7">t</span></sup>.
 </p>
 <p>Now there is a footnote<a class="footnote" id="DOCF1" 
href="#FOOT1"><sup>1</sup></a>
 </p>
@@ -90,10 +90,10 @@ src="tex_complex_tex4ht_tex2x.png" alt="&#x03C9; = 
h(&#x03B7;,&#x03C6; )
 " class="math-display" ></div>
 <!--l. 20--><p class="indent" >     
 
-<p>and math  <span 
+<p>and math <span 
 class="cmmi-10">h</span><img 
 src="tex_complex_tex4ht_tex3x.png" alt="&#x03C8;&#x02D9;"  class="dot" 
><sup><span 
-class="cmmi-7">&#x03D5;</span></sup> .
+class="cmmi-7">&#x03D5;</span></sup>.
 </p>
 </div>
 <hr>
diff --git a/tp/tests/tex_html/res_parser/tex_complex_httex/tex_complex.html 
b/tp/tests/tex_html/res_parser/tex_complex_httex/tex_complex.html
index 9f29f50179..703428e14c 100644
--- a/tp/tests/tex_html/res_parser/tex_complex_httex/tex_complex.html
+++ b/tp/tests/tex_html/res_parser/tex_complex_httex/tex_complex.html
@@ -37,12 +37,12 @@ src="tex_complex_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x03C6;(t
 " class="math-display" ></div>
 <!--l. 6--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p><hr>
 
 
@@ -56,12 +56,12 @@ src="tex_complex_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x03C6;(t
 " class="math-display" ></div>
 <!--l. 6--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p>
 <p>Tex:
 
@@ -72,9 +72,9 @@ UwV
 " class="math-display" ></div>
 <!--l. 13--><p class="indent" >     
 </p>
-<p>and math  <span 
+<p>and math <span 
 class="cmmi-10">&#x03D5;wV</span> <sup><span 
-class="cmmi-7">t</span></sup> .
+class="cmmi-7">t</span></sup>.
 </p>
 <p>Now there is a footnote<a class="footnote" id="DOCF1" 
href="#FOOT1"><sup>1</sup></a>
 </p>
@@ -90,10 +90,10 @@ src="tex_complex_tex4ht_tex2x.png" alt="&#x03C9; = 
h(&#x03B7;,&#x03C6; )
 " class="math-display" ></div>
 <!--l. 20--><p class="indent" >     
 
-<p>and math  <span 
+<p>and math <span 
 class="cmmi-10">h</span><img 
 src="tex_complex_tex4ht_tex3x.png" alt="&#x03C8;&#x02D9;"  class="dot" 
><sup><span 
-class="cmmi-7">&#x03D5;</span></sup> .
+class="cmmi-7">&#x03D5;</span></sup>.
 </p>
 </div>
 <hr>
diff --git 
a/tp/tests/tex_html/res_parser/tex_encoded_latin1_httex/tex_encode_latin1.html 
b/tp/tests/tex_html/res_parser/tex_encoded_latin1_httex/tex_encode_latin1.html
index fdb606deab..05bd492642 100644
--- 
a/tp/tests/tex_html/res_parser/tex_encoded_latin1_httex/tex_encode_latin1.html
+++ 
b/tp/tests/tex_html/res_parser/tex_encoded_latin1_httex/tex_encode_latin1.html
@@ -64,12 +64,12 @@ src="tex_encode_latin1_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x0
 " class="math-display" ></div>
 <!--l. 7--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p>
 
     <div class="math-display" >
diff --git 
"a/tp/tests/tex_html/res_parser/tex_encoded_utf8_httex/tex_encod\303\251_utf8.html"
 
"b/tp/tests/tex_html/res_parser/tex_encoded_utf8_httex/tex_encod\303\251_utf8.html"
index 7636e8de23..cea19bc99e 100644
--- 
"a/tp/tests/tex_html/res_parser/tex_encoded_utf8_httex/tex_encod\303\251_utf8.html"
+++ 
"b/tp/tests/tex_html/res_parser/tex_encoded_utf8_httex/tex_encod\303\251_utf8.html"
@@ -63,12 +63,12 @@ src="tex_encodé_utf8_tex4ht_tex0x.png" 
alt="&#x2202;&#x03B7;g(&#x03B7;(t),&#x
 " class="math-display" ></div>
 <!--l. 7--><p class="indent" >     
 
-<p>Some  (<span 
+<p>Some (<span 
 class="cmmi-10">I </span><span 
 class="cmsy-10">- </span><span 
 class="cmmi-10">D</span>)<span 
 class="cmmi-10">&#x03C6;</span>(<span 
-class="cmmi-10">t</span>)  math.
+class="cmmi-10">t</span>) math.
 </p>
 
     <div class="math-display" >
diff --git a/tp/tests/tex_html/res_parser/tex_gdef_httex/tex_gdef.html 
b/tp/tests/tex_html/res_parser/tex_gdef_httex/tex_gdef.html
index 056597b817..6c288efe81 100644
--- a/tp/tests/tex_html/res_parser/tex_gdef_httex/tex_gdef.html
+++ b/tp/tests/tex_html/res_parser/tex_gdef_httex/tex_gdef.html
@@ -31,7 +31,7 @@ span.program-in-footer {font-size: smaller}
 
 
 
-<p> <span 
+<p><span 
 class="cmr-7">def</span>
   <span 
 class="cmsy-10">&#x2261;</span> <span 
@@ -39,7 +39,7 @@ class="cmmi-10">a </span><span
 class="cmsy-10">&#x2261; </span><span 
 class="cmmi-10">b</span><img 
 src="tex_gdef_tex4ht_tex0x.png" alt="&#x221A; --
-  64"  class="sqrt" > 
+  64"  class="sqrt" >
 </p>
 
     <div class="math-display" >
diff --git a/tp/tests/tex_html/res_parser/tex_httex/tex.html 
b/tp/tests/tex_html/res_parser/tex_httex/tex.html
index f6cc8b0f03..93c167f0a3 100644
--- a/tp/tests/tex_html/res_parser/tex_httex/tex.html
+++ b/tp/tests/tex_html/res_parser/tex_httex/tex.html
@@ -45,44 +45,44 @@ Some text one the line following @end tex
 <p>Same that @html (but empty following line not ignored).
 </p>
 <p>Test of @math
-Here some    <span 
+Here some <span 
 class="cmmi-7">x</span><sup><span 
 class="cmmi-5">i</span></sup> __
 <span 
 class="cmr-7">tan</span> <span 
-class="cmmi-7">y</span> .
+class="cmmi-7">y</span>.
 </p>
 <p>Maths with protected \:
- <span 
+<span 
 class="cmmi-10">a</span>@<span 
-class="cmmi-10">&#x00A0;b</span> .
+class="cmmi-10">&#x00A0;b</span>.
 </p>
 <p>Maths with code @-command:
 </p>
-<p> @<span 
+<p>@<span 
 class="cmmi-10">code</span><span 
 class="cmmi-10">mathcode</span><span 
-class="cmmi-10">a &#x003C; b</span> 
+class="cmmi-10">a &#x003C; b</span>
 </p>
 <p>Maths with code @-command and braces:
 </p>
-<p> <span class="underline">@<span 
+<p><span class="underline">@<span 
 class="cmmi-10">code</span><span 
 class="cmmi-10">math</span> code </span><span 
 class="cmex-10">&#x2211;</span>
   <sub><span 
 class="cmmi-7">i</span></sub><span class="underline"><span 
-class="cmmi-10">f</span></span> 
+class="cmmi-10">f</span></span>
 </p>
 <p>Maths with @-sup
 </p>
-<p> <span 
+<p><span 
 class="cmex-10">&#x2211;</span>
   <sub><span 
 class="cmmi-7">i</span></sub><span 
 class="cmmi-10">f</span>(<span 
 class="cmmi-10">x</span>)@<span 
-class="cmmi-10">sup</span>2 
+class="cmmi-10">sup</span>2
 </p>
 <p>@\ outside of math
 </p>



reply via email to

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