paperwork 0.4.1 → 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/Gemfile.lock +1 -1
- data/lib/paperwork/tasks/middleman_template/lib/info_helpers.rb +6 -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/_toc.erb +9 -0
- data/lib/paperwork/tasks/middleman_template/source/stylesheets/site.css.scss +46 -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 +6 -2
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/Gemfile.lock
CHANGED
@@ -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,8 +1,16 @@
|
|
1
1
|
@import "../../node_modules/bootstrap/dist/css/bootstrap";
|
2
2
|
@import "./bootstrap-icons.css";
|
3
3
|
|
4
|
-
.
|
5
|
-
font-size:
|
4
|
+
.page-title {
|
5
|
+
font-size: 3rem;
|
6
|
+
}
|
7
|
+
|
8
|
+
.page-sub-title {
|
9
|
+
font-size: 2rem;
|
10
|
+
}
|
11
|
+
|
12
|
+
.page-category {
|
13
|
+
font-size: 1.5rem;
|
6
14
|
}
|
7
15
|
|
8
16
|
$header-siblings-margin: 1rem;
|
@@ -29,4 +37,39 @@ pre.highlight {
|
|
29
37
|
padding: 0.3rem;
|
30
38
|
margin-top: 1rem;
|
31
39
|
margin-bottom: 1rem;
|
32
|
-
}
|
40
|
+
}
|
41
|
+
|
42
|
+
.toc {
|
43
|
+
padding-top: 1rem;
|
44
|
+
white-space: nowrap;
|
45
|
+
|
46
|
+
&.sidebar {
|
47
|
+
position: sticky;
|
48
|
+
top: 4rem;
|
49
|
+
margin-right: 5rem;
|
50
|
+
width: 12rem;
|
51
|
+
overflow: hidden;
|
52
|
+
text-overflow: ellipsis;
|
53
|
+
}
|
54
|
+
|
55
|
+
.title {
|
56
|
+
font-weight: bold;
|
57
|
+
}
|
58
|
+
|
59
|
+
@for $i from 1 through 6 {
|
60
|
+
.toc-h#{$i} {
|
61
|
+
font-size: 0.8rem;
|
62
|
+
padding-left: #{($i - 1) * 0.5}rem;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
.d-flex {
|
69
|
+
@for $i from 1 through 5 {
|
70
|
+
.v-spacer-#{$i} {
|
71
|
+
margin-left: #{$i * 2}rem;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
data/lib/paperwork/version.rb
CHANGED
data/paperwork.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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -178,10 +178,14 @@ files:
|
|
178
178
|
- lib/paperwork/tasks/middleman_template/source/fonts/bootstrap-icons.woff2
|
179
179
|
- lib/paperwork/tasks/middleman_template/source/images/.keep
|
180
180
|
- lib/paperwork/tasks/middleman_template/source/javascripts/site.js
|
181
|
+
- lib/paperwork/tasks/middleman_template/source/javascripts/toc.js
|
182
|
+
- lib/paperwork/tasks/middleman_template/source/layouts/_content.erb
|
183
|
+
- lib/paperwork/tasks/middleman_template/source/layouts/_content_with_toc.erb
|
181
184
|
- lib/paperwork/tasks/middleman_template/source/layouts/_document.erb
|
182
185
|
- lib/paperwork/tasks/middleman_template/source/layouts/_header.erb
|
183
186
|
- lib/paperwork/tasks/middleman_template/source/layouts/_info.erb
|
184
187
|
- lib/paperwork/tasks/middleman_template/source/layouts/_navbar.erb
|
188
|
+
- lib/paperwork/tasks/middleman_template/source/layouts/_toc.erb
|
185
189
|
- lib/paperwork/tasks/middleman_template/source/layouts/layout.erb
|
186
190
|
- lib/paperwork/tasks/middleman_template/source/stylesheets/bootstrap-icons.css
|
187
191
|
- lib/paperwork/tasks/middleman_template/source/stylesheets/rogue.css.erb
|