AFTER_NAME_SECTION = 3
class Preprocessor < Asciidoctor::Extensions::Preprocessor
+ include Asciidoctor::Logging
+
def process document, reader
lines = reader.read_lines
state = BEFORE_NAME_SECTION
+ command = document.attributes['docname'].split('.', 2)[0]
lines.map! do |line|
if state == IN_NAME_SECTION
line.sub! " \u2013 ", " - "
line.sub! " \u2014 ", " - "
+ if line.start_with? command and not line.start_with? "#{command} - "
+ logger.warn "adding dash to name section of #{document.attributes['docfile']}"
+ line.sub! command, "#{command} - "
+ end
end
if line.start_with? '== '