snaptoken 0.18.0 → 0.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cdda0b4122ad8de3618fbe31a5bb47444c4c028
4
- data.tar.gz: 847bf9a36e8a2985abead05a23d61ea946fbb2ff
3
+ metadata.gz: 545140027c981fe0ffe37f26e2624c217d2f24b1
4
+ data.tar.gz: 1cd114bc8a2d9da435a0d5e0bdcd4d1fec731ad1
5
5
  SHA512:
6
- metadata.gz: 80c11378a11b53fdb0d81bcd74abe044b71e608095e39328bc9b31eea958d0fef049c0ee4f02813d1366c0d376d3d4d7e69dfea1fe498f3fdd4de97e5c6b66a0
7
- data.tar.gz: d5e76857782a44258e6dcde59d774cd480f3f237cd7201154c68a170a48c3947c9eee21ccc626441fd04a23eccb041f59a91f58e554358cdbd6fd294ceea0c08
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
- unless @args.include? "-c"
15
- FileUtils.rm_rf("html_out")
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>&lsquo;/) { "</code>&rsquo;" }
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
@@ -170,11 +170,12 @@ class Snaptoken::Diff
170
170
  @files = {}
171
171
 
172
172
  git_diff.lines.each do |line|
173
- if !in_diff && line =~ /^diff --git (\S+) (\S+)$/
174
- diff_file = DiffFile.new(File.basename($2))
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.18.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-03-31 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged