pretty_doc 1.0.2 → 1.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 005bbc9c34b1951066f640201f2784cfb7cc0cbd
4
- data.tar.gz: f240c8fa986a8370a91e6c27ad879430347e0b23
3
+ metadata.gz: a24955a90cc4b2b627cd6e9f998feff294d6b086
4
+ data.tar.gz: 04f1a2c4f45411c775aa13decdab38d4ccf5bea3
5
5
  SHA512:
6
- metadata.gz: 83d3a675a5c9955a65491e7bac099231ff31e76f15cc8a090008a3fffcab2b6e0a4a6a44823e185acd7f6aea31f01f4e75e1ae1eb7eb65727647b11ff05f45e0
7
- data.tar.gz: 2a8cf1109911faf61037146e9f8788386d42ccfaa6863d4fdb9719ac4af3062731010c255ced7692c6454a20fe38e73d2705a7cfa0d5efb3996a801bdf623c8f
6
+ metadata.gz: 84be63c2098f72bb9f79b767f242ad849579af0585980f8c39d88fccb6aeb75e143de225a09cfddb89a5972d8a1a6402037949accaee9af6d7fa7390a3903321
7
+ data.tar.gz: 1aa3bc7a648203cc1d9069951674a89a74bf49a115fee08cacab4036e2a805ca9cc494a1de7e07fa08bdc99143858ac068495437664c4d0ba87b418a8bcf3f4a
data/CHANGES.md CHANGED
@@ -1,6 +1,11 @@
1
+ 1.0.3
2
+ -----------
3
+ - Fix `GBK` encoding error on windows
4
+ - Adjust default output dir to `./out`
5
+
1
6
  1.0.2
2
7
  -----------
3
- - fix parallel style for image, video tag
8
+ - Fix parallel style for image, video tag
4
9
 
5
10
  1.0.1
6
11
  -----------
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
@@ -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 = File.expand_path('.')
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 = File.expand_path(o || '.')
35
- if !Dir.exist? options.output
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 codes') do
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
@@ -1,3 +1,3 @@
1
1
  module PrettyDoc
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -407,12 +407,12 @@ ul.sections > li > div {
407
407
  }
408
408
 
409
409
  #container {
410
- left: 28%;
411
- width: 72%;
410
+ left: 24%;
411
+ width: 76%;
412
412
  }
413
413
 
414
414
  #markdown-toc {
415
- width: 24%;
415
+ width: 20%;
416
416
  }
417
417
 
418
418
  #background {
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.2
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-22 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri