Skip to content

Commit

Permalink
+ Added support for redcarpet 2.2+
Browse files Browse the repository at this point in the history
+ Added support for kramdown
  • Loading branch information
al3xandru committed Feb 23, 2013
1 parent 727c510 commit 94f49b8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/rocco
Expand Up @@ -10,7 +10,7 @@
#/ -t, --template=<path> The file to use as template when rendering HTML
#/ -d, --docblocks Parse Docblock @annotations in comments
#/ --help Show this help message

require 'rubygems'
require 'optparse'
require 'fileutils'
require 'rocco'
Expand Down
32 changes: 32 additions & 0 deletions lib/rocco.rb
Expand Up @@ -32,6 +32,38 @@
#### Prerequisites

# We'll need a Markdown library. Try to load one if not already established.
unless defined?(Markdown)
begin
require 'redcarpet'

class Markdown
@@markdown = Redcarpet::Markdown.new(Redcarpet::Render::SmartyHTML, :fenced_code_blocks => true)

def initialize(text, *rest)
@text = text
end

def to_html
@@markdown.render(@text)
end
end
rescue LoadError, NameError
end
end

unless defined?(Markdown)
begin
require 'kramdown'

class Markdown < Kramdown::Document
def initialize(text, *rest)
super text, :auto_ids => false
end
end
rescue LoadError
end
end

unless defined?(Markdown)
markdown_libraries = %w[redcarpet rdiscount bluecloth]
begin
Expand Down
6 changes: 4 additions & 2 deletions rocco.gemspec
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.name = 'rocco'
s.version = '0.8.2'
s.date = '2011-08-27'
s.date = '2013-01-23'

s.description = "Docco in Ruby"
s.summary = s.description
Expand All @@ -21,6 +21,7 @@ Gem::Specification.new do |s|
s.files = %w[
CHANGES.md
COPYING
Gemfile
README
Rakefile
bin/rocco
Expand All @@ -46,13 +47,14 @@ Gem::Specification.new do |s|
test/test_reported_issues.rb
test/test_skippable_lines.rb
test/test_source_list.rb
test/test_stylesheet.rb
]
# = MANIFEST =

s.executables = ["rocco"]

s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
s.add_dependency 'redcarpet', '~> 1.17'
s.add_dependency 'redcarpet'
s.add_dependency 'mustache'

s.has_rdoc = false
Expand Down

0 comments on commit 94f49b8

Please sign in to comment.