From 939e7f0e8a1d392dedb4c42fc9f8d73b7cfad5cf Mon Sep 17 00:00:00 2001 From: Mike West Date: Thu, 14 Oct 2010 18:19:00 +0200 Subject: [PATCH 1/3] Integrate `pilcrow` change from Docco MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rocco uses the Docco CSS directly, so when they make an update to the HTML/CSS, Rocco needs to play along. In this case, Docco changed from `#` to `ΒΆ`, and changed classnames as well (in [f8a88d66b381a1c04358][]). This commit migrates that change to Rocco. [f8a88d66b381a1c04358]: http://github.com/jashkenas/docco/commit/f8a88d66b381a1c04358fa9ef31dd58871b22dd6 --- lib/rocco/layout.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rocco/layout.mustache b/lib/rocco/layout.mustache index 48c4af0..2f07f61 100644 --- a/lib/rocco/layout.mustache +++ b/lib/rocco/layout.mustache @@ -31,8 +31,8 @@ {{#sections}} -
- # +
+
{{{ docs }}} From 198be61e7c07e2307bac49ada98967d41cf07045 Mon Sep 17 00:00:00 2001 From: Mike West Date: Thu, 14 Oct 2010 18:31:20 +0200 Subject: [PATCH 2/3] Fixing code highlighting in bash mode Rocco splits against ``, which works fine for Ruby where the `span` has a class of `c1`, but fails for Bash (and probably other languages), where the `span` has a class of `c`. The fix is trivial. --- lib/rocco.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rocco.rb b/lib/rocco.rb index 9e2a0eb..f91895e 100644 --- a/lib/rocco.rb +++ b/lib/rocco.rb @@ -176,7 +176,7 @@ class Rocco # Do some post-processing on the pygments output to split things back # into sections and remove partial `
` blocks.
     code_html = code_html.
-      split(/\n*#{@options[:comment_chars]} DIVIDER<\/span>\n*/m).
+      split(/\n*#{@options[:comment_chars]} DIVIDER<\/span>\n*/m).
       map { |code| code.sub(/\n?
/m, '') }.
       map { |code| code.sub(/\n?<\/pre><\/div>\n/m, '') }
 

From b9b69d98fbd1185c68d617b576987f0a886c819c Mon Sep 17 00:00:00 2001
From: Mike West 
Date: Thu, 14 Oct 2010 18:57:35 +0200
Subject: [PATCH 3/3] 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.
---
 lib/rocco.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rocco.rb b/lib/rocco.rb
index f91895e..655d6c4 100644
--- a/lib/rocco.rb
+++ b/lib/rocco.rb
@@ -85,7 +85,7 @@ class Rocco
     }
     @options = defaults.merge(options)
     @sources = sources
-    @comment_pattern = Regexp.new("^\\s*#{@options[:comment_chars]}")
+    @comment_pattern = Regexp.new("^\\s*#{@options[:comment_chars]}\s?")
     @sections = highlight(split(parse(@data)))
   end