From 0fff8f232b424b67671b9ace3bd3fcb78f574e87 Mon Sep 17 00:00:00 2001 From: grubert Date: Mon, 23 Aug 2021 15:35:11 +0000 Subject: [PATCH] * docutils/writers/manpage.py - Fix: double quotes need to be escaped on macro invocation. Done everywhere. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8818 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/HISTORY.txt | 4 ++++ docutils/docutils/writers/manpage.py | 1 + sandbox/manpage-writer/expected/characters.man | 2 +- sandbox/manpage-writer/expected/compact_lists.man | 4 ++-- sandbox/manpage-writer/expected/indent.man | 4 ++-- sandbox/manpage-writer/expected/man-de.1.man | 2 +- sandbox/manpage-writer/expected/optionslisttest.man | 2 +- sandbox/manpage-writer/expected/optionstoo.man | 2 +- sandbox/manpage-writer/expected/quotes.man | 2 +- sandbox/manpage-writer/expected/quotes.ps | 4 ++-- sandbox/manpage-writer/expected/quotes.utf8 | 2 +- sandbox/manpage-writer/expected/test.man | 16 ++++++++-------- sandbox/manpage-writer/input/quotes.txt | 2 +- 13 files changed, 26 insertions(+), 21 deletions(-) diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt index c36e6155e..89539bebb 100644 --- a/docutils/HISTORY.txt +++ b/docutils/HISTORY.txt @@ -121,6 +121,10 @@ Changes Since 0.17.1 - Remove IE 6 compatibility workarounds ``iepngfix.htc`` and ``blank.gif`` (fixes bug #169). +* docutils/writers/manpage.py + + - Fix: double quotes need to be escaped on macro invocation. + Done everywhere. Release 0.17.1 (2021-04-16) =========================== diff --git a/docutils/docutils/writers/manpage.py b/docutils/docutils/writers/manpage.py index a4160309a..a0554ed01 100644 --- a/docutils/docutils/writers/manpage.py +++ b/docutils/docutils/writers/manpage.py @@ -290,6 +290,7 @@ class Translator(nodes.NodeVisitor): (u'\'', u'\\(aq'), (u'´', u"\\'"), (u'`', u'\\(ga'), + (u'"', u'\\(dq'), # double quotes are a problem on macro lines ] for (in_char, out_markup) in replace_pairs: text = text.replace(in_char, out_markup) diff --git a/sandbox/manpage-writer/expected/characters.man b/sandbox/manpage-writer/expected/characters.man index de8795bee..ba9b3a6c5 100644 --- a/sandbox/manpage-writer/expected/characters.man +++ b/sandbox/manpage-writer/expected/characters.man @@ -67,7 +67,7 @@ quotes: .IP \(bu 2 straight: \(aq .IP \(bu 2 -double: " +double: \(dq .IP \(bu 2 single: ‘ ’ .IP \(bu 2 diff --git a/sandbox/manpage-writer/expected/compact_lists.man b/sandbox/manpage-writer/expected/compact_lists.man index d1759aca2..b6b77f7aa 100644 --- a/sandbox/manpage-writer/expected/compact_lists.man +++ b/sandbox/manpage-writer/expected/compact_lists.man @@ -62,7 +62,7 @@ Even though some items may have only one paragraph. .sp .INDENT 0.0 .IP \(bu 2 -This is a simple bullet list, but class="open" is set. +This is a simple bullet list, but class=\(dqopen\(dq is set. .IP \(bu 2 It should not be made compact. .UNINDENT @@ -79,7 +79,7 @@ This is a bullet list that is not simple. .sp There are multiple paragraphs in some items. .IP \(bu 2 -However, the class="compact" setting will cause +However, the class=\(dqcompact\(dq setting will cause all first paragraph\(aqs

&

tags to be omitted. .IP \(bu 2 Items with multiple paragraphs will not appear changed. diff --git a/sandbox/manpage-writer/expected/indent.man b/sandbox/manpage-writer/expected/indent.man index 5383e2178..584310a11 100644 --- a/sandbox/manpage-writer/expected/indent.man +++ b/sandbox/manpage-writer/expected/indent.man @@ -33,8 +33,8 @@ indent \- test indentation blocks .SH OPTION BLOCK .sp an option block, and within it, a part of the text block indented. -the rest of the text ("More lines 1", etc.) isn\(aqt aligned at the same -level as "Line1". Instead, they\(aqre flush left to the screen +the rest of the text (\(dqMore lines 1\(dq, etc.) isn\(aqt aligned at the same +level as \(dqLine1\(dq. Instead, they\(aqre flush left to the screen .INDENT 0.0 .TP .BI \-l\fP,\fB \-\-color\-limit \ limit diff --git a/sandbox/manpage-writer/expected/man-de.1.man b/sandbox/manpage-writer/expected/man-de.1.man index b0d7b9b2a..e7a69c48e 100644 --- a/sandbox/manpage-writer/expected/man-de.1.man +++ b/sandbox/manpage-writer/expected/man-de.1.man @@ -342,7 +342,7 @@ Zeichenkette muss folgendes Aussehen haben: .sp .nf .ft C -\(aq\e" +\(aq\e\(dq .ft P .fi .UNINDENT diff --git a/sandbox/manpage-writer/expected/optionslisttest.man b/sandbox/manpage-writer/expected/optionslisttest.man index d1bbce8fc..fb50c718d 100644 --- a/sandbox/manpage-writer/expected/optionslisttest.man +++ b/sandbox/manpage-writer/expected/optionslisttest.man @@ -100,7 +100,7 @@ The message to display (beaware of \fB,\fP) .UNINDENT .SH EXAMPLES .sp -The "Examples" section header must not be intented. But this paragraph +The \(dqExamples\(dq section header must not be intented. But this paragraph is indented, as all text in man\-pages. This is level 0. .INDENT 0.0 .IP \(bu 2 diff --git a/sandbox/manpage-writer/expected/optionstoo.man b/sandbox/manpage-writer/expected/optionstoo.man index 2a50f140f..fb8c08d0a 100644 --- a/sandbox/manpage-writer/expected/optionstoo.man +++ b/sandbox/manpage-writer/expected/optionstoo.man @@ -68,6 +68,6 @@ output file .UNINDENT .UNINDENT .sp -NOTE "show" "General" and "output" on same column. +NOTE \(dqshow\(dq \(dqGeneral\(dq and \(dqoutput\(dq on same column. .\" Generated by docutils manpage writer. . diff --git a/sandbox/manpage-writer/expected/quotes.man b/sandbox/manpage-writer/expected/quotes.man index fc81ec55c..24659e414 100644 --- a/sandbox/manpage-writer/expected/quotes.man +++ b/sandbox/manpage-writer/expected/quotes.man @@ -37,7 +37,7 @@ because the doublequotes make \fBFilename: ${filename}\fP one argument to the \fB\&.B\fP bold macro. .INDENT 0.0 .TP -.B i show\-text "Filename: ${filename}" +.B i show\-text \(dqFilename: ${filename}\(dq shows the filename of the current file when pressing the \fBi\fP key .UNINDENT .\" Generated by docutils manpage writer. diff --git a/sandbox/manpage-writer/expected/quotes.ps b/sandbox/manpage-writer/expected/quotes.ps index 3634a9951..ad377faea 100644 --- a/sandbox/manpage-writer/expected/quotes.ps +++ b/sandbox/manpage-writer/expected/quotes.ps @@ -1,6 +1,6 @@ %!PS-Adobe-3.0 %%Creator: groff version 1.22.4 -%%CreationDate: Mon Aug 23 08:23:58 2021 +%%CreationDate: Mon Aug 23 15:25:20 2021 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%DocumentSuppliedResources: procset grops 1.22 4 @@ -239,7 +239,7 @@ list in the mpv documen-)-2.528 F(tation:)108 108 Q (because the doublequotes mak)108 132 Q(e)-.1 E/F2 10/Times-Bold@0 SF (Filename: ${\214lename})2.5 E F0(one ar)2.5 E(gument to the)-.18 E F2 (.B)2.5 E F0(bold macro.)2.5 E F2 2.5(is)108 148.8 S(ho)-2.5 E -(w\255text Filename: ${\214lename})-.1 E F0(sho)144 160.8 Q +(w\255text "Filename: ${\214lename}")-.1 E F0(sho)144 160.8 Q (ws the \214lename of the current \214le when pressing the)-.25 E F2(i) 2.5 E F0 -.1(ke)2.5 G(y)-.05 E(1)535 768 Q 0 Cg EP %%Trailer diff --git a/sandbox/manpage-writer/expected/quotes.utf8 b/sandbox/manpage-writer/expected/quotes.utf8 index 182499605..dba086d44 100644 --- a/sandbox/manpage-writer/expected/quotes.utf8 +++ b/sandbox/manpage-writer/expected/quotes.utf8 @@ -9,7 +9,7 @@ NNAAMMEE because the doublequotes make FFiilleennaammee:: $${{ffiilleennaammee}} one argument to the ..BB bold macro. - ii sshhooww--tteexxtt FFiilleennaammee:: $${{ffiilleennaammee}} + ii sshhooww--tteexxtt ""FFiilleennaammee:: $${{ffiilleennaammee}}"" shows the filename of the current file when pressing the ii key diff --git a/sandbox/manpage-writer/expected/test.man b/sandbox/manpage-writer/expected/test.man index 3b45a00fe..8960bc975 100644 --- a/sandbox/manpage-writer/expected/test.man +++ b/sandbox/manpage-writer/expected/test.man @@ -78,7 +78,7 @@ hyphen: \- .IP \(bu 2 accents: \' \(ga .IP \(bu 2 -quotes: \(aq " +quotes: \(aq \(dq .UNINDENT .sp \&.period ad line start. @@ -194,8 +194,8 @@ with the colon. .sp .nf .ft C ->>> print \(aqPython\-specific usage examples; begun with ">>>"\(aq -Python\-specific usage examples; begun with ">>>" +>>> print \(aqPython\-specific usage examples; begun with \(dq>>>\(dq\(aq +Python\-specific usage examples; begun with \(dq>>>\(dq >>> print \(aq(cut and pasted from interactive Python sessions)\(aq (cut and pasted from interactive Python sessions) .ft P @@ -256,8 +256,8 @@ some special characters and roff formatting in literal: .sp .nf .ft C -\&.SS "." at line start -backslash "\e" +\&.SS \(dq.\(dq at line start +backslash \(dq\e\(dq .ft P .fi .UNINDENT @@ -266,7 +266,7 @@ backslash "\e" .nf This is a line block. It ends with a blank line. .in +2 -Each new line begins with a vertical bar ("|"). +Each new line begins with a vertical bar (\(dq|\(dq). Line breaks and initial indents are preserved. .in -2 Continuation lines are wrapped portions of long lines; @@ -280,7 +280,7 @@ the left edge of the text above it. .nf This is a second line block. -Blank lines are permitted internally, but they must begin with a "|". +Blank lines are permitted internally, but they must begin with a \(dq|\(dq. .fi .sp .sp @@ -436,7 +436,7 @@ Numerous mapping problems. .IP 1. 3 Where do we get the manual section number from ? Commandline ? .IP 2. 3 -docutils authors should be filled into section "AUTHORS". +docutils authors should be filled into section \(dqAUTHORS\(dq. .IP 3. 3 be carefull with linebreaks in generated code. .IP 4. 3 diff --git a/sandbox/manpage-writer/input/quotes.txt b/sandbox/manpage-writer/input/quotes.txt index 2f0861d92..00be3782c 100644 --- a/sandbox/manpage-writer/input/quotes.txt +++ b/sandbox/manpage-writer/input/quotes.txt @@ -2,7 +2,7 @@ a problem with double quotes not being rendered in the term of an rst definition list in the mpv documentation: because the doublequotes make ``Filename: ${filename}`` one argument to -the ``.B`` bold macro. +the ``.B`` bold macro. i show-text "Filename: ${filename}" shows the filename of the current file when pressing the ``i`` key -- 2.11.4.GIT