lib/asciidoctor/converter/manpage.rb in asciidoctor-2.0.18 vs lib/asciidoctor/converter/manpage.rb in asciidoctor-2.0.19
- old
+ new
@@ -26,22 +26,22 @@
MockMacroRx = %r(</?(#{ESC}\\[^>]+)>)
EmDashCharRefRx = /—(?:​)?/
EllipsisCharRefRx = /…(?:​)?/
WrappedIndentRx = /#{CG_BLANK}*#{LF}#{CG_BLANK}*/
XMLMarkupRx = /&#?[a-z\d]+;|</
- PCDATAFilterRx = /(&#?[a-z\d]+;|<[^>]+>)|([^&<]+)/
+ PCDATAFilterRx = %r((&#?[a-z\d]+;|<#{ESC}\\f\(CR.*?</#{ESC}\\fP>|<[^>]+>)|([^&<]+))
def initialize backend, opts = {}
@backend = backend
init_backend_traits basebackend: 'manpage', filetype: 'man', outfilesuffix: '.man', supports_templates: true
end
def convert_document node
unless node.attr? 'mantitle'
raise 'asciidoctor: ERROR: doctype must be set to manpage when using manpage backend'
end
- mantitle = node.attr 'mantitle'
+ mantitle = (node.attr 'mantitle').gsub InvalidSectionIdCharsRx, ''
manvolnum = node.attr 'manvolnum', '1'
manname = node.attr 'manname', mantitle
manmanual = node.attr 'manmanual'
mansource = node.attr 'mansource'
docdate = (node.attr? 'reproducible') ? nil : (node.attr 'docdate')
@@ -234,10 +234,10 @@
def convert_image node
result = []
result << (node.title? ? %(.sp
.B #{manify node.captioned_title}
.br) : '.sp')
- result << %([#{node.alt}])
+ result << %([#{manify node.alt}])
result.join LF
end
def convert_listing node
result = []