Method: Mdoc::Processor::AddTitle#process!

Defined in:
lib/mdoc/processor/add_title.rb

#process!(doc) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/mdoc/processor/add_title.rb', line 4

def process!(doc)
  title = doc.title
  if title
    unless doc.body =~ /^\s*\#*\s*#{title}/
      title = '# ' << title << "\n"
      title << "{: .title .no_toc}\n\n"
      doc.body = title + doc.body
    end
  end
end