|
From: <gr...@us...> - 2025-03-21 02:16:25
|
Revision: 10052
http://sourceforge.net/p/docutils/code/10052
Author: grubert
Date: 2025-03-21 02:16:12 +0000 (Fri, 21 Mar 2025)
Log Message:
-----------
text-references: no additional spaces.
Skip references only if content is equal, or only differs by "mailto:".
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/docutils/writers/manpage.py
trunk/docutils/test/test_writers/test_manpage.py
Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2025-03-13 09:43:29 UTC (rev 10051)
+++ trunk/docutils/HISTORY.rst 2025-03-21 02:16:12 UTC (rev 10052)
@@ -213,7 +213,8 @@
- Do not output .UR/.UE macros without refuri in node.
- Use .MT/.ME macros for mailto.uris.
- If macro references is active output refuri always.
- - For text references: no line end after refuri.
+ - For text references: no line end after refuri, no additional spaces.
+ - Skip references only if content is equal, or only differs by "mailto:".
* docutils/writers/null.py
Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py 2025-03-13 09:43:29 UTC (rev 10051)
+++ trunk/docutils/docutils/writers/manpage.py 2025-03-21 02:16:12 UTC (rev 10052)
@@ -1081,17 +1081,18 @@
# TODO insert_URI_breakpoints in text or refuri
if 'refuri' in node:
- # MAYBE check if content is the uri and then text will be duplicated.
- if node['refuri'].endswith(node.astext()):
- self.body.append(" <")
+ # check if content is the uri and only output reference.
+ # MAYBE if only content is ouput hyphens "-" get a backslash.
+ if (node['refuri'] == node.astext()
+ or node['refuri'] == "mailto:"+node.astext()):
+ # without mailto:
+ self.body.append("<%s>" % node.astext())
+ raise nodes.SkipNode
# TODO elif 'refid' in node:
def _depart_reference_no_macro(self, node) -> None:
if 'refuri' in node:
- if node['refuri'].endswith(node.astext()):
- self.body.append("> ")
- else:
- self.body.append(" <%s>" % node['refuri'])
+ self.body.append(" <%s>" % node['refuri'])
# TODO elif 'refid' in node:
def _visit_reference_with_macro(self, node) -> None:
Modified: trunk/docutils/test/test_writers/test_manpage.py
===================================================================
--- trunk/docutils/test/test_writers/test_manpage.py 2025-03-13 09:43:29 UTC (rev 10051)
+++ trunk/docutils/test/test_writers/test_manpage.py 2025-03-21 02:16:12 UTC (rev 10052)
@@ -302,7 +302,7 @@
.UNINDENT
.SH OtHeR SECTION
.sp
-link to <http://docutils.sourceforge.io> \n\
+link to <http://docutils.sourceforge.io>\n\
.sp
With mixed case.
.sp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|