diff options
Diffstat (limited to 'lib/rdoc/text.rb')
-rw-r--r-- | lib/rdoc/text.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index c3218fdb2f..9804f81abe 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -10,6 +10,10 @@ require 'strscan' module RDoc::Text + ## + # The language for this text. This affects stripping comments + # markers. + attr_accessor :language ## @@ -218,10 +222,10 @@ module RDoc::Text when s.scan(/\.\.\.(\.?)/) then html << s[1] << encoded[:ellipsis] after_word = nil - when s.scan(/\(c\)/) then + when s.scan(/\(c\)/i) then html << encoded[:copyright] after_word = nil - when s.scan(/\(r\)/) then + when s.scan(/\(r\)/i) then html << encoded[:trademark] after_word = nil when s.scan(/---/) then @@ -237,10 +241,18 @@ module RDoc::Text when s.scan(/``/) then # backtick double quote html << encoded[:open_dquote] after_word = nil - when s.scan(/''/) then # tick double quote + when s.scan(/(?:'|'){2}/) then # tick double quote html << encoded[:close_dquote] after_word = nil - when s.scan(/'/) then # single quote + when s.scan(/`/) then # backtick + if insquotes or after_word + html << '`' + after_word = false + else + html << encoded[:open_squote] + insquotes = true + end + when s.scan(/'|'/) then # single quote if insquotes html << encoded[:close_squote] insquotes = false @@ -301,4 +313,10 @@ module RDoc::Text res.join.strip end + ## + # Character class to be separated by a space when concatenating + # lines. + + SPACE_SEPARATED_LETTER_CLASS = /[\p{Nd}\p{Lc}\p{Pc}]|[!-~&&\W]/ + end |