Fixing (among other things) alternate header syntax

The following works in Docco, but not in Rocco:

    Level 1 Heading
    ===============

    Level 2 Heading
    ---------------

Happily, the fix is trivial.  In Docco, the regex for comments is:

    # Does the line begin with a comment?
    l.comment_matcher = new RegExp('^\\s*' + l.symbol + '\\s?')

Changing Rocco's comment pattern to:

    @comment_pattern = Regexp.new("^\\s*#{@options[:comment_chars]}\s?")

Solves the problem for me.
This commit is contained in:
Mike West 2010-10-14 18:57:35 +02:00
parent 198be61e7c
commit b9b69d98fb

View File

@ -85,7 +85,7 @@ class Rocco
} }
@options = defaults.merge(options) @options = defaults.merge(options)
@sources = sources @sources = sources
@comment_pattern = Regexp.new("^\\s*#{@options[:comment_chars]}") @comment_pattern = Regexp.new("^\\s*#{@options[:comment_chars]}\s?")
@sections = highlight(split(parse(@data))) @sections = highlight(split(parse(@data)))
end end