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 92 def initialize @in_dquote = false @in_squote = false end
Public Instance Methods
Source
# File lib/rdoc/markup/to_html.rb, line 97 def convert(quote, after_word:) case quote when '"' type = @in_dquote ? :close_dquote : :open_dquote @in_dquote = !@in_dquote when "'" if @in_squote type = :close_squote @in_squote = false elsif after_word # Mary's dog, my parents' house: do not start paired quotes type = :close_squote else type = :open_squote @in_squote = true end when '`' # Opening quote of <tt>`quoted sentence'</tt>. # This will conflict with code blocks <tt>`puts('hello')`</tt> in the future. if !@in_squote && !after_word type = :open_squote @in_squote = true end end TO_HTML_CHARACTERS[quote.encoding][type] if type end