texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert),


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/texinfo.dtd, util/txixml2texi.pl: if the default command as argument for itemize is inserted, put it in a formattingcommand, with an automatic attribute set to on. Use that information in txixml2texi.
Date: Sat, 01 Oct 2022 07:17:11 -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 795135694f * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), 
util/texinfo.dtd, util/txixml2texi.pl: if the default command as argument for 
itemize is inserted, put it in a formattingcommand, with an automatic attribute 
set to on.  Use that information in txixml2texi.
795135694f is described below

commit 795135694fcdee19b42a07d6d89c6bb7559f32d5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 1 13:15:46 2022 +0200

    * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/texinfo.dtd,
    util/txixml2texi.pl: if the default command as argument for itemize
    is inserted, put it in a formattingcommand, with an automatic
    attribute set to on.  Use that information in txixml2texi.
    
    * util/txixml2texi.pl: handle rmacro.
---
 ChangeLog                                            |  9 +++++++++
 tp/Texinfo/Convert/TexinfoMarkup.pm                  |  9 ++++++---
 tp/t/results/coverage/item_container.pl              |  2 +-
 .../menu/block_commands_in_menu_description.pl       |  2 +-
 tp/t/results/xml_tests/comments_end_lines.pl         |  2 +-
 .../xml_tests/comments_on_block_command_lines.pl     |  2 +-
 .../layout/res_parser/formatting_xml/formatting.xml  |  8 ++++----
 util/texinfo.dtd                                     |  3 ++-
 util/txixml2texi.pl                                  | 20 ++++++++++++--------
 9 files changed, 37 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bd01d46d67..de42aa9c79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,15 @@
        @center @image more.  Attempt to fix spacing before @center
        @image.  Report from Werner.
 
