class RDoc::Markup::ToHtml::QuoteConverter
Converts ascii quote pairs to multibyte quote characters
Public Class Methods
Source
# File lib/rdoc/markup/to_html.rb, line 86 def initialize @in_dquote = false @in_squote = false end
Public Instance Methods
Source
# File lib/rdoc/markup/to_html.rb, line 91 def convert(quote, after_word:) case quote when '"' type = @in_dquote ? :close_dquote : :open_dquote @in_dquote = !@in_dquote when "'" if @insquotes type = :close_squote @insquotes = false elsif after_word # Mary's dog, my parents' house: do not start paired quotes type = :close_squote else type = :open_squote @insquotes = true end when '`' # Opening quote of <tt>`quoted sentence'</tt>. # This will conflict with code blocks <tt>`puts('hello')`</tt> in the future. if !@insquotes && !after_word type = :open_squote @insquotes = true end end TO_HTML_CHARACTERS[quote.encoding][type] if type end