paperwork 0.3.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +51 -27
- data/Gemfile.lock +28 -28
- data/README.md +3 -1
- data/Rakefile +5 -0
- data/lib/paperwork/tasks/middleman_template/lib/doc_renderer.rb +1 -1
- data/lib/paperwork/tasks/middleman_template/lib/info_helpers.rb +6 -0
- data/lib/paperwork/tasks/middleman_template/source/fonts/bootstrap-icons.woff +0 -0
- data/lib/paperwork/tasks/middleman_template/source/fonts/bootstrap-icons.woff2 +0 -0
- data/lib/paperwork/tasks/middleman_template/source/javascripts/site.js +9 -0
- data/lib/paperwork/tasks/middleman_template/source/javascripts/toc.js +64 -0
- data/lib/paperwork/tasks/middleman_template/source/layouts/_content.erb +6 -0
- data/lib/paperwork/tasks/middleman_template/source/layouts/_content_with_toc.erb +25 -0
- data/lib/paperwork/tasks/middleman_template/source/layouts/_document.erb +10 -3
- data/lib/paperwork/tasks/middleman_template/source/layouts/_header.erb +3 -3
- data/lib/paperwork/tasks/middleman_template/source/layouts/_navbar.erb +12 -10
- data/lib/paperwork/tasks/middleman_template/source/layouts/_toc.erb +9 -0
- data/lib/paperwork/tasks/middleman_template/source/stylesheets/bootstrap-icons.css +1875 -0
- data/lib/paperwork/tasks/middleman_template/source/stylesheets/site.css.scss +47 -3
- data/lib/paperwork/tasks/middleman_template/webpack.config.js +1 -0
- data/lib/paperwork/version.rb +1 -1
- data/paperwork.yml +1 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ce95a4eba79bce8b9489a4f421da5fd2d90eb5814222c4d99dceb39966b25b5
|
4
|
+
data.tar.gz: 1c0448b67db7619d2d798b370f9a8020e97885a30ad88588dc809341a9c306df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e9dd39efe87a4174ffa674c13a5554a4b9788fecb9c27e276cad5bcfdef26c13b81eee9d6678895c20cf2637ed38fe53d6d58c595730f07e320fb2c94efab3
|
7
|
+
data.tar.gz: 6917edf9fa357eda4aa207763057938bf872e64644ce5781c6a98fe667f6655a88cbb4520e8726d66c0cd820b0d5840a972ea6339ef5e9a83311203bd7d5f2f1
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,20 +1,26 @@
|
|
1
|
-
image:
|
2
|
-
|
3
|
-
# include:
|
4
|
-
# - template: License-Scanning.gitlab-ci.yml
|
1
|
+
image: ruby:2.6.8
|
5
2
|
|
6
3
|
stages:
|
7
4
|
- build
|
8
5
|
- test
|
6
|
+
- release
|
9
7
|
- deploy
|
10
8
|
|
11
9
|
before_script:
|
12
|
-
- ruby -v
|
13
|
-
- which ruby
|
14
10
|
- apt update
|
15
11
|
- apt install nodejs npm yarn -y
|
16
|
-
-
|
17
|
-
|
12
|
+
# default rubygems CLI in ruby2.6-container-images is 3.0.3, which won't
|
13
|
+
# support API KEY being provided by environment variable GEM_HOST_API_KEY.
|
14
|
+
# --> update it to >3.0.5
|
15
|
+
- gem update --system
|
16
|
+
- gem install bundler -v 2.2.27 --no-document
|
17
|
+
- bundle config set --local path .bundle
|
18
|
+
- bundle install --jobs $(nproc)
|
19
|
+
|
20
|
+
cache:
|
21
|
+
key: ${CI_COMMIT_REF_NAME}
|
22
|
+
paths:
|
23
|
+
- .bundle
|
18
24
|
|
19
25
|
build:
|
20
26
|
stage: build
|
@@ -27,8 +33,6 @@ build:
|
|
27
33
|
|
28
34
|
rspec:
|
29
35
|
stage: test
|
30
|
-
dependencies:
|
31
|
-
- build
|
32
36
|
script:
|
33
37
|
- bundle exec "rspec --format RspecJunitFormatter --out rspec.xml"
|
34
38
|
artifacts:
|
@@ -38,28 +42,48 @@ rspec:
|
|
38
42
|
reports:
|
39
43
|
junit: rspec.xml
|
40
44
|
|
41
|
-
|
42
|
-
|
45
|
+
# requires environment variable GEM_HOST_API_KEY to be set. content
|
46
|
+
# has to be a valid rubygems API key for authentication when publishing the
|
47
|
+
# gem to rubygems.org.
|
48
|
+
#
|
49
|
+
# also requires GIT_REPOSITORY_AUTH in which "access_token_name:access_token"
|
50
|
+
# for this git repository is configured.
|
51
|
+
release:
|
52
|
+
stage: release
|
53
|
+
rules:
|
54
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
55
|
+
when: manual
|
56
|
+
variables:
|
57
|
+
GIT_REMOTE_URL: ${CI_SERVER_PROTOCOL}://${GIT_REPOSITORY_AUTH}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/${CI_PROJECT_PATH}.git
|
43
58
|
script:
|
44
|
-
- bundle exec
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
59
|
+
- VERSION=$(bundle exec rake version)
|
60
|
+
- bundle exec rake build
|
61
|
+
# remember who is responsible for this release
|
62
|
+
- git config --global user.name "${GITLAB_USER_LOGIN}"
|
63
|
+
- git config --global user.email "${GITLAB_USER_EMAIL}"
|
64
|
+
- git remote add release ${GIT_REMOTE_URL}
|
65
|
+
- git tag ${VERSION}
|
66
|
+
- git push release --tags
|
67
|
+
- gem push pkg/paperwork-${VERSION}.gem
|
68
|
+
|
69
|
+
# rubocop:
|
70
|
+
# stage: test
|
71
|
+
# script:
|
72
|
+
# - bundle exec "rubocop --format junit --out rubocop.xml"
|
73
|
+
# artifacts:
|
74
|
+
# paths:
|
75
|
+
# - rubocop.xml
|
76
|
+
# reports:
|
77
|
+
# junit: rubocop.xml
|
50
78
|
|
51
79
|
pages:
|
52
80
|
stage: deploy
|
53
|
-
|
54
|
-
-
|
55
|
-
|
56
|
-
|
81
|
+
rules:
|
82
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
83
|
+
artifacts:
|
84
|
+
paths:
|
85
|
+
- public
|
57
86
|
script:
|
58
87
|
- mkdir public
|
59
88
|
- mv .work/doc/build/* public/
|
60
89
|
- mv .work/coverage public/
|
61
|
-
artifacts:
|
62
|
-
paths:
|
63
|
-
- public
|
64
|
-
only:
|
65
|
-
- master
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paperwork (0.
|
4
|
+
paperwork (0.5.0)
|
5
5
|
listen (~> 3.4.1)
|
6
6
|
rake (~> 12.3)
|
7
7
|
redcarpet (~> 3.5.0)
|
@@ -10,38 +10,38 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
ast (2.4.
|
13
|
+
ast (2.4.2)
|
14
14
|
byebug (11.1.3)
|
15
|
-
diff-lcs (1.
|
16
|
-
docile (1.
|
17
|
-
ffi (1.
|
15
|
+
diff-lcs (1.5.0)
|
16
|
+
docile (1.4.0)
|
17
|
+
ffi (1.15.5)
|
18
18
|
listen (3.4.1)
|
19
19
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
20
20
|
rb-inotify (~> 0.9, >= 0.9.10)
|
21
|
-
parallel (1.
|
22
|
-
parser (
|
21
|
+
parallel (1.22.1)
|
22
|
+
parser (3.1.2.0)
|
23
23
|
ast (~> 2.4.1)
|
24
|
-
rainbow (3.
|
24
|
+
rainbow (3.1.1)
|
25
25
|
rake (12.3.3)
|
26
|
-
rb-fsevent (0.
|
26
|
+
rb-fsevent (0.11.1)
|
27
27
|
rb-inotify (0.10.1)
|
28
28
|
ffi (~> 1.0)
|
29
29
|
redcarpet (3.5.1)
|
30
|
-
regexp_parser (
|
31
|
-
rexml (3.2.
|
32
|
-
rspec (3.
|
33
|
-
rspec-core (~> 3.
|
34
|
-
rspec-expectations (~> 3.
|
35
|
-
rspec-mocks (~> 3.
|
36
|
-
rspec-core (3.
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-expectations (3.
|
30
|
+
regexp_parser (2.5.0)
|
31
|
+
rexml (3.2.5)
|
32
|
+
rspec (3.11.0)
|
33
|
+
rspec-core (~> 3.11.0)
|
34
|
+
rspec-expectations (~> 3.11.0)
|
35
|
+
rspec-mocks (~> 3.11.0)
|
36
|
+
rspec-core (3.11.0)
|
37
|
+
rspec-support (~> 3.11.0)
|
38
|
+
rspec-expectations (3.11.0)
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
40
|
+
rspec-support (~> 3.11.0)
|
41
|
+
rspec-mocks (3.11.1)
|
42
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
43
|
+
rspec-support (~> 3.11.0)
|
44
|
+
rspec-support (3.11.0)
|
45
45
|
rspec_junit_formatter (0.4.1)
|
46
46
|
rspec-core (>= 2, < 4, != 2.12.0)
|
47
47
|
rubocop (0.87.1)
|
@@ -53,15 +53,15 @@ GEM
|
|
53
53
|
rubocop-ast (>= 0.1.0, < 1.0)
|
54
54
|
ruby-progressbar (~> 1.7)
|
55
55
|
unicode-display_width (>= 1.4.0, < 2.0)
|
56
|
-
rubocop-ast (0.
|
57
|
-
parser (>= 2.7.
|
58
|
-
ruby-progressbar (1.
|
56
|
+
rubocop-ast (0.8.0)
|
57
|
+
parser (>= 2.7.1.5)
|
58
|
+
ruby-progressbar (1.11.0)
|
59
59
|
simplecov (0.18.5)
|
60
60
|
docile (~> 1.1)
|
61
61
|
simplecov-html (~> 0.11)
|
62
|
-
simplecov-html (0.12.
|
62
|
+
simplecov-html (0.12.3)
|
63
63
|
thor (1.1.0)
|
64
|
-
unicode-display_width (1.
|
64
|
+
unicode-display_width (1.8.0)
|
65
65
|
|
66
66
|
PLATFORMS
|
67
67
|
ruby
|
@@ -75,4 +75,4 @@ DEPENDENCIES
|
|
75
75
|
simplecov (~> 0.18.5)
|
76
76
|
|
77
77
|
BUNDLED WITH
|
78
|
-
2.
|
78
|
+
2.2.27
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
title: paperwork
|
3
3
|
---
|
4
4
|
|
5
|
-
# paperwork
|
5
|
+
# paperwork
|
6
|
+
|
7
|
+
[![w-10](https://gitlab.com/couchbelag/paperwork/badges/master/pipeline.svg)](https://gitlab.com/couchbelag/paperwork/-/commits/master)[![w-10](https://gitlab.com/couchbelag/paperwork/badges/master/coverage.svg)](https://couchbelag.gitlab.io/paperwork/coverage)
|
6
8
|
|
7
9
|
|
8
10
|
### The *paperwork gem* is an aproach to create appealing documentation from markdown documents.
|
data/Rakefile
CHANGED
@@ -14,3 +14,8 @@ task default: :spec
|
|
14
14
|
CLEAN.include(".work/coverage")
|
15
15
|
|
16
16
|
paperwork :doc, sources: ["README.md", "nested_example/navdemo.md", "paperwork.yml", "custom.js", "custom.css"]
|
17
|
+
|
18
|
+
desc "returns version information"
|
19
|
+
task :version do
|
20
|
+
puts Paperwork::VERSION
|
21
|
+
end
|
@@ -4,5 +4,14 @@ import $ from "jquery";
|
|
4
4
|
import 'popper.js';
|
5
5
|
import 'bootstrap';
|
6
6
|
import mermaid from "mermaid";
|
7
|
+
import {getTableOfContents} from './toc';
|
7
8
|
|
8
9
|
mermaid.initialize({startOnLoad:true});
|
10
|
+
|
11
|
+
$(()=>{
|
12
|
+
var sidebar = $(".toc.sidebar > ul")
|
13
|
+
var topbar = $(".toc.topbar > ul")
|
14
|
+
var toc = getTableOfContents();
|
15
|
+
toc.insertTo(sidebar);
|
16
|
+
toc.insertTo(topbar);
|
17
|
+
});
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import $ from "jquery";
|
2
|
+
|
3
|
+
var idCounter = 0;
|
4
|
+
|
5
|
+
class Section {
|
6
|
+
constructor(element=null) {
|
7
|
+
this.children = [];
|
8
|
+
this.element = element;
|
9
|
+
|
10
|
+
if (this.element) {
|
11
|
+
this.anchor = "paperwork-h-" + ++idCounter;
|
12
|
+
} else {
|
13
|
+
this.element = $("body");
|
14
|
+
}
|
15
|
+
|
16
|
+
this.element.find(":header").each((index, elem)=>{
|
17
|
+
this.add(new Section($(elem)));
|
18
|
+
});
|
19
|
+
}
|
20
|
+
|
21
|
+
add(childSection) {
|
22
|
+
this.children.push(childSection);
|
23
|
+
}
|
24
|
+
|
25
|
+
id() {
|
26
|
+
return this.anchor;
|
27
|
+
}
|
28
|
+
|
29
|
+
level() {
|
30
|
+
return this.element.prop("tagName").toLowerCase();
|
31
|
+
}
|
32
|
+
|
33
|
+
mark() {
|
34
|
+
if (this.level() != "body") {
|
35
|
+
// create anchor
|
36
|
+
this.element.before("<div id='" + this.id() + "'></div>");
|
37
|
+
}
|
38
|
+
this.children.forEach((child)=>{
|
39
|
+
child.mark();
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
insertTo(target) {
|
44
|
+
if (this.level() != "body") {
|
45
|
+
// link to anchor
|
46
|
+
target.append("<li class='toc-" + this.level() + "'><a href='#" + this.id() + "'>" + this.text() + "</a></li>");
|
47
|
+
}
|
48
|
+
this.children.forEach((child)=>{
|
49
|
+
child.insertTo(target);
|
50
|
+
});
|
51
|
+
}
|
52
|
+
|
53
|
+
text() {
|
54
|
+
return this.element.text();
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
function getTableOfContents() {
|
59
|
+
var toc = new Section();
|
60
|
+
toc.mark();
|
61
|
+
return toc;
|
62
|
+
}
|
63
|
+
|
64
|
+
export { getTableOfContents };
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="d-flex">
|
2
|
+
<div class="d-xl-block d-lg-block d-md-block d-none">
|
3
|
+
<%= partial "layouts/toc", locals: {classes: [:sidebar]} %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div>
|
7
|
+
<%= partial "layouts/header" %>
|
8
|
+
|
9
|
+
<div class="row d-xl-none d-lg-none d-md-none ">
|
10
|
+
<div class="col">
|
11
|
+
<%= partial "layouts/toc", locals: {classes: [:topbar]} %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="row">
|
16
|
+
<div class="col">
|
17
|
+
<%= body %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="v-spacer-2 d-xl-block d-lg-block d-md-block d-sm-none d-xs-none"></div>
|
23
|
+
<div class="v-spacer-2 d-xl-block d-lg-block d-md-none d-sm-none d-xs-none"></div>
|
24
|
+
<div class="v-spacer-3 d-xl-block d-lg-none d-md-none d-sm-none d-xs-none"></div>
|
25
|
+
</div>
|
@@ -29,14 +29,21 @@
|
|
29
29
|
<body>
|
30
30
|
<%= partial "layouts/navbar" %>
|
31
31
|
|
32
|
+
<% if toc? %>
|
33
|
+
<div class="container-fluid">
|
34
|
+
<div class="row">
|
35
|
+
<div class="col">
|
36
|
+
<%= partial "layouts/content_with_toc", locals: {body: body} %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
<% else %>
|
32
40
|
<div class="container">
|
33
|
-
<%= partial "layouts/header" %>
|
34
|
-
|
35
41
|
<div class="row">
|
36
42
|
<div class="col">
|
37
|
-
<%= body %>
|
43
|
+
<%= partial "layouts/content", locals: {body: body} %>
|
38
44
|
</div>
|
39
45
|
</div>
|
46
|
+
<% end %>
|
40
47
|
|
41
48
|
<div class="row mt-5 pb-4">
|
42
49
|
<div class="col text-right small border-top">
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<div class="row">
|
2
2
|
<div class="col-sm-7 mb-5">
|
3
|
-
<span class="
|
3
|
+
<span class="page-title"><%= yield_content :title %></span>
|
4
4
|
<br>
|
5
|
-
<span class="
|
5
|
+
<span class="page-sub-title"><%= yield_content :subtitle %></span>
|
6
6
|
</div>
|
7
7
|
|
8
8
|
<div class="col-sm-5">
|
9
9
|
|
10
10
|
<div class="row">
|
11
|
-
<div class="col text-right
|
11
|
+
<div class="col text-right page-category mb-2">
|
12
12
|
<%= yield_content :category %>
|
13
13
|
</div>
|
14
14
|
</div>
|
@@ -1,13 +1,15 @@
|
|
1
1
|
<nav class="sticky-top navbar navbar-expand-lg navbar-dark bg-dark">
|
2
2
|
<a class="navbar-brand" href="<%= root_path %>"><%= navbar_brand || yield_content(:title) %></a>
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
<% if navbar_links.size > 0 %>
|
4
|
+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
5
|
+
<span class="navbar-toggler-icon"></span>
|
6
|
+
</button>
|
7
|
+
<div id="navbarSupportedContent" class="collapse navbar-collapse">
|
8
|
+
<ul class="mr-auto navbar-nav">
|
9
|
+
<% navbar_links.each do |name, link| %>
|
10
|
+
<li class=" nav-item"><a class="nav-link" data-method="get" href="<%= link.gsub(/\.md$/, ".html") %>"><%= name %></a></li>
|
11
|
+
<% end %>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
13
15
|
</nav>
|