snaptoken 0.18.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snaptoken/commands/doc.rb +5 -20
- data/lib/snaptoken/diff.rb +3 -2
- 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: 545140027c981fe0ffe37f26e2624c217d2f24b1
|
4
|
+
data.tar.gz: 1cd114bc8a2d9da435a0d5e0bdcd4d1fec731ad1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 565f94f26a32f86b785943a7df713e3f9a3cfa20cb0d110f4d5c71ea5fbb3ad5b1d86c201235e7448b0ad5aa028b56626bf846a7e0e968c05177d1cdc596e6dc
|
7
|
+
data.tar.gz: a901bc63c54d19227134d9ce2e267ce88207f89e23c0df5201237fa9f9ddf035a0c0baf47ae4a5deabb65f4f80d62ebbb4a698c2401bb4cb41c15c9b7560dd09
|
@@ -11,10 +11,8 @@ 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
|
-
|
16
|
-
FileUtils.mkdir("html_out")
|
17
|
-
end
|
14
|
+
FileUtils.rm_rf("html_out")
|
15
|
+
FileUtils.mkdir("html_out")
|
18
16
|
|
19
17
|
copy_static_files
|
20
18
|
write_css
|
@@ -22,21 +20,6 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
|
-
class HTMLLineByLine < Rouge::Formatter
|
26
|
-
def initialize(formatter)
|
27
|
-
@formatter = formatter
|
28
|
-
end
|
29
|
-
|
30
|
-
def stream(tokens, &b)
|
31
|
-
token_lines(tokens) do |line|
|
32
|
-
line.each do |tok, val|
|
33
|
-
yield @formatter.span(tok, val)
|
34
|
-
end
|
35
|
-
yield "\n"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
23
|
private
|
41
24
|
|
42
25
|
def copy_static_files
|
@@ -109,7 +92,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
109
92
|
end
|
110
93
|
|
111
94
|
index = ""
|
112
|
-
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
|
95
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(with_toc_data: true))
|
113
96
|
pages = Dir["*.md"].sort.map { |f| f.sub(/\.md$/, '') }
|
114
97
|
pages.delete "00.index"
|
115
98
|
pages.each.with_index do |page, idx|
|
@@ -131,6 +114,8 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
|
|
131
114
|
|
132
115
|
content = markdown.render(md)
|
133
116
|
content = Redcarpet::Render::SmartyPants.render(content)
|
117
|
+
content.gsub!(/<\/code>‘/) { "</code>’" }
|
118
|
+
content.gsub!(/^\s*<h([23456]) id="([^"]+)">(.+)<\/h\d>$/) { "<h#{$1} id=\"#{$2}\"><a href=\"##{$2}\">#{$3}</a></h#{$1}>" }
|
134
119
|
content.gsub!(/<p>{{([\w-]+)}}<\/p>/) { diffs[$1] }
|
135
120
|
|
136
121
|
html = html_template.dup
|
data/lib/snaptoken/diff.rb
CHANGED
@@ -170,11 +170,12 @@ class Snaptoken::Diff
|
|
170
170
|
@files = {}
|
171
171
|
|
172
172
|
git_diff.lines.each do |line|
|
173
|
-
if
|
174
|
-
diff_file = DiffFile.new(
|
173
|
+
if line =~ /^diff --git (\S+) (\S+)$/
|
174
|
+
diff_file = DiffFile.new($2.split("/")[2..-1].join("/"))
|
175
175
|
@files[diff_file.filename] = diff_file
|
176
176
|
section_stack = [diff_file]
|
177
177
|
line_idx = -1
|
178
|
+
in_diff = false
|
178
179
|
elsif !in_diff && line.start_with?('new file')
|
179
180
|
diff_file.new_file!
|
180
181
|
elsif line.start_with? '@@'
|
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.19.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-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|