Sha256: ad693eb441c9811501cfff7ad9cded8cc0b3ce158f7902c2195347d33a9074c9

Contents?: true

Size: 360 Bytes

Versions: 5

Compression:

Stored size: 360 Bytes

Contents

module Mdoc
  class Processor
    class AddTitle < Processor
      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mdoc-0.0.11 lib/mdoc/processor/add_title.rb
mdoc-0.0.10 lib/mdoc/processor/add_title.rb
mdoc-0.0.9 lib/mdoc/processor/add_title.rb
mdoc-0.0.8 lib/mdoc/processor/add_title.rb
mdoc-0.0.7 lib/mdoc/processor/add_title.rb