paperwork 0.2.1 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/lib/paperwork/tasks.rb +1 -1
- data/lib/paperwork/tasks/document.rb +41 -9
- data/lib/paperwork/tasks/middleman_template/config.rb +0 -1
- data/lib/paperwork/tasks/middleman_template/lib/doc_renderer.rb +7 -5
- data/lib/paperwork/tasks/middleman_template/lib/info_helpers.rb +21 -1
- data/lib/paperwork/tasks/root_helpers.rb +1 -1
- data/lib/paperwork/version.rb +1 -1
- data/{navdemo.md → nested_example/navdemo.md} +3 -0
- data/site.yml +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151389aa8930969de29cb2e7969505d8c52f085ffc46cf43bb3168575acbb325
|
4
|
+
data.tar.gz: 8121a20fc3f36067e2273b9cf6ac92173b9ad84cf25f1579c7f20afe1e5bfaf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd6ada05928138cb198175167a0b9cbb1148dcc875f9ccf3a12049eb759a60832dffd538de17c31d4138aa8d4bf6ef7f1cb9b26d23d863e8770e1044ebb572ef
|
7
|
+
data.tar.gz: ea9028ea7f182d5d98841dc6e01ebe75c6e45e6839389c4a4247219e3efd56648ac317985209cecc2c1a25fbf3f0466cf780025648ef3d1e7498ef119cf328c1
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -13,4 +13,4 @@ task rebuild: [:clean, :build]
|
|
13
13
|
task default: :spec
|
14
14
|
CLEAN.include(".work/coverage")
|
15
15
|
|
16
|
-
paperwork :doc, sources: ["README.md", "navdemo.md", "site.yml", "custom.js", "custom.css"]
|
16
|
+
paperwork :doc, sources: ["README.md", "nested_example/navdemo.md", "site.yml", "custom.js", "custom.css"]
|
data/lib/paperwork/tasks.rb
CHANGED
@@ -17,7 +17,7 @@ module Paperwork
|
|
17
17
|
dependencies = []
|
18
18
|
if task.nil?
|
19
19
|
task = options.keys.first
|
20
|
-
dependencies = options.delete(
|
20
|
+
dependencies = options.delete(task)
|
21
21
|
end
|
22
22
|
doc = Paperwork::Tasks::Document.new(task, sources, *dependencies)
|
23
23
|
doc.create_tasks
|
@@ -9,7 +9,7 @@ module Paperwork
|
|
9
9
|
##
|
10
10
|
# main task generator for building the document
|
11
11
|
#
|
12
|
-
class Document < Paperwork::Tasks::Base
|
12
|
+
class Document < Paperwork::Tasks::Base # rubocop:disable Metrics/ClassLength
|
13
13
|
attr_reader :dir
|
14
14
|
|
15
15
|
include Rake::DSL
|
@@ -34,19 +34,26 @@ module Paperwork
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def get_destination(dst_base, src) # rubocop:disable Metrics/AbcSize
|
37
|
+
def get_destination(dst_base, src) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
38
|
+
nested_base = File.dirname(src)
|
39
|
+
nested_base = if nested_base == "."
|
40
|
+
dst_base
|
41
|
+
else
|
42
|
+
File.join(dst_base, nested_base)
|
43
|
+
end
|
44
|
+
|
38
45
|
ext = File.extname(src)
|
39
46
|
case ext
|
40
47
|
when ".md"
|
41
|
-
File.join(
|
48
|
+
File.join(nested_base, File.basename(src)).gsub(".md", ".html.md")
|
42
49
|
when ".scss"
|
43
|
-
Paperwork::Config[:custom_css] << File.basename(src)
|
50
|
+
Paperwork::Config[:custom_css] << File.basename(src, ext)
|
44
51
|
File.join(dst_base, "stylesheets", File.basename(src)).gsub(".scss", ".css.scss")
|
45
52
|
when ".css"
|
46
|
-
Paperwork::Config[:custom_css] << File.basename(src)
|
53
|
+
Paperwork::Config[:custom_css] << File.basename(src, ext)
|
47
54
|
File.join(dst_base, "stylesheets", File.basename(src))
|
48
55
|
when ".js"
|
49
|
-
Paperwork::Config[:custom_js] << File.basename(src)
|
56
|
+
Paperwork::Config[:custom_js] << File.basename(src, ext)
|
50
57
|
File.join(dst_base, "javascripts", File.basename(src))
|
51
58
|
when ".yml"
|
52
59
|
File.join(dst_base, "..", "data", File.basename(src))
|
@@ -79,9 +86,9 @@ module Paperwork
|
|
79
86
|
end
|
80
87
|
end
|
81
88
|
|
82
|
-
def tasks_nested # rubocop:disable Metrics/AbcSize
|
83
|
-
namespace :paperwork do
|
84
|
-
namespace self.name do
|
89
|
+
def tasks_nested # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
90
|
+
namespace :paperwork do # rubocop:disable Metrics/BlockLength
|
91
|
+
namespace self.name do # rubocop:disable Metrics/BlockLength
|
85
92
|
task build: ["paperwork:#{self.name}"]
|
86
93
|
|
87
94
|
desc "rebuild documentation from scratch for '#{self.name}'"
|
@@ -98,6 +105,31 @@ module Paperwork
|
|
98
105
|
task :clean do
|
99
106
|
rm_rf self.dir
|
100
107
|
end
|
108
|
+
|
109
|
+
desc "start middleman server for editing documents and get visual feedback with live reload"
|
110
|
+
task server: :build do
|
111
|
+
Dir.chdir(self.dir) do
|
112
|
+
Bundler.with_unbundled_env do
|
113
|
+
Process.spawn(
|
114
|
+
"bundle exec middleman server",
|
115
|
+
out: :out,
|
116
|
+
in: :in,
|
117
|
+
err: :err
|
118
|
+
)
|
119
|
+
end
|
120
|
+
puts
|
121
|
+
puts "+---------------------------------------------------------------+"
|
122
|
+
puts "| |"
|
123
|
+
puts "| IMPORTANT: Edit documents in #{self.dir} for live reload! |"
|
124
|
+
puts "| ---------- The documents there are hard links to your |"
|
125
|
+
puts "| source files, so the changes will be there |"
|
126
|
+
puts "| as well. |"
|
127
|
+
puts "| |"
|
128
|
+
puts "+---------------------------------------------------------------+"
|
129
|
+
puts
|
130
|
+
Process.waitall
|
131
|
+
end
|
132
|
+
end
|
101
133
|
end
|
102
134
|
end
|
103
135
|
end
|
@@ -6,10 +6,12 @@
|
|
6
6
|
#
|
7
7
|
module DocRenderer
|
8
8
|
require "middleman-core/renderers/redcarpet"
|
9
|
+
require_relative "info_helpers"
|
9
10
|
|
10
11
|
# This is a basic renderer for transforming markdown to HTML
|
11
12
|
# inherit from this renderer to create more specific variants
|
12
13
|
class Base < Middleman::Renderers::MiddlemanRedcarpetHTML
|
14
|
+
include InfoHelpers
|
13
15
|
|
14
16
|
# block level calls
|
15
17
|
def block_code(code, language)
|
@@ -79,11 +81,11 @@ module DocRenderer
|
|
79
81
|
# def emphasis(text)
|
80
82
|
# end
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
def image(link, title, alt_text)
|
85
|
+
<<~IMG
|
86
|
+
<img src="#{relative_link link, scope.current_path}" alt="#{alt_text}" class="img-fluid">#{title}</img>
|
87
|
+
IMG
|
88
|
+
end
|
87
89
|
|
88
90
|
# def linebreak()
|
89
91
|
# end
|
@@ -20,6 +20,21 @@ module InfoHelpers
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def relative_link(stringifyable, current_path = current_page.path)
|
24
|
+
relative = String.new
|
25
|
+
dots = current_path.split(/[\/\\]/).size - 1
|
26
|
+
dots.times{ relative += "../" }
|
27
|
+
# This has been some nasty part to debug...
|
28
|
+
# keep these comments for debugging session yet to come
|
29
|
+
# puts "##################################"
|
30
|
+
# puts "current_page.path: #{current_page.path}"
|
31
|
+
# puts "stringifyable: #{stringifyable.to_s}"
|
32
|
+
# puts "dots: #{dots}"
|
33
|
+
# puts "relative link: #{relative + stringifyable.to_s}"
|
34
|
+
# puts "##################################"
|
35
|
+
relative + stringifyable.to_s
|
36
|
+
end
|
37
|
+
|
23
38
|
def site?
|
24
39
|
data.respond_to?(:site)
|
25
40
|
end
|
@@ -30,7 +45,12 @@ module InfoHelpers
|
|
30
45
|
|
31
46
|
def navbar_links
|
32
47
|
nav = data.site.navbar.links if navbar?
|
33
|
-
nav
|
48
|
+
nav ||= {}
|
49
|
+
mapped = {}
|
50
|
+
nav.each do |name, link|
|
51
|
+
mapped[name] = relative_link(link)
|
52
|
+
end
|
53
|
+
mapped
|
34
54
|
end
|
35
55
|
|
36
56
|
def navbar_brand
|
data/lib/paperwork/version.rb
CHANGED
data/site.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -161,7 +161,7 @@ files:
|
|
161
161
|
- lib/paperwork/tasks/root_helpers.rb
|
162
162
|
- lib/paperwork/tasks/template.rb
|
163
163
|
- lib/paperwork/version.rb
|
164
|
-
- navdemo.md
|
164
|
+
- nested_example/navdemo.md
|
165
165
|
- paperwork.gemspec
|
166
166
|
- site.yml
|
167
167
|
homepage: https://gitlab.com/couchbelag/paperwork
|