SF.net SVN: docutils:[10070 ] trunk

grubert--- via Docutils-checkins <[email protected]> Thu, 03 Apr 2025 10:50:37 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10070
          http://sourceforge.net/p/docutils/code/10070
Author:   grubert
Date:     2025-04-03 10:50:37 +0000 (Thu, 03 Apr 2025)
Log Message:
-----------
macro references trailing chars

Modified Paths:
--------------
    trunk/docutils/docutils/writers/manpage.py
    trunk/docutils/test/test_writers/test_manpage.py
    trunk/sandbox/manpage-writer/expected/ref-2025-urue.man
    trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8
    trunk/sandbox/manpage-writer/expected/ref-2025.man
    trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8
    trunk/sandbox/manpage-writer/input/ref-2025.txt

Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/docutils/docutils/writers/manpage.py	2025-04-03 10:50:37 UTC (rev 10070)
@@ -351,8 +351,17 @@
                     self.body[i] = '.\n'
             elif self.body[i][:4] in ('.UE\n', '.ME\n'):
                 # TODO INWORK
+                # if next item starts with 
+                # a) a line end, disable it
                 if self.body[i+1][0] in ('\n', '\r'):
                     self.body[i+1] = '.' + self.body[i+1]
+                # b) with a separator: move the 1st char to current item
+                elif self.body[i+1][0] in ')]}>,':
+                    self.body[i] = "%s %s\\c\n" % (
+                            self.body[i][:3], self.body[i+1][0])
+                    self.body[i+1] = self.body[i+1][1:]
+                    if self.body[i+1][0] == '.':
+                        self.body[i+1] = '\\&' + self.body[i+1]
         return ''.join(self.head + self.body + self.foot)
 
     def deunicode(self, text):
@@ -1126,7 +1135,7 @@
         if macro_end:
             self.ensure_eol()
             self.body.append(macro_end)
-        # TODO problems 
+        # problems to handle in astext looking ahead.
         # * if the ref is at end of line
         #   we get a blank line following which we dont want.
         # * if ref is followed by )., there will be a space separating

Modified: trunk/docutils/test/test_writers/test_manpage.py
===================================================================
--- trunk/docutils/test/test_writers/test_manpage.py	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/docutils/test/test_writers/test_manpage.py	2025-04-03 10:50:37 UTC (rev 10070)
@@ -190,8 +190,8 @@
 email: (\\c
 .MT mailto:[email protected]
 [email protected]
-.ME
-).
+.ME )\\c
+\\&.
 .sp
 no spaces before and after the email.
 .\\" End of generated man page.

Modified: trunk/sandbox/manpage-writer/expected/ref-2025-urue.man
===================================================================
--- trunk/sandbox/manpage-writer/expected/ref-2025-urue.man	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/sandbox/manpage-writer/expected/ref-2025-urue.man	2025-04-03 10:50:37 UTC (rev 10070)
@@ -36,8 +36,8 @@
 Aaaaa (\c
 .MT mailto:[email protected]
 [email protected]
-.ME
-),
+.ME )\c
+,
 .UR https://github.com/cc
 Bbb
 .UE
@@ -44,8 +44,8 @@
  (\c
 .MT mailto:[email protected]
 [email protected]
-.ME
-),
+.ME )\c
+\&.
 .UR https://github.com/m
 mm
 .UE

Modified: trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8
===================================================================
--- trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8	2025-04-03 10:50:37 UTC (rev 10070)
@@ -1,7 +1,7 @@
 ()                                                                          ()
 
 Name
-        - Aaaaa (]8;;mailto:mailto:[email protected]\[email protected]]8;;\ ), ]8;;https://github.com/cc\Bbb]8;;\
-        (]8;;mailto:mailto:[email protected]\[email protected]]8;;\ ), ]8;;https://github.com/m\mm]8;;\ ]8;;https://github.com/nn\nn]8;;\ and ]8;;https://github.com/OooOoooo\OooOoooo]8;;\ .
+        - Aaaaa (]8;;mailto:mailto:[email protected]\[email protected]]8;;\), ]8;;https://github.com/cc\Bbb]8;;\
+        (]8;;mailto:mailto:[email protected]\[email protected]]8;;\).  ]8;;https://github.com/m\mm]8;;\ ]8;;https://github.com/nn\nn]8;;\ and ]8;;https://github.com/OooOoooo\OooOoooo]8;;\ .
 
                                                                             ()

Modified: trunk/sandbox/manpage-writer/expected/ref-2025.man
===================================================================
--- trunk/sandbox/manpage-writer/expected/ref-2025.man	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/sandbox/manpage-writer/expected/ref-2025.man	2025-04-03 10:50:37 UTC (rev 10070)
@@ -34,7 +34,7 @@
 .\" from bugs#497
 .
 Aaaaa (<[email protected]>),
-Bbb <https://github.com/cc> (<[email protected]>),
+Bbb <https://github.com/cc> (<[email protected]>).
 mm <https://github.com/m>
 nn <https://github.com/nn>
 and OooOoooo <https://github.com/OooOoooo>\&.

Modified: trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8
===================================================================
--- trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8	2025-04-03 10:50:37 UTC (rev 10070)
@@ -1,8 +1,8 @@
 ()                                                                          ()
 
 NNaammee
-        - Aaaaa ([email protected] <mailto:[email protected]> ), Bbb <https://github.com/cc>
-        ([email protected] <mailto:[email protected]> ), mm <https://github.com/m> nn
+        - Aaaaa ([email protected] <mailto:[email protected]>), Bbb <https://github.com/cc>
+        ([email protected] <mailto:[email protected]>).  mm <https://github.com/m> nn
        <https://github.com/nn> and OooOoooo <https://github.com/OooOoooo> .
 
                                                                             ()

Modified: trunk/sandbox/manpage-writer/input/ref-2025.txt
===================================================================
--- trunk/sandbox/manpage-writer/input/ref-2025.txt	2025-04-03 10:01:18 UTC (rev 10069)
+++ trunk/sandbox/manpage-writer/input/ref-2025.txt	2025-04-03 10:50:37 UTC (rev 10070)
@@ -1,7 +1,7 @@
 .. from bugs#497
 
 Aaaaa ([email protected]),
-`Bbb <https://github.com/cc>`_ ([email protected]),
+`Bbb <https://github.com/cc>`_ ([email protected]).
 `mm <https://github.com/m>`_
 `nn <https://github.com/nn>`_
 and `OooOoooo <https://github.com/OooOoooo>`_.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.