SF.net SVN: docutils:[10061 ] trunk

grubert--- via Docutils-checkins <[email protected]> Sun, 30 Mar 2025 18:28:06 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10061
          http://sourceforge.net/p/docutils/code/10061
Author:   grubert
Date:     2025-03-30 18:28:06 +0000 (Sun, 30 Mar 2025)
Log Message:
-----------
remove leading blank from refuris

Modified Paths:
--------------
    trunk/docutils/docutils/writers/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/refs-urue.man
    trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8
    trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man

Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py	2025-03-30 18:21:02 UTC (rev 10060)
+++ trunk/docutils/docutils/writers/manpage.py	2025-03-30 18:28:06 UTC (rev 10061)
@@ -323,6 +323,11 @@
         if len(self.body) > 0 and self.body[-1][-1] != '\n':
             self.body.append('\n')
 
+    def ensure_c_eol(self) -> None:
+        """Ensure the last line in body is terminated by new line."""
+        if len(self.body) > 0 and self.body[-1][-1] != '\n':
+            self.body.append('\\c\n')
+
     def astext(self):
         """Return the final formatted document as a string."""
         if not self.header_written:
@@ -1100,7 +1105,7 @@
         # TODO insert_URI_breakpoints in text or refuri
         # TODO the is a space before and after the content ? 
         if 'refuri' in node:
-            self.ensure_eol()
+            self.ensure_c_eol() # c_eol avoids space before the refuri
             if node['refuri'].startswith('mailto:'):
                 self.body.append(".MT ")
                 self.context.append('.ME\n')

Modified: trunk/sandbox/manpage-writer/expected/ref-2025-urue.man
===================================================================
--- trunk/sandbox/manpage-writer/expected/ref-2025-urue.man	2025-03-30 18:21:02 UTC (rev 10060)
+++ trunk/sandbox/manpage-writer/expected/ref-2025-urue.man	2025-03-30 18:28:06 UTC (rev 10061)
@@ -33,7 +33,7 @@
  \- 
 .\" from bugs#497
 .
-Aaaaa (
+Aaaaa (\c
 .MT mailto:[email protected]
 [email protected]
 .ME
@@ -41,7 +41,7 @@
 .UR https://github.com/cc
 Bbb
 .UE
- (
+ (\c
 .MT mailto:[email protected]
 [email protected]
 .ME
@@ -54,7 +54,7 @@
 nn
 .UE
 
-and 
+and \c
 .UR https://github.com/OooOoooo
 OooOoooo
 .UE

Modified: trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8
===================================================================
--- trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8	2025-03-30 18:21:02 UTC (rev 10060)
+++ trunk/sandbox/manpage-writer/expected/ref-2025-urue.utf8	2025-03-30 18:28:06 UTC (rev 10061)
@@ -1,8 +1,8 @@
 ()                                                                          ()
 
 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;;\
+        - 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;;\
 

Modified: trunk/sandbox/manpage-writer/expected/refs-urue.man
===================================================================
--- trunk/sandbox/manpage-writer/expected/refs-urue.man	2025-03-30 18:21:02 UTC (rev 10060)
+++ trunk/sandbox/manpage-writer/expected/refs-urue.man	2025-03-30 18:28:06 UTC (rev 10061)
@@ -98,13 +98,13 @@
 here.
 .SS External Hyperlink Targets
 .sp
-External hyperlinks, like 
+External hyperlinks, like \c
 .UR https://www.python.org/
 Python
 .UE
 \&.
 .sp
-embedded External hyperlinks, like 
+embedded External hyperlinks, like \c
 .UR https://www.python.org/
 Python
 .UE
@@ -119,7 +119,7 @@
 .UR https://www.python.org/
 Python
 .UE
- is 
+ is \c
 .UR https://www.python.org/
 my favourite
 programming language
@@ -131,7 +131,7 @@
 targets, too\&.
 .SH and
 .sp
-See the 
+See the \c
 .UR https://www.python.org/
 Python
 .UE
@@ -163,7 +163,7 @@
 
 .SS Standalone email addresses
 .sp
-like 
+like \c
 .MT mailto:[email protected]
 [email protected]
 .ME

Modified: trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8
===================================================================
--- trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8	2025-03-30 18:21:02 UTC (rev 10060)
+++ trunk/sandbox/manpage-writer/expected-mandoc/ref-2025-urue.utf8	2025-03-30 18:28:06 UTC (rev 10061)
@@ -1,9 +1,8 @@
 ()                                                                          ()
 
 NNaammee
-        - Aaaaa ( [email protected] <mailto:[email protected]> ), Bbb
-       <https://github.com/cc>
-        ( [email protected] <mailto:[email protected]> ), mm <https://github.com/m>
+        - 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>
 

Modified: trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man
===================================================================
--- trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man	2025-03-30 18:21:02 UTC (rev 10060)
+++ trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man	2025-03-30 18:28:06 UTC (rev 10061)
@@ -98,13 +98,13 @@
 here.
 .SS External Hyperlink Targets
 .sp
-External hyperlinks, like 
+External hyperlinks, like \c
 .UR https://www.python.org/
 Python
 .UE
 \&.
 .sp
-embedded External hyperlinks, like 
+embedded External hyperlinks, like \c
 .UR https://www.python.org/
 Python
 .UE
@@ -119,7 +119,7 @@
 .UR https://www.python.org/
 Python
 .UE
- is 
+ is \c
 .UR https://www.python.org/
 my favourite
 programming language
@@ -131,7 +131,7 @@
 targets, too\&.
 .SH and
 .sp
-See the 
+See the \c
 .UR https://www.python.org/
 Python
 .UE
@@ -163,7 +163,7 @@
 
 .SS Standalone email addresses
 .sp
-like 
+like \c
 .MT mailto:[email protected]
 [email protected]
 .ME

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