snaptoken 0.12.0 → 0.13.0
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 +4 -4
- data/lib/snaptoken/commands/doc.rb +13 -9
- 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: 4efad115f3cb1376a5586f18969fdd7e1e9d54fb
|
|
4
|
+
data.tar.gz: 9cea842498ffe65612e2725414e5eb5bb980067a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22649a4cbc0e63703a06d3c13f1de6be7578820714dc143ed68bd463e5f9baf0363e1f89b39f53455db152cbfb952df6a2845fa8e53276a306a839b484a3edfc
|
|
7
|
+
data.tar.gz: 8c7816177098407d716f7b3c7f77aea23da6f73a19cc159288f438ab1c1fcab4acabc51e3267ea731237c518b1d848c3f24adfb2694a6707870249c0d0d11bd6
|
|
@@ -11,8 +11,10 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
|
11
11
|
needs! :config, :config_name, :config_title, :steps_folder, :steps, :doc
|
|
12
12
|
|
|
13
13
|
FileUtils.cd(File.join(@config[:path], "doc")) do
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
unless @args.include? "--no-diffs"
|
|
15
|
+
FileUtils.rm_rf("html_out")
|
|
16
|
+
FileUtils.mkdir("html_out")
|
|
17
|
+
end
|
|
16
18
|
|
|
17
19
|
copy_static_files
|
|
18
20
|
write_css
|
|
@@ -63,11 +65,13 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
|
63
65
|
end
|
|
64
66
|
|
|
65
67
|
def prerender_diffs
|
|
68
|
+
return if @args.include? "--no-diffs"
|
|
66
69
|
diffs = {}
|
|
67
70
|
FileUtils.cd("../steps") do
|
|
68
71
|
FileUtils.mkdir_p("0")
|
|
69
72
|
last_step = "0"
|
|
70
73
|
Dir["*"].sort_by(&:to_i).each do |step|
|
|
74
|
+
print "\r\e[K#{step}"
|
|
71
75
|
names = [step.to_i.to_s]
|
|
72
76
|
if step =~ /\d+\-([\w-]+)$/
|
|
73
77
|
names << $1
|
|
@@ -81,6 +85,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
|
81
85
|
|
|
82
86
|
last_step = step
|
|
83
87
|
end
|
|
88
|
+
puts
|
|
84
89
|
FileUtils.rmdir("0")
|
|
85
90
|
end
|
|
86
91
|
diffs
|
|
@@ -92,6 +97,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
|
92
97
|
index = ""
|
|
93
98
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
|
|
94
99
|
pages = Dir["*.md"].sort.map { |f| f.sub(/\.md$/, '') }
|
|
100
|
+
pages.delete "00.index"
|
|
95
101
|
pages.each.with_index do |page, idx|
|
|
96
102
|
md = File.read("#{page}.md")
|
|
97
103
|
md =~ /^# (.+)$/
|
|
@@ -99,6 +105,8 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
|
99
105
|
|
|
100
106
|
index << "<li><a href='#{page}.html'>#{title}</a></li>\n"
|
|
101
107
|
|
|
108
|
+
next if @args.include? "--no-diffs"
|
|
109
|
+
|
|
102
110
|
prev_link = "<a href='#'></a>"
|
|
103
111
|
if idx > 0
|
|
104
112
|
prev_link = "<a href='#{pages[idx-1]}.html'>← prev</a>"
|
|
@@ -122,13 +130,9 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
|
122
130
|
File.write(File.join("html_out", "#{page}.html"), html)
|
|
123
131
|
end
|
|
124
132
|
|
|
125
|
-
content =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<ol>
|
|
129
|
-
#{index}
|
|
130
|
-
</ol>
|
|
131
|
-
HTML
|
|
133
|
+
content = markdown.render(File.read("00.index.md"))
|
|
134
|
+
content = Redcarpet::Render::SmartyPants.render(content)
|
|
135
|
+
content.gsub!(/<p>{{toc}}<\/p>/) { "<ol>#{index}</ol>" }
|
|
132
136
|
|
|
133
137
|
if File.exist?("html_in/template_index.html")
|
|
134
138
|
html = File.read("html_in/template_index.html")
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snaptoken
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Ruten
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-03-
|
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rugged
|