SF.net SVN: docutils:[9982] trunk
grubert--- via Docutils-checkins <[email protected]>
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 9982
http://sourceforge.net/p/docutils/code/9982
Author: grubert
Date: 2024-11-14 17:50:45 +0000 (Thu, 14 Nov 2024)
Log Message:
-----------
manpage writer:
- Use .MT/.ME macros for mailto.uris.
- Do not output .UR/.UE macros if refuri is not set
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/docutils/writers/manpage.py
trunk/docutils/test/test_writers/test_manpage.py
trunk/sandbox/manpage-writer/expected/refs-urue.man
trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man
trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.ps
trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.utf8
Added Paths:
-----------
trunk/.github/
trunk/.github/workflows/
Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/docutils/HISTORY.rst 2024-11-14 17:50:45 UTC (rev 9982)
@@ -193,6 +193,8 @@
- Add module function insert_URI_breakpoints.
- Add command line option ``--macro-references``/``--text-references``
to enable/disable usage of *man* macros .UR/.UE.
+ - Do not output .UR/.UE macros without refuri in node.
+ - Use .MT/.ME macros for mailto.uris.
* docutils/writers/null.py
Modified: trunk/docutils/docutils/writers/manpage.py
===================================================================
--- trunk/docutils/docutils/writers/manpage.py 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/docutils/docutils/writers/manpage.py 2024-11-14 17:50:45 UTC (rev 9982)
@@ -1095,14 +1095,21 @@
# use UR/UE or MT/ME not yet
# TODO insert_URI_breakpoints in text or refuri
self.ensure_eol()
- self.body.append(".UR ")
if 'refuri' in node:
+ if node['refuri'].startswith('mailto:'):
+ self.body.append(".MT ")
+ self.context.append('.ME\n')
+ else:
+ self.body.append(".UR ")
+ self.context.append('.UE\n')
if not node['refuri'].endswith(node.astext()):
self.body.append("%s\n" % node['refuri'])
+ else:
+ self.context.append('')
def _depart_reference_with_macro(self, node) -> None:
self.ensure_eol()
- self.body.append(".UE\n")
+ self.body.append(self.context.pop())
# ----
def visit_revision(self, node) -> None:
Modified: trunk/docutils/test/test_writers/test_manpage.py
===================================================================
--- trunk/docutils/test/test_writers/test_manpage.py 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/docutils/test/test_writers/test_manpage.py 2024-11-14 17:50:45 UTC (rev 9982)
@@ -170,9 +170,9 @@
document_start + indend_macros + """.TH "" "" "" ""
.SH Name
\\- \n\
-.UR mailto:[email protected]
+.MT mailto:[email protected]
Write to me
-.UE
+.ME
with your questions.
.sp
whatever.
Modified: trunk/sandbox/manpage-writer/expected/refs-urue.man
===================================================================
--- trunk/sandbox/manpage-writer/expected/refs-urue.man 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/sandbox/manpage-writer/expected/refs-urue.man 2024-11-14 17:50:45 UTC (rev 9982)
@@ -62,13 +62,11 @@
[4] and [3]\&.
.IP [3] 5
a.k.a.
-.UR third
-.UE
+third
.IP [4] 5
a.k.a.
-.UR fourth
-.UE
+fourth
.sp
@@ -100,8 +98,7 @@
.sp
Given a citation like [this], one
can also refer to it like
-.UR this
-.UE
+this
\&.
.IP [this] 5
here.
@@ -121,8 +118,7 @@
.SS Internal Hyperlink Targets
.sp
Internal cross\-references, like
-.UR example
-.UE
+example
\&.
.sp
This is an example cross\-reference target.
@@ -140,9 +136,8 @@
.SH Titles are targets, too
.sp
Implicit references, like
-.UR Titles are
+Titles are
targets, too
-.UE
\&.
.SH and
.sp
@@ -152,9 +147,9 @@
.UE
home page for info.
.sp
-.UR mailto:[email protected]
+.MT mailto:[email protected]
Write to me
-.UE
+.ME
with your questions.
.\" deduplicate _Python: https://www.python.org
.
@@ -175,7 +170,7 @@
.SS Standalone email addresses
.sp
like
-.UR [email protected]
-.UE
+.MT [email protected]
+.ME
.\" End of generated man page.
Modified: trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man
===================================================================
--- trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.man 2024-11-14 17:50:45 UTC (rev 9982)
@@ -62,13 +62,11 @@
[4] and [3]\&.
.IP [3] 5
a.k.a.
-.UR third
-.UE
+third
.IP [4] 5
a.k.a.
-.UR fourth
-.UE
+fourth
.sp
@@ -100,8 +98,7 @@
.sp
Given a citation like [this], one
can also refer to it like
-.UR this
-.UE
+this
\&.
.IP [this] 5
here.
@@ -121,8 +118,7 @@
.SS Internal Hyperlink Targets
.sp
Internal cross\-references, like
-.UR example
-.UE
+example
\&.
.sp
This is an example cross\-reference target.
@@ -140,9 +136,8 @@
.SH Titles are targets, too
.sp
Implicit references, like
-.UR Titles are
+Titles are
targets, too
-.UE
\&.
.SH and
.sp
@@ -152,9 +147,9 @@
.UE
home page for info.
.sp
-.UR mailto:[email protected]
+.MT mailto:[email protected]
Write to me
-.UE
+.ME
with your questions.
.\" deduplicate _Python: https://www.python.org
.
@@ -175,7 +170,7 @@
.SS Standalone email addresses
.sp
like
-.UR [email protected]
-.UE
+.MT [email protected]
+.ME
.\" End of generated man page.
Modified: trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.ps
===================================================================
--- trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.ps 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.ps 2024-11-14 17:50:45 UTC (rev 9982)
@@ -102,10 +102,10 @@
404.371([3].)c
87.274 349.041([3])s
114.774(a.k.a.)c
-143.792(<third>)c
+143.792(third)c
87.274 302.874([4])s
114.774(a.k.a.)c
-143.792(<fourth>)c
+143.792(fourth)c
322.190 241.318(----)s
114.774 164.373(Auto-symbol)s
175.582(footnotes)c
@@ -188,8 +188,8 @@
316.393(to)c
327.701(it)c
336.567(like)c
-355.817(<this>)c
-386.870(.)c
+355.817(this)c
+374.462(.)c
87.274 502.931([this])s
114.774(here.)c
f1
@@ -218,8 +218,8 @@
87.274 379.819(Internal)s
124.234(cross-references,)c
201.190(like)c
-220.440(<example>)c
-272.866(.)c
+220.440(example)c
+260.458(.)c
87.274 349.041(This)s
109.582(is)c
119.669(an)c
@@ -249,10 +249,11 @@
87.274 241.318(Implicit)s
124.861(references,)c
175.549(like)c
-194.799(targets,)c
-229.625(too)c
-246.433(<Titles>)c
-286.649(.)c
+194.799(Titles)c
+222.607(are)c
+238.788(targets,)c
+273.614(too)c
+290.422(.)c
f1
68.024 210.540(and)s
f0
Modified: trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.utf8
===================================================================
--- trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.utf8 2024-11-14 16:01:33 UTC (rev 9981)
+++ trunk/sandbox/manpage-writer/expected-mandoc/refs-urue.utf8 2024-11-14 17:50:45 UTC (rev 9982)
@@ -25,10 +25,10 @@
They may be assigned 'autonumber labels' - for instance, [4] and
[3].
- [3] a.k.a. <third>
+ [3] a.k.a. third
- [4] a.k.a. <fourth>
+ [4] a.k.a. fourth
@@ -53,8 +53,7 @@
Citation labels contain alphanumerics, underlines, hyphens and
fullstops. Case is not significant.
- Given a citation like [this], one can also refer to it like <this>
- .
+ Given a citation like [this], one can also refer to it like this .
[this]
here.
@@ -65,7 +64,7 @@
embedded External hyperlinks, like Python <https://www.python.org/> .
IInntteerrnnaall HHyyppeerrlliinnkk TTaarrggeettss
- Internal cross-references, like <example> .
+ Internal cross-references, like example .
This is an example cross-reference target.
@@ -74,7 +73,7 @@
is my favourite programming language <https://www.python.org/> .
TTiittlleess aarree ttaarrggeettss,, ttoooo
- Implicit references, like targets, too <Titles> .
+ Implicit references, like Titles are targets, too .
aanndd
See the Python <https://www.python.org/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.