docify 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/README.md +89 -0
- data/bin/docify +21 -23
- data/lib/docify.rb +34 -6
- data/lib/docify/document.rb +38 -11
- data/lib/docify/format.rb +23 -18
- data/lib/docify/markup.rb +0 -24
- data/lib/docify/version.rb +1 -1
- data/spec/docify_spec.rb +35 -15
- data/spec/document_spec.rb +19 -6
- data/spec/markup_spec.rb +4 -4
- data/spec/spec_helper.rb +3 -7
- data/spec/template_spec.rb +2 -1
- metadata +80 -86
- data/README.rdoc +0 -48
data/.travis.yml
ADDED
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# Docify
|
2
|
+
|
3
|
+
Docify allows you to render your markup files (Rdoc/Markup/Textile) into nice-looking html files.
|
4
|
+
|
5
|
+
Produced result looks similar to GitHub's README and other doc files.
|
6
|
+
|
7
|
+
Available as a library and a binary.
|
8
|
+
|
9
|
+
## Dependencies
|
10
|
+
|
11
|
+
- rdoc
|
12
|
+
- rdiscount
|
13
|
+
- RedCloth
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
gem install docify
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'docify'
|
23
|
+
|
24
|
+
doc = Docify::Document.new('path/to/file.md')
|
25
|
+
|
26
|
+
# Renders text with markdown
|
27
|
+
doc.render('markdown')
|
28
|
+
|
29
|
+
# Renders text with markdown without css styling
|
30
|
+
doc.render('markdown', false)
|
31
|
+
|
32
|
+
# Save rendered content into the file
|
33
|
+
doc.save_to('/path/to/output.html')
|
34
|
+
```
|
35
|
+
|
36
|
+
Or use simplified shortcut methods:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
# Render for specified language
|
40
|
+
Docify.render('content', :markdown)
|
41
|
+
|
42
|
+
# Render the content with autodetection from filename
|
43
|
+
Docify.render_auto('content', 'README.md')
|
44
|
+
```
|
45
|
+
|
46
|
+
Docify is tested on the following rubies:
|
47
|
+
|
48
|
+
- Ruby 1.8.7
|
49
|
+
- Ruby EE
|
50
|
+
- Ruby 1.9.2
|
51
|
+
|
52
|
+
## Terminal usage
|
53
|
+
|
54
|
+
```
|
55
|
+
Usage: docify [options] FILE
|
56
|
+
-l, --list List of all formats
|
57
|
+
-f, --format FORMAT Render as format
|
58
|
+
--no-html Disable HTML
|
59
|
+
--no-css Disable css styling
|
60
|
+
-o, --output=PATH Output file path
|
61
|
+
-h, --help Show this information
|
62
|
+
```
|
63
|
+
|
64
|
+
By default docify will output result to terminal:
|
65
|
+
|
66
|
+
docify YOUR_FILE.rdoc
|
67
|
+
>> ...... rendered content
|
68
|
+
|
69
|
+
To save results just pass --output with filename
|
70
|
+
|
71
|
+
docify YOUR_FILE.rdoc --output ~/Desktop/file.html
|
72
|
+
|
73
|
+
Or use regular piping:
|
74
|
+
|
75
|
+
docify YOUR_FILE.rdoc > ~/Desktop/file.html
|
76
|
+
|
77
|
+
Format will be automatically detected from filename. But if you need to force your format just type:
|
78
|
+
|
79
|
+
docify YOUR_FILE.rdoc --format textile
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
Copyright © 2011 Dan Sosedoff.
|
84
|
+
|
85
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
86
|
+
|
87
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
88
|
+
|
89
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/docify
CHANGED
@@ -3,18 +3,18 @@
|
|
3
3
|
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
4
|
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
5
5
|
|
6
|
-
require 'bundler/setup'
|
7
|
-
require 'optparse'
|
8
6
|
require 'docify'
|
7
|
+
require 'optparse'
|
9
8
|
|
10
9
|
# ------------------------------------------------------------------------------
|
11
10
|
# Default options
|
12
11
|
# ------------------------------------------------------------------------------
|
13
12
|
|
14
13
|
options = {
|
15
|
-
:format => nil,
|
16
|
-
:output => nil,
|
17
|
-
:
|
14
|
+
:format => nil,
|
15
|
+
:output => nil,
|
16
|
+
:html => true,
|
17
|
+
:css => true
|
18
18
|
}
|
19
19
|
|
20
20
|
# ------------------------------------------------------------------------------
|
@@ -24,21 +24,23 @@ options = {
|
|
24
24
|
optparse = OptionParser.new do |opts|
|
25
25
|
opts.banner = "Usage: docify [options] FILE"
|
26
26
|
opts.on('-l', '--list', 'List of all formats') do
|
27
|
-
puts
|
28
|
-
Docify::FORMATS.each { |f| puts
|
27
|
+
$stdout.puts("Formats:")
|
28
|
+
Docify::FORMATS.each { |f| $stdout.puts("- #{f}") }
|
29
29
|
exit
|
30
30
|
end
|
31
31
|
opts.on('-f', '--format FORMAT', 'Render as format') do |f|
|
32
32
|
unless Docify.valid_format?(f)
|
33
|
-
puts
|
33
|
+
$stderr.puts("Invalid format: #{f}")
|
34
|
+
exit
|
34
35
|
end
|
35
36
|
options[:format] = f
|
36
37
|
end
|
37
|
-
opts.on('--no-
|
38
|
+
opts.on('--no-html', 'Disable HTML') { options[:html] = false }
|
39
|
+
opts.on('--no-css', 'Disable css styling') { options[:css] = false }
|
38
40
|
opts.on('-o', '--output=PATH', 'Output file path') do |path|
|
39
41
|
options[:output] = path
|
40
42
|
end
|
41
|
-
opts.on('-h', '--help', "Show this information") { puts
|
43
|
+
opts.on('-h', '--help', "Show this information") { $stdout.puts(opts.to_s) ; exit }
|
42
44
|
end
|
43
45
|
|
44
46
|
# ------------------------------------------------------------------------------
|
@@ -47,31 +49,27 @@ end
|
|
47
49
|
|
48
50
|
begin
|
49
51
|
optparse.parse!
|
52
|
+
|
50
53
|
file = ARGV.shift.to_s.strip
|
51
54
|
unless file.empty?
|
52
55
|
file = File.expand_path(file)
|
53
56
|
|
54
57
|
begin
|
55
|
-
options[:format] = Docify.detect_format(file)
|
56
58
|
doc = Docify::Document.new(file)
|
57
|
-
doc.render(options
|
59
|
+
doc.render(options)
|
58
60
|
if options[:output].nil?
|
59
|
-
puts
|
61
|
+
$stdout.puts(doc.content)
|
60
62
|
else
|
61
63
|
doc.save_to(options[:output])
|
62
64
|
end
|
63
|
-
rescue ArgumentError => e
|
64
|
-
puts "Error: #{e.message}"
|
65
|
-
exit
|
66
65
|
rescue Exception => e
|
67
|
-
puts
|
68
|
-
exit
|
66
|
+
$stderr.puts("Error: #{e.message}")
|
69
67
|
end
|
70
68
|
else
|
71
|
-
puts
|
72
|
-
|
69
|
+
$stderr.puts("Error: file required.")
|
70
|
+
$stderr.puts(optparse.to_s)
|
73
71
|
end
|
74
|
-
rescue
|
75
|
-
puts
|
76
|
-
|
72
|
+
rescue OptionParser::InvalidOption => e
|
73
|
+
$stderr.puts("Error: #{e.message}")
|
74
|
+
$stderr.puts(optparse.to_s)
|
77
75
|
end
|
data/lib/docify.rb
CHANGED
@@ -6,12 +6,40 @@ require 'docify/markup'
|
|
6
6
|
require 'docify/document'
|
7
7
|
|
8
8
|
module Docify
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
extend Docify::Markup
|
10
|
+
extend Docify::Format
|
11
|
+
|
12
|
+
class << self
|
13
|
+
# Alias for Docify::Document.new
|
14
|
+
#
|
15
|
+
# @return [Docify::Document]
|
16
|
+
#
|
17
|
+
def new(path, format=:markdown)
|
18
|
+
Docify::Document.new(path, format)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Simply renders content for the markup
|
22
|
+
#
|
23
|
+
def render(text, format=:markdown)
|
24
|
+
if Docify::FORMATS.include?(format.to_sym)
|
25
|
+
Docify::Markup.send(format.to_sym, text)
|
26
|
+
else
|
27
|
+
raise ArgumentError, "Invalid markup: #{format}."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Simple render content with auto-detection from filename
|
32
|
+
# It returns the original text if markup language was not detected
|
33
|
+
# or not supported
|
34
|
+
#
|
35
|
+
def render_auto(text, filename)
|
36
|
+
format = detect_format(filename)
|
37
|
+
|
38
|
+
if Docify.valid_format?(format)
|
39
|
+
Docify::Markup.send(format, text)
|
40
|
+
else
|
41
|
+
text
|
42
|
+
end
|
15
43
|
end
|
16
44
|
end
|
17
45
|
end
|
data/lib/docify/document.rb
CHANGED
@@ -1,31 +1,58 @@
|
|
1
1
|
module Docify
|
2
2
|
class Document
|
3
|
+
include Docify::Format
|
4
|
+
include Docify::Markup
|
5
|
+
|
3
6
|
attr_reader :path
|
4
7
|
attr_reader :content
|
8
|
+
attr_reader :format
|
5
9
|
|
6
10
|
# Initialize a new Document object with file path
|
7
|
-
|
11
|
+
#
|
12
|
+
# path - Input file path
|
13
|
+
# format - Markup (default: markdown)
|
14
|
+
#
|
15
|
+
def initialize(path, format=:markdown)
|
8
16
|
raise ArgumentError, "File [#{path}] does not exist!" unless File.exists?(path)
|
9
17
|
raise ArgumentError, "File required!" unless File.file?(path)
|
10
18
|
@path = path
|
19
|
+
@format = detect_format(path)
|
11
20
|
@content = ""
|
12
21
|
end
|
13
22
|
|
14
|
-
# Render document
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
# Render document content
|
24
|
+
#
|
25
|
+
# options - Render options
|
26
|
+
#
|
27
|
+
# options[:format] - Set render format (auto-detection)
|
28
|
+
# options[:html] - Render with html (default: true)
|
29
|
+
# options[:css] - Include CSS styles (default: true)
|
30
|
+
#
|
31
|
+
def render(options={})
|
32
|
+
format = (options[:format] || detect_format(@path)).to_sym
|
33
|
+
use_html = options.key?(:html) ? options[:html] == true : true
|
34
|
+
use_css = options.key?(:css) ? options[:css] == true : true
|
35
|
+
|
36
|
+
unless valid_format?(format)
|
37
|
+
raise ArgumentError, "Invalid format: #{format}"
|
38
|
+
end
|
39
|
+
|
40
|
+
@content = Docify::Markup.send(format, File.read(@path))
|
41
|
+
if use_html == true
|
42
|
+
params = {
|
43
|
+
:title => File.basename(@path),
|
44
|
+
:content => @content,
|
45
|
+
}
|
46
|
+
params[:css] = Docify::CSS if use_css == true
|
21
47
|
@content = Docify::Template.new(Docify::TEMPLATE).render(params)
|
22
|
-
else
|
23
|
-
@content = result
|
24
48
|
end
|
25
49
|
@content
|
26
50
|
end
|
27
51
|
|
28
|
-
# Save rendered content into file
|
52
|
+
# Save rendered content into the file
|
53
|
+
#
|
54
|
+
# path - Output path
|
55
|
+
#
|
29
56
|
def save_to(path)
|
30
57
|
unless File.exists?(File.dirname(path))
|
31
58
|
raise ArgumentError, "Output path does not exist!"
|
data/lib/docify/format.rb
CHANGED
@@ -1,23 +1,28 @@
|
|
1
1
|
module Docify
|
2
|
-
|
3
|
-
FORMATS = ['rdoc', 'markdown', 'textile']
|
2
|
+
FORMATS = [:markdown, :textile, :rdoc]
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
module Format
|
5
|
+
# Detects if specified format is supported
|
6
|
+
def valid_format?(f)
|
7
|
+
FORMATS.include?(f.to_sym)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Detects markup format from filename
|
11
|
+
def detect_format(filename)
|
12
|
+
case(filename)
|
13
|
+
when /\.rdoc/i
|
14
|
+
:rdoc
|
15
|
+
when /\.(md|mkdn?|mdown|markdown)/i
|
16
|
+
:markdown
|
17
|
+
when /\.textile/i
|
18
|
+
:textile
|
19
|
+
end
|
20
|
+
end
|
16
21
|
end
|
17
|
-
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
|
23
|
+
# Returns true if given format is supported
|
24
|
+
#
|
25
|
+
def self.valid_format?(f)
|
26
|
+
f.nil? ? false : FORMATS.include?(f.to_sym)
|
22
27
|
end
|
23
28
|
end
|
data/lib/docify/markup.rb
CHANGED
@@ -5,14 +5,6 @@ require 'rdiscount'
|
|
5
5
|
module Docify
|
6
6
|
module Markup
|
7
7
|
extend self
|
8
|
-
|
9
|
-
# Auto-detect format from filename and render content
|
10
|
-
def render(filename, content)
|
11
|
-
name = File.basename(filename.to_s.strip)
|
12
|
-
raise ArgumentError, 'Filename required!' if name.empty?
|
13
|
-
format = detect_format(name)
|
14
|
-
format == :text ? content : self.send(format, content)
|
15
|
-
end
|
16
8
|
|
17
9
|
# Render content for RDoc
|
18
10
|
def rdoc(content)
|
@@ -29,21 +21,5 @@ module Docify
|
|
29
21
|
def textile(content)
|
30
22
|
RedCloth.new(content).to_html
|
31
23
|
end
|
32
|
-
|
33
|
-
protected
|
34
|
-
|
35
|
-
# Detect markup format from filename
|
36
|
-
def detect_format(filename)
|
37
|
-
case(filename)
|
38
|
-
when /\.rdoc/i
|
39
|
-
:rdoc
|
40
|
-
when /\.(md|mkdn?|mdown|markdown)/i
|
41
|
-
:markdown
|
42
|
-
when /\.textile/i
|
43
|
-
:textile
|
44
|
-
else
|
45
|
-
:text
|
46
|
-
end
|
47
|
-
end
|
48
24
|
end
|
49
25
|
end
|
data/lib/docify/version.rb
CHANGED
data/spec/docify_spec.rb
CHANGED
@@ -1,24 +1,44 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Docify' do
|
4
|
-
it 'should
|
5
|
-
Docify
|
6
|
-
Docify.valid_format?('txt').should == false
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should detect valid format' do
|
10
|
-
README_FILES.each do |k,v|
|
11
|
-
Docify.detect_format(k).should == v
|
12
|
-
end
|
4
|
+
it 'should create a document via shorthand' do
|
5
|
+
Docify.new(fixture_path('README.markdown')).should be_a Docify::Document
|
13
6
|
end
|
14
7
|
|
15
8
|
it 'should render markup directly' do
|
16
|
-
{
|
17
|
-
'README.markdown' =>
|
18
|
-
'README.rdoc' =>
|
19
|
-
'README.textile' =>
|
20
|
-
}
|
9
|
+
files = {
|
10
|
+
'README.markdown' => :markdown,
|
11
|
+
'README.rdoc' => :rdoc,
|
12
|
+
'README.textile' => :textile
|
13
|
+
}
|
14
|
+
|
15
|
+
files.each_pair do |k,v|
|
21
16
|
Docify.render(fixture(k), v).should == fixture(k + ".html")
|
17
|
+
Docify.render(fixture(k), v.to_s).should == fixture(k + ".html")
|
18
|
+
Docify.send(v, fixture(k)).should == fixture(k + ".html")
|
22
19
|
end
|
23
20
|
end
|
24
|
-
|
21
|
+
|
22
|
+
it 'should raise invalid markup error' do
|
23
|
+
proc { Docify.render(fixture('README.markdown'), :foobar) }.
|
24
|
+
should raise_exception ArgumentError, "Invalid markup: foobar."
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should render markup based on format detected from filename' do
|
28
|
+
data = Docify.render_auto(fixture('README.markdown'), 'README.markdown')
|
29
|
+
data.should == fixture('README.markdown.html')
|
30
|
+
|
31
|
+
data = Docify.render_auto(fixture('README.markdown'), 'README.foo')
|
32
|
+
data.should == fixture('README.markdown')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'Hash' do
|
37
|
+
it 'should strinfigy keys' do
|
38
|
+
{:a => 'a', :b => 'b'}.stringify_keys.should == {'a' => 'a', 'b' => 'b'}
|
39
|
+
|
40
|
+
hash = {:a => 'a', :b => 'b'}
|
41
|
+
hash.stringify_keys!
|
42
|
+
hash.should == {'a' => 'a', 'b' => 'b'}
|
43
|
+
end
|
44
|
+
end
|
data/spec/document_spec.rb
CHANGED
@@ -1,27 +1,40 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'Document' do
|
3
|
+
describe 'Docify::Document' do
|
4
4
|
it 'should raise an exception on invalid input file' do
|
5
5
|
proc { Docify::Document.new('qwe123')}.should raise_error ArgumentError, "File [qwe123] does not exist!"
|
6
6
|
proc { Docify::Document.new('/tmp') }.should raise_error ArgumentError, "File required!"
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should auto-detect format from filename' do
|
10
|
+
README_FILES.each_pair do |k,v|
|
11
|
+
Docify::Document.new(fixture_path(k)).format.should == v
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should raise an exception on invalid format' do
|
16
|
+
proc { Docify::Document.new(fixture_path('README.markdown')).render(:format => 'foobar') }.
|
17
|
+
should raise_error ArgumentError, "Invalid format: foobar"
|
18
|
+
end
|
19
|
+
|
9
20
|
it 'should raise an exception on invalid output path' do
|
10
|
-
doc = Docify::Document.new('README.
|
11
|
-
doc.render(
|
21
|
+
doc = Docify::Document.new(fixture_path('README.markdown'))
|
22
|
+
doc.render(:format => :markdown)
|
12
23
|
proc { doc.save_to('~/blah') }.should raise_error ArgumentError, "Output path does not exist!"
|
13
24
|
proc { doc.save_to('/tmp') }.should raise_error ArgumentError, "Output path should be a file!"
|
14
25
|
end
|
15
26
|
|
16
27
|
it 'should render content with styles' do
|
17
28
|
doc = Docify::Document.new(fixture_path('README.markdown'))
|
18
|
-
output = doc.render
|
29
|
+
output = doc.render
|
19
30
|
output.should match(/<meta http-equiv="Content-Type" content="text\/html; charset=UTF-8" \/>/)
|
20
31
|
output.should match(/<title>README.markdown<\/title>/)
|
32
|
+
output.should match(/<style>/)
|
21
33
|
end
|
22
34
|
|
23
35
|
it 'should render content with no styles' do
|
24
|
-
doc = Docify::Document.new(fixture_path('README.markdown'))
|
25
|
-
doc.
|
36
|
+
doc = Docify::Document.new(fixture_path('README.markdown'))
|
37
|
+
output = doc.render(:html => false, :css => false)
|
38
|
+
output == Docify::Markup.markdown(fixture('README.markdown'))
|
26
39
|
end
|
27
40
|
end
|
data/spec/markup_spec.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Docify::Markup do
|
3
|
+
describe 'Docify::Markup' do
|
4
4
|
it 'should render RDoc' do
|
5
|
-
Docify::Markup.
|
5
|
+
Docify::Markup.rdoc(fixture('README.rdoc')).should == fixture('README.rdoc.html')
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should render Markdown' do
|
9
|
-
Docify::Markup.
|
9
|
+
Docify::Markup.markdown(fixture('README.markdown')).should == fixture('README.markdown.html')
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should render Textile' do
|
13
|
-
Docify::Markup.
|
13
|
+
Docify::Markup.textile(fixture('README.textile')).should == fixture('README.textile.html')
|
14
14
|
end
|
15
15
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,13 +8,9 @@ end
|
|
8
8
|
require 'docify'
|
9
9
|
|
10
10
|
README_FILES = {
|
11
|
-
'README'
|
12
|
-
'README.
|
13
|
-
'README.
|
14
|
-
'README.markdown' => 'markdown',
|
15
|
-
'README.textile' => 'textile',
|
16
|
-
'README.txt' => 'rdoc',
|
17
|
-
'README.foo' => 'rdoc'
|
11
|
+
'README.rdoc' => :rdoc,
|
12
|
+
'README.markdown' => :markdown,
|
13
|
+
'README.textile' => :textile
|
18
14
|
}
|
19
15
|
|
20
16
|
def fixture_path(file=nil)
|
data/spec/template_spec.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'Template' do
|
3
|
+
describe 'Document::Template' do
|
4
4
|
it 'should raise ArgumentError if no template were provided' do
|
5
5
|
proc { Docify::Template.new }.should raise_error ArgumentError
|
6
6
|
proc { Docify::Template.new(" ") }.should raise_error ArgumentError
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'should render a valid content' do
|
10
|
+
Docify::Template.new("{{a}}").render(:b => 'b').should == ''
|
10
11
|
Docify::Template.new("{{a}}{{b}}").render(:a => 'a', :b => 'b').should == 'ab'
|
11
12
|
Docify::Template.new("{{a}}{{b}}").render('a' => 'a', 'b' => 'b').should == 'ab'
|
12
13
|
end
|
metadata
CHANGED
@@ -1,120 +1,118 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: docify
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.6
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.5
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Dan Sosedoff
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rake
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2169750600 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
18
|
+
requirements:
|
22
19
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.8'
|
25
22
|
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *2169750600
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &2169780300 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
29
|
+
requirements:
|
33
30
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.5'
|
36
33
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: ZenTest
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *2169780300
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ZenTest
|
38
|
+
requirement: &2169779840 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
40
|
+
requirements:
|
44
41
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.5'
|
47
44
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: simplecov
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *2169779840
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: simplecov
|
49
|
+
requirement: &2169779380 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
51
|
+
requirements:
|
55
52
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.4'
|
58
55
|
type: :development
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: yard
|
62
56
|
prerelease: false
|
63
|
-
|
57
|
+
version_requirements: *2169779380
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: yard
|
60
|
+
requirement: &2169778920 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
|
-
requirements:
|
62
|
+
requirements:
|
66
63
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version:
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0.6'
|
69
66
|
type: :development
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: rdiscount
|
73
67
|
prerelease: false
|
74
|
-
|
68
|
+
version_requirements: *2169778920
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdiscount
|
71
|
+
requirement: &2169778460 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
|
-
requirements:
|
73
|
+
requirements:
|
77
74
|
- - ~>
|
78
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
79
76
|
version: 1.6.8
|
80
77
|
type: :runtime
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: RedCloth
|
84
78
|
prerelease: false
|
85
|
-
|
79
|
+
version_requirements: *2169778460
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: RedCloth
|
82
|
+
requirement: &2169778000 !ruby/object:Gem::Requirement
|
86
83
|
none: false
|
87
|
-
requirements:
|
84
|
+
requirements:
|
88
85
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
86
|
+
- !ruby/object:Gem::Version
|
90
87
|
version: 4.2.3
|
91
88
|
type: :runtime
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: rdoc
|
95
89
|
prerelease: false
|
96
|
-
|
90
|
+
version_requirements: *2169778000
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rdoc
|
93
|
+
requirement: &2169777540 !ruby/object:Gem::Requirement
|
97
94
|
none: false
|
98
|
-
requirements:
|
95
|
+
requirements:
|
99
96
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version:
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '3.7'
|
102
99
|
type: :runtime
|
103
|
-
|
104
|
-
|
105
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2169777540
|
102
|
+
description: Docify provides a command line tool to render documentation files (RDoc,
|
103
|
+
Markdown, Textile) into nice-looking html.
|
104
|
+
email:
|
106
105
|
- dan.sosedoff@gmail.com
|
107
|
-
executables:
|
106
|
+
executables:
|
108
107
|
- docify
|
109
108
|
extensions: []
|
110
|
-
|
111
109
|
extra_rdoc_files: []
|
112
|
-
|
113
|
-
files:
|
110
|
+
files:
|
114
111
|
- .gitignore
|
115
112
|
- .rspec
|
113
|
+
- .travis.yml
|
116
114
|
- Gemfile
|
117
|
-
- README.
|
115
|
+
- README.md
|
118
116
|
- Rakefile
|
119
117
|
- bin/docify
|
120
118
|
- docify.gemspec
|
@@ -137,35 +135,31 @@ files:
|
|
137
135
|
- spec/markup_spec.rb
|
138
136
|
- spec/spec_helper.rb
|
139
137
|
- spec/template_spec.rb
|
140
|
-
has_rdoc: true
|
141
138
|
homepage: http://github.com/sosedoff/docify
|
142
139
|
licenses: []
|
143
|
-
|
144
140
|
post_install_message:
|
145
141
|
rdoc_options: []
|
146
|
-
|
147
|
-
require_paths:
|
142
|
+
require_paths:
|
148
143
|
- lib
|
149
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
145
|
none: false
|
151
|
-
requirements:
|
152
|
-
- -
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version:
|
155
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
151
|
none: false
|
157
|
-
requirements:
|
158
|
-
- -
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version:
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
161
156
|
requirements: []
|
162
|
-
|
163
157
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.
|
158
|
+
rubygems_version: 1.8.10
|
165
159
|
signing_key:
|
166
160
|
specification_version: 3
|
167
161
|
summary: Terminal tool to render markups into html
|
168
|
-
test_files:
|
162
|
+
test_files:
|
169
163
|
- spec/docify_spec.rb
|
170
164
|
- spec/document_spec.rb
|
171
165
|
- spec/fixtures/README.markdown
|
data/README.rdoc
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
= Docify
|
2
|
-
|
3
|
-
This gem allows you to render your documentation files (Rdoc/Markup/Textile) into nice-looking html files.
|
4
|
-
|
5
|
-
Produced result looks similar to GitHub's README and other doc files.
|
6
|
-
|
7
|
-
== Dependencies
|
8
|
-
|
9
|
-
* github/markup
|
10
|
-
* rdiscount
|
11
|
-
* RedCloth
|
12
|
-
|
13
|
-
== Installation
|
14
|
-
|
15
|
-
gem install docify
|
16
|
-
|
17
|
-
== Usage
|
18
|
-
|
19
|
-
Usage: docify [options] FILE
|
20
|
-
-l, --list List of all formats
|
21
|
-
-f, --format FORMAT Render as format
|
22
|
-
--no-css Disable css styling
|
23
|
-
-o, --output=PATH Output file path
|
24
|
-
-h, --help Show this information
|
25
|
-
|
26
|
-
By default docify will write result to terminal:
|
27
|
-
|
28
|
-
docify YOUR_FILE.rdoc
|
29
|
-
|
30
|
-
>> ...... rendered content
|
31
|
-
|
32
|
-
To save results just pass --output with filename
|
33
|
-
|
34
|
-
docify YOUR_FILE.rdoc --output ~/Desktop/file.html
|
35
|
-
|
36
|
-
Or use regular piping:
|
37
|
-
|
38
|
-
docify YOUR_FILE.rdoc > ~/Desktop/file.html
|
39
|
-
|
40
|
-
Format will be automatically detected from filename. But if you need to force your format just type:
|
41
|
-
|
42
|
-
docify YOUR_FILE.rdoc --format textile
|
43
|
-
|
44
|
-
Default format: Rdoc
|
45
|
-
|
46
|
-
== Authors
|
47
|
-
|
48
|
-
* Dan Sosedoff - http://github.com/sosedoff
|