aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/extensions/document_title_processor.rb
blob: fd258445b77df0347ffc4931d45b57e07ae2f76b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Nuldoc
  module Extensions
    class DocumentTitleProcessor < Asciidoctor::Extensions::TreeProcessor
      def process(doc)
        doc.title = substitute_document_title(doc.title)
      end

      private

      def substitute_document_title(title)
        title.sub(/\A\[(.+?)\] /, '【\1】')
      end
    end
  end
end