Add support for the Lk
macro to tool/mdoc2man.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4d3e3c2550
commit
9d5bc13fdb
@ -1,3 +1,11 @@
|
|||||||
|
Fri Sep 23 21:38:58 2016 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* tool/mdoc2man.rb (Mdoc2Man#parse_macro): Add support for the
|
||||||
|
`Lk` macro.
|
||||||
|
|
||||||
|
* tool/mdoc2man.rb (Mdoc2Man#shift_arg): A new function to extract
|
||||||
|
a possibly quoted argument.
|
||||||
|
|
||||||
Fri Sep 23 20:36:05 2016 Shugo Maeda <shugo@ruby-lang.org>
|
Fri Sep 23 20:36:05 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_mod_refine): refine modules as well.
|
* eval.c (rb_mod_refine): refine modules as well.
|
||||||
|
@ -82,6 +82,24 @@ class Mdoc2Man
|
|||||||
initialize
|
initialize
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def shift_arg(words)
|
||||||
|
case words[0]
|
||||||
|
when nil, RE_PUNCT
|
||||||
|
nil
|
||||||
|
when /\A"(.+)/
|
||||||
|
words.shift
|
||||||
|
word = $1
|
||||||
|
loop {
|
||||||
|
break if word.chomp!('"')
|
||||||
|
token = words.shift or break
|
||||||
|
word << ' ' << token
|
||||||
|
}
|
||||||
|
word
|
||||||
|
else
|
||||||
|
words.shift
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def parse_macro(line)
|
def parse_macro(line)
|
||||||
words = line.split
|
words = line.split
|
||||||
retval = ''
|
retval = ''
|
||||||
@ -320,7 +338,9 @@ class Mdoc2Man
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
if word == 'Pa' && !quote.include?(OPTION)
|
case word
|
||||||
|
when 'Pa'
|
||||||
|
if !quote.include?(OPTION)
|
||||||
retval << '\\fI'
|
retval << '\\fI'
|
||||||
retval << '\\&' if /^\./ =~ words[0]
|
retval << '\\&' if /^\./ =~ words[0]
|
||||||
retval << words.shift << '\\fP'
|
retval << words.shift << '\\fP'
|
||||||
@ -330,6 +350,18 @@ class Mdoc2Man
|
|||||||
# @nospace = 1 if @nospace == 0 && RE_PUNCT =~ words[0]
|
# @nospace = 1 if @nospace == 0 && RE_PUNCT =~ words[0]
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
when 'Lk'
|
||||||
|
if !quote.include?(OPTION)
|
||||||
|
url = words.shift
|
||||||
|
if name = shift_arg(words)
|
||||||
|
retval << '\\fI' << name << ':\\fP '
|
||||||
|
end
|
||||||
|
retval << '\\fB'
|
||||||
|
retval << '\\&' if /\A\./ =~ url
|
||||||
|
retval << url << '\\fP'
|
||||||
|
next
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
case word
|
case word
|
||||||
when 'Dv'
|
when 'Dv'
|
||||||
@ -408,7 +440,7 @@ class Mdoc2Man
|
|||||||
# tags
|
# tags
|
||||||
retval << ".TP\n"
|
retval << ".TP\n"
|
||||||
case words[0]
|
case words[0]
|
||||||
when 'Pa', 'Ev'
|
when 'Pa', 'Ev', 'Lk'
|
||||||
words.shift
|
words.shift
|
||||||
retval << '.B'
|
retval << '.B'
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user