pretty_doc 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -1
- data/README.md +21 -0
- data/build.sh +5 -1
- data/lib/pretty_doc/cli.rb +18 -8
- data/lib/pretty_doc/resources/source.rb +1 -1
- data/lib/pretty_doc/version.rb +1 -1
- data/templates/parallel/style.scss +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a24955a90cc4b2b627cd6e9f998feff294d6b086
|
4
|
+
data.tar.gz: 04f1a2c4f45411c775aa13decdab38d4ccf5bea3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84be63c2098f72bb9f79b767f242ad849579af0585980f8c39d88fccb6aeb75e143de225a09cfddb89a5972d8a1a6402037949accaee9af6d7fa7390a3903321
|
7
|
+
data.tar.gz: 1aa3bc7a648203cc1d9069951674a89a74bf49a115fee08cacab4036e2a805ca9cc494a1de7e07fa08bdc99143858ac068495437664c4d0ba87b418a8bcf3f4a
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -43,6 +43,24 @@ gem install pretty_doc
|
|
43
43
|
# -h, --help output usage information
|
44
44
|
```
|
45
45
|
|
46
|
+
## Generate TOC
|
47
|
+
|
48
|
+
Use `[TOC]` or `{:toc}` in your markdown file to generate table of contents and use `[NO_TOC]` or `{:.no_toc}` to ignore specific header.
|
49
|
+
|
50
|
+
Example:
|
51
|
+
|
52
|
+
```
|
53
|
+
Pretty Doc
|
54
|
+
==========
|
55
|
+
[NO_TOC]
|
56
|
+
|
57
|
+
[TOC]
|
58
|
+
|
59
|
+
## Feature
|
60
|
+
|
61
|
+
## Usage
|
62
|
+
```
|
63
|
+
|
46
64
|
## Create a custom template
|
47
65
|
|
48
66
|
template structure
|
@@ -56,3 +74,6 @@ template structure
|
|
56
74
|
## TODO
|
57
75
|
|
58
76
|
+ Add docs for how to create a custom template
|
77
|
+
+ Add file toc support
|
78
|
+
+ Optimize templates for Windows
|
79
|
+
+ Add custom fonts and javascripts supports
|
data/build.sh
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
git checkout gh-pages
|
2
|
+
|
1
3
|
pretty_doc -t default -o ./examples/default README.md
|
2
4
|
pretty_doc -t bootstrap -o ./examples/bootstrap README.md
|
3
5
|
pretty_doc -t parallel -o ./examples/parallel README.md
|
4
6
|
|
5
|
-
pretty_doc -t parallel README.md
|
7
|
+
pretty_doc -t parallel README.md -o .
|
6
8
|
|
7
9
|
mv README.html index.html
|
10
|
+
|
11
|
+
git checkout master
|
data/lib/pretty_doc/cli.rb
CHANGED
@@ -4,11 +4,12 @@ require 'pretty_doc'
|
|
4
4
|
|
5
5
|
module PrettyDoc
|
6
6
|
class Cli
|
7
|
+
DEFAULT_OUTPUT_DIR = './out'
|
7
8
|
class << self
|
8
9
|
def run!(args)
|
9
10
|
options = OpenStruct.new
|
10
11
|
options.template = 'default'
|
11
|
-
options.output =
|
12
|
+
options.output = output_dir(DEFAULT_OUTPUT_DIR)
|
12
13
|
options.files = []
|
13
14
|
options.enable_line_numbers = false
|
14
15
|
|
@@ -30,19 +31,16 @@ module PrettyDoc
|
|
30
31
|
exit
|
31
32
|
end
|
32
33
|
|
33
|
-
opts.on('-o', '--output [path]', 'output to a given folder') do |o|
|
34
|
-
options.output =
|
35
|
-
|
36
|
-
puts "Directory #{options.output} is not exists, creating new..."
|
37
|
-
FileUtils.mkdir_p(options.output)
|
38
|
-
end
|
34
|
+
opts.on('-o', '--output [path]', 'output to a given folder, default is `./out`') do |o|
|
35
|
+
options.output = output_dir(o || DEFAULT_OUTPUT_DIR)
|
36
|
+
|
39
37
|
end
|
40
38
|
|
41
39
|
opts.on('-t', '--template [folder]', 'choose a template') do |tmpl|
|
42
40
|
options.template = tmpl
|
43
41
|
end
|
44
42
|
|
45
|
-
opts.on('-l', '--line-numbers', 'enable line numbers for
|
43
|
+
opts.on('-l', '--line-numbers', 'enable line numbers for code highlight') do
|
46
44
|
options.enable_line_numbers = true
|
47
45
|
end
|
48
46
|
end
|
@@ -69,6 +67,18 @@ module PrettyDoc
|
|
69
67
|
options.template = PrettyDoc.template(options.template)
|
70
68
|
PrettyDoc::Resource::Source.build(options)
|
71
69
|
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def output_dir(path)
|
74
|
+
path = File.expand_path(path)
|
75
|
+
if !Dir.exist? path
|
76
|
+
puts "Directory #{path} is not exists, creating new..."
|
77
|
+
FileUtils.mkdir_p(path)
|
78
|
+
else
|
79
|
+
path
|
80
|
+
end
|
81
|
+
end
|
72
82
|
end
|
73
83
|
end
|
74
84
|
end
|
@@ -10,7 +10,7 @@ module PrettyDoc
|
|
10
10
|
self.file = file
|
11
11
|
extname = File.extname(file)
|
12
12
|
self.basename = File.basename(file, extname)
|
13
|
-
converter.content = File.read(self.file)
|
13
|
+
converter.content = File.read(self.file, encoding: 'utf-8')
|
14
14
|
converter.options = options
|
15
15
|
self.content = converter.as_html
|
16
16
|
end
|
data/lib/pretty_doc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lyfeyaj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|