From b7c03964cfc96af9ced5db3c1a6c7a7663de5cb2 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 26 May 2023 01:44:09 -0600 Subject: [PATCH] change dot layout in chained method call to be compatible with rdoc generator from Ruby 2.5 --- lib/asciidoctor/converter/manpage.rb | 64 ++++++++++++++-------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/asciidoctor/converter/manpage.rb b/lib/asciidoctor/converter/manpage.rb index a7aba996..be52e9be 100644 --- a/lib/asciidoctor/converter/manpage.rb +++ b/lib/asciidoctor/converter/manpage.rb @@ -712,38 +712,38 @@ def manify str, opts = {} else str = str.tr_s WHITESPACE, ' ' end - str = str - .gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' } # literal backslash (not a troff escape sequence) - .gsub(EllipsisCharRefRx, '...') # horizontal ellipsis - .gsub(LeadingPeriodRx, '\\\&.') # leading . is used in troff for macro call or other formatting; replace with \&. - .gsub(EscapedMacroRx) { (rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest}) } # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line - .gsub('-', '\-') - .gsub('<', '<') - .gsub('>', '>') - .gsub('+', '+') # plus sign; alternately could use \c(pl - .gsub(' ', '\~') # non-breaking space - .gsub('©', '\(co') # copyright sign - .gsub('®', '\(rg') # registered sign - .gsub('™', '\(tm') # trademark sign - .gsub('°', '\(de') # degree sign - .gsub(' ', ' ') # thin space - .gsub('–', '\(en') # en dash - .gsub(EmDashCharRefRx, '\(em') # em dash - .gsub('‘', '\(oq') # left single quotation mark - .gsub('’', '\(cq') # right single quotation mark - .gsub('“', '\(lq') # left double quotation mark - .gsub('”', '\(rq') # right double quotation mark - .gsub('←', '\(<-') # leftwards arrow - .gsub('→', '\(->') # rightwards arrow - .gsub('⇐', '\(lA') # leftwards double arrow - .gsub('⇒', '\(rA') # rightwards double arrow - .gsub('​', '\:') # zero width space - .gsub('&', '&') # literal ampersand (NOTE must take place after any other replacement that includes &) - .gsub('\'', '\*(Aq') # apostrophe / neutral single quote - .gsub(MockMacroRx, '\1') # mock boundary - .gsub(ESC_BS, '\\') # unescape troff backslash (NOTE update if more escapes are added) - .gsub(ESC_FS, '.') # unescape full stop in troff commands (NOTE must take place after gsub(LeadingPeriodRx)) - .rstrip # strip trailing space + str = str. + gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' }. # literal backslash (not a troff escape sequence) + gsub(EllipsisCharRefRx, '...'). # horizontal ellipsis + gsub(LeadingPeriodRx, '\\\&.'). # leading . is used in troff for macro call or other formatting; replace with \&. + gsub(EscapedMacroRx) { (rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest}) }. # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line + gsub('-', '\-'). + gsub('<', '<'). + gsub('>', '>'). + gsub('+', '+'). # plus sign; alternately could use \c(pl + gsub(' ', '\~'). # non-breaking space + gsub('©', '\(co'). # copyright sign + gsub('®', '\(rg'). # registered sign + gsub('™', '\(tm'). # trademark sign + gsub('°', '\(de'). # degree sign + gsub(' ', ' '). # thin space + gsub('–', '\(en'). # en dash + gsub(EmDashCharRefRx, '\(em'). # em dash + gsub('‘', '\(oq'). # left single quotation mark + gsub('’', '\(cq'). # right single quotation mark + gsub('“', '\(lq'). # left double quotation mark + gsub('”', '\(rq'). # right double quotation mark + gsub('←', '\(<-'). # leftwards arrow + gsub('→', '\(->'). # rightwards arrow + gsub('⇐', '\(lA'). # leftwards double arrow + gsub('⇒', '\(rA'). # rightwards double arrow + gsub('​', '\:'). # zero width space + gsub('&', '&'). # literal ampersand (NOTE must take place after any other replacement that includes &) + gsub('\'', '\*(Aq'). # apostrophe / neutral single quote + gsub(MockMacroRx, '\1'). # mock boundary + gsub(ESC_BS, '\\'). # unescape troff backslash (NOTE update if more escapes are added) + gsub(ESC_FS, '.'). # unescape full stop in troff commands (NOTE must take place after gsub(LeadingPeriodRx)) + rstrip # strip trailing space opts[:append_newline] ? %(#{str}#{LF}) : str end