lib/docify/markup.rb in docify-1.0.4 vs lib/docify/markup.rb in docify-1.0.5
- old
+ new
@@ -1,12 +1,6 @@
-if RUBY_VERSION >= '1.9'
- require 'rdoc/markup/to_html'
-else
- require 'rdoc/generators/html_generator'
- require 'ostruct'
-end
-
+require 'rdoc/markup/to_html'
require 'RedCloth'
require 'rdiscount'
module Docify
module Markup
@@ -18,24 +12,13 @@
raise ArgumentError, 'Filename required!' if name.empty?
format = detect_format(name)
format == :text ? content : self.send(format, content)
end
- if RUBY_VERSION >= '1.9'
- # Render content for RDoc on Ruby 1.9
- def rdoc(content)
- markup = RDoc::Markup::ToHtml.new
- markup.convert(content)
- end
- else
- # Render content for RDoc
- def rdoc(content)
- simple_markup = SM::SimpleMarkup.new
- generator = Generators::HyperlinkHtml.new('', OpenStruct.new)
- simple_markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
- simple_markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
- simple_markup.convert(content, generator)
- end
+ # Render content for RDoc
+ def rdoc(content)
+ markup = RDoc::Markup::ToHtml.new
+ markup.convert(content)
end
# Render content for Markdown
def markdown(content)
Markdown.new(content).to_html
\ No newline at end of file