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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/snaptoken/commands/doc.rb +13 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '03814fd3146986918c4c33d8fa606e741245fd68'
4
- data.tar.gz: 18e23c04b3104332f2fdb9a752bb1eb51e6fbbd1
3
+ metadata.gz: 4efad115f3cb1376a5586f18969fdd7e1e9d54fb
4
+ data.tar.gz: 9cea842498ffe65612e2725414e5eb5bb980067a
5
5
  SHA512:
6
- metadata.gz: cd071cc29eb3336f2dc4b8fe40cdc4f76dba7163cadd350f647f9fcc7c08744ee11eecfa9aa0a6300229e9fbae766c1b3552deca61299961261c2d24cb37555a
7
- data.tar.gz: e77a2cdc1c27dcc53f6f81070559fe347790b365f0491566ace1fc016d13ca7ff6019cfba710b7d47aa0e203bf8ab7f56a97a7c063acd4ccc68d492f90fcf500
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
- FileUtils.rm_rf("html_out")
15
- FileUtils.mkdir("html_out")
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'>&larr; 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 = <<~HTML
126
- <h1>#{@config[:title]}</h1>
127
- <h2>Table of Contents</h2>
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.12.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-15 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged