class YARD::Templates::Helpers::Markup::RDocMarkup
def fix_dash_dash(text)
- Todo: - Refactor into own SimpleMarkup subclass
def fix_dash_dash(text) text.gsub(/—(?=\S)/, '--') end
def fix_typewriter(text)
- Todo: - Refactor into own SimpleMarkup subclass
def fix_typewriter(text) code_tags = 0 text.gsub(%r{<(/)?(pre|code|tt)|(\s|^|>)\+(?! )([^\n\+]{1,900})(?! )\+}) do |str| closed = $1 tag = $2 first_text = $3 type_text = $4 if tag code_tags += (closed ? -1 : 1) next str end next str unless code_tags == 0 first_text + '<tt>' + type_text + '</tt>' end end
def initialize(text)
def initialize(text) @text = text @@mutex.synchronize do @@formatter ||= RDocMarkupToHtml.new @@markup ||= MARKUP.new end end
def to_html
def to_html html = nil @@mutex.synchronize do @@formatter.from_path = from_path html = @@markup.convert(@text, @@formatter) end html = fix_dash_dash(html) html = fix_typewriter(html) html end