+2022-10-01  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), util/texinfo.dtd,
+       util/txixml2texi.pl: if the default command as argument for itemize
+       is inserted, put it in a formattingcommand, with an automatic
+       attribute set to on.  Use that information in txixml2texi.
+
+       * util/txixml2texi.pl: handle rmacro.
+
 2022-10-01  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): add spaces attribute
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 41b8165102..5633d34ff5 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -593,10 +593,13 @@ sub _convert($$;$)
                         [['command', $element->{'extra'}->{'clickstyle'}]]);
       }
       if ($self->{'itemize_line'} and $element->{'type'}
-          and $element->{'type'} eq 'command_as_argument'
+          and ($element->{'type'} eq 'command_as_argument'
+               or $element->{'type'} eq 'command_as_argument_inserted')
           and !$element->{'args'}) {
-        return $self->txi_markup_element('formattingcommand',
-                                      [['command', $element->{'cmdname'}]]);
+        my $arguments = [['command', $element->{'cmdname'}]];
+        push @$arguments, ['automatic', 'on']
+          if ($element->{'type'} eq 'command_as_argument_inserted');
+        return $self->txi_markup_element('formattingcommand', $arguments);
       }
       return $self->_format_command($element->{'cmdname'});
     } elsif ($accent_types{$element->{'cmdname'}}) {
diff --git a/tp/t/results/coverage/item_container.pl 
b/tp/t/results/coverage/item_container.pl
index 2c3f8bd257..38a01fa7b4 100644
--- a/tp/t/results/coverage/item_container.pl
+++ b/tp/t/results/coverage/item_container.pl
@@ -417,7 +417,7 @@ $result_converted{'xml'}->{'item_container'} = '
  <para>b&textndash;ullet
 </para></listitem></itemize>
 
-<itemize commandarg="bullet" endspaces=" "><itemprepend>&bullet;</itemprepend>
+<itemize commandarg="bullet" endspaces=" "><itemprepend><formattingcommand 
command="bullet" automatic="on"/></itemprepend>
 <listitem><prepend>&bullet;</prepend> <para>no itemize argument
 </para></listitem></itemize>
 ';
diff --git a/tp/t/results/menu/block_commands_in_menu_description.pl 
b/tp/t/results/menu/block_commands_in_menu_description.pl
index 53744d3751..ccadfc5896 100644
--- a/tp/t/results/menu/block_commands_in_menu_description.pl
+++ b/tp/t/results/menu/block_commands_in_menu_description.pl
@@ -896,7 +896,7 @@ 
$result_converted{'xml'}->{'block_commands_in_menu_description'} = '<node name="
 
 <menu endspaces=" ">
 <menuentry leadingtext="* "><menunode 
separator="::">(manual)</menunode><menudescription><pre xml:space="preserve">
-</pre><itemize commandarg="bullet" endspaces=" 
"><itemprepend>&bullet;</itemprepend>
+</pre><itemize commandarg="bullet" endspaces=" 
"><itemprepend><formattingcommand command="bullet" 
automatic="on"/></itemprepend>
 <beforefirstitem><pre xml:space="preserve">
 </pre></beforefirstitem><listitem><prepend>&bullet;</prepend><pre 
xml:space="preserve"> in item
 
diff --git a/tp/t/results/xml_tests/comments_end_lines.pl 
b/tp/t/results/xml_tests/comments_end_lines.pl
index 7d757a2700..e9ae4a6720 100644
--- a/tp/t/results/xml_tests/comments_end_lines.pl
+++ b/tp/t/results/xml_tests/comments_end_lines.pl
@@ -1257,7 +1257,7 @@ $result_floats{'comments_end_lines'} = {
 
 
 
-$result_converted{'xml'}->{'comments_end_lines'} = '<itemize 
commandarg="bullet" endspaces=" "><itemprepend>&bullet;</itemprepend>
+$result_converted{'xml'}->{'comments_end_lines'} = '<itemize 
commandarg="bullet" endspaces=" "><itemprepend><formattingcommand 
command="bullet" automatic="on"/></itemprepend>
 <listitem><prepend>&bullet;</prepend> <para>itemize it
 </para></listitem></itemize>  <!-- c comment itemize -->
 
diff --git a/tp/t/results/xml_tests/comments_on_block_command_lines.pl 
b/tp/t/results/xml_tests/comments_on_block_command_lines.pl
index 1882f85d2a..40a8252137 100644
--- a/tp/t/results/xml_tests/comments_on_block_command_lines.pl
+++ b/tp/t/results/xml_tests/comments_on_block_command_lines.pl
@@ -2735,7 +2735,7 @@ $result_floats{'comments_on_block_command_lines'} = {
 
 
 
-$result_converted{'xml'}->{'comments_on_block_command_lines'} = '<itemize 
commandarg="bullet" spaces=" " endspaces=" 
"><itemprepend>&bullet;</itemprepend><!-- c comm -->
+$result_converted{'xml'}->{'comments_on_block_command_lines'} = '<itemize 
commandarg="bullet" spaces=" " endspaces=" "><itemprepend><formattingcommand 
command="bullet" automatic="on"/></itemprepend><!-- c comm -->
 <listitem><prepend>&bullet;</prepend> <para>itemize it
 </para></listitem></itemize>
 
diff --git a/tp/tests/layout/res_parser/formatting_xml/formatting.xml 
b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
index 9c741d54b7..6ec62daef4 100644
--- a/tp/tests/layout/res_parser/formatting_xml/formatting.xml
+++ b/tp/tests/layout/res_parser/formatting_xml/formatting.xml
@@ -1623,7 +1623,7 @@ quotation
 <para>something, other thing
 </para></smallquotation>
 
-<itemize commandarg="bullet" endspaces=" "><itemprepend>&bullet;</itemprepend>
+<itemize commandarg="bullet" endspaces=" "><itemprepend><formattingcommand 
command="bullet" automatic="on"/></itemprepend>
 <listitem><prepend>&bullet;</prepend> <para>i&textndash;temize
 </para></listitem></itemize>
 
@@ -2762,7 +2762,7 @@ quotation
 <para>something, other thing
 </para></smallquotation>
 
-<itemize commandarg="bullet" endspaces=" "><itemprepend>&bullet;</itemprepend>
+<itemize commandarg="bullet" endspaces=" "><itemprepend><formattingcommand 
command="bullet" automatic="on"/></itemprepend>
 <listitem><prepend>&bullet;</prepend> <para>i&textndash;temize
 </para></listitem></itemize>
 
@@ -3928,7 +3928,7 @@ quotation
 <para>something, other thing
 </para></smallquotation>
 
-<itemize commandarg="bullet" endspaces=" "><itemprepend>&bullet;</itemprepend>
+<itemize commandarg="bullet" endspaces=" "><itemprepend><formattingcommand 
command="bullet" automatic="on"/></itemprepend>
 <listitem><prepend>&bullet;</prepend> <para>i&textndash;temize
 </para></listitem></itemize>
 
@@ -5062,7 +5062,7 @@ indent in quotation
 <pre xml:space="preserve">something, other thing
 </pre></smallquotation>
 <pre xml:space="preserve">
-</pre><itemize commandarg="bullet" endspaces=" 
"><itemprepend>&bullet;</itemprepend>
+</pre><itemize commandarg="bullet" endspaces=" 
"><itemprepend><formattingcommand command="bullet" 
automatic="on"/></itemprepend>
 <listitem><prepend>&bullet;</prepend><pre xml:space="preserve"> i--temize
 </pre></listitem></itemize>
 <pre xml:space="preserve">
diff --git a/util/texinfo.dtd b/util/texinfo.dtd
index 88a88fd16c..9b6a577cd2 100644
--- a/util/texinfo.dtd
+++ b/util/texinfo.dtd
@@ -802,7 +802,8 @@
 <!ELEMENT itemprepend (#PCDATA | %Inline.line; | formattingcommand)*>
 <!ELEMENT formattingcommand EMPTY>
 <!ATTLIST formattingcommand
-          command CDATA #REQUIRED>
+          command CDATA #REQUIRED
+          automatic (%onoff;) 'off'>
 <!ELEMENT beforefirstitem (%block;)*>
 
 <!-- Tables -->
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index 338ddc576a..4e20da53d0 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -17,8 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-# FIXME space missing for comands like printindex.  Space before subentry
-# missing.
+# FIXME Space before subentry missing.  Space after columnfractions missing
 # 
 # Original author: Patrice Dumas <pertusus@free.fr>
 
@@ -309,12 +308,13 @@ while ($reader->read) {
       print "$spaces";
     } elsif (exists($Texinfo::Common::block_commands{$name})) {
       print "\@$name";
-      if ($name eq 'macro') {
+      if ($name eq 'macro' or $name eq 'rmacro') {
         if ($reader->hasAttributes() and 
defined($reader->getAttribute('line'))) {
           print $reader->getAttribute('line');
         }
         print "\n";
       } else {
+        # leading spaces are already in the line attribute for (r)macro
         print "$spaces";
       }
     } elsif (defined($Texinfo::Common::line_commands{$name})
@@ -373,18 +373,22 @@ while ($reader->read) {
         }
       }
       if (!$keep_indexterm) {
+        #print STDERR "IGNORE $name\n" if ($debug);
         skip_until_end($reader, $name);
         next;
       }
     } elsif ($name eq 'formattingcommand') {
-      if ($reader->hasAttributes()
-          and defined($reader->getAttribute('command'))) {
-        print '@'.$reader->getAttribute('command');
+      if ($reader->hasAttributes()) {
+        if (defined($reader->getAttribute('command'))
+            and (not (defined($reader->getAttribute('automatic'))
+                      and $reader->getAttribute('automatic') eq 'on'))) {
+          print '@'.$reader->getAttribute('command');
+        }
       }
     # def* automatic
     } elsif ($reader->hasAttributes()
-          and defined($reader->getAttribute('automatic'))
-          and $reader->getAttribute('automatic') eq 'on') {
+             and defined($reader->getAttribute('automatic'))
+             and $reader->getAttribute('automatic') eq 'on') {
       skip_until_end($reader, $name);
       # eat the following space
       $reader->read();



reply via email to

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