docify 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --color
2
2
  --format=nested
3
- --backtrace
@@ -7,7 +7,7 @@ require 'docify/document'
7
7
 
8
8
  module Docify
9
9
  # Simply renders content for the markup
10
- def self.render(text, format='mardown')
10
+ def self.render(text, format='markdown')
11
11
  if Docify::FORMATS.include?(format.to_s)
12
12
  Docify::Markup.send(format.to_sym, text)
13
13
  else
@@ -1,10 +1,4 @@
1
- if RUBY_VERSION >= '1.9'
2
- require 'rdoc/markup/to_html'
3
- else
4
- require 'rdoc/generators/html_generator'
5
- require 'ostruct'
6
- end
7
-
1
+ require 'rdoc/markup/to_html'
8
2
  require 'RedCloth'
9
3
  require 'rdiscount'
10
4
 
@@ -20,21 +14,10 @@ module Docify
20
14
  format == :text ? content : self.send(format, content)
21
15
  end
22
16
 
23
- if RUBY_VERSION >= '1.9'
24
- # Render content for RDoc on Ruby 1.9
25
- def rdoc(content)
26
- markup = RDoc::Markup::ToHtml.new
27
- markup.convert(content)
28
- end
29
- else
30
- # Render content for RDoc
31
- def rdoc(content)
32
- simple_markup = SM::SimpleMarkup.new
33
- generator = Generators::HyperlinkHtml.new('', OpenStruct.new)
34
- simple_markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
35
- simple_markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
36
- simple_markup.convert(content, generator)
37
- end
17
+ # Render content for RDoc
18
+ def rdoc(content)
19
+ markup = RDoc::Markup::ToHtml.new
20
+ markup.convert(content)
38
21
  end
39
22
 
40
23
  # Render content for Markdown
@@ -1,3 +1,3 @@
1
1
  module Docify
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
@@ -11,4 +11,14 @@ describe 'Docify' do
11
11
  Docify.detect_format(k).should == v
12
12
  end
13
13
  end
14
+
15
+ it 'should render markup directly' do
16
+ {
17
+ 'README.markdown' => 'markdown',
18
+ 'README.rdoc' => 'rdoc',
19
+ 'README.textile' => 'textile'
20
+ }.each_pair do |k,v|
21
+ Docify.render(fixture(k), v).should == fixture(k + ".html")
22
+ end
23
+ end
14
24
  end
@@ -1,15 +1,10 @@
1
- <p>
2
- <a href="RDoc.html">RDoc.html</a>
3
- </p>
4
- <p>
5
- <a href="http://rdoc.rubyforge.org">rdoc.rubyforge.org</a>
6
- </p>
7
- <p>
8
- <a href="mailto:user@example.com">user@example.com</a>
9
- </p>
10
- <p>
11
- <a href="http://rdoc.rubyforge.org">RDoc Documentation</a>
12
- </p>
13
- <p>
14
- <a href="../RDoc/Markup.html">RDoc Markup</a>
15
- </p>
1
+
2
+ <p><a href="RDoc.html">RDoc.html</a></p>
3
+
4
+ <p><a href="http://rdoc.rubyforge.org">rdoc.rubyforge.org</a></p>
5
+
6
+ <p><a href="mailto:user@example.com">user@example.com</a></p>
7
+
8
+ <p><a href="http://rdoc.rubyforge.org">RDoc Documentation</a></p>
9
+
10
+ <p><a href="RDoc/Markup.html">RDoc Markup</a></p>
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: docify
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.4
5
+ version: 1.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Sosedoff
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-29 00:00:00 -05:00
13
+ date: 2011-07-11 00:00:00 -05:00
14
14
  default_executable: docify
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency