swedbank-pay-design-guide-jekyll-theme 1.9.1 → 1.9.6
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 +4 -4
- data/_includes/accordion-table.html +11 -0
- data/_includes/apple-touch-startup-image.html +1 -1
- data/_includes/github.html +11 -0
- data/_includes/iterator.html +2 -2
- data/_includes/release_notes.html +11 -10
- data/_includes/title-header.html +2 -0
- data/_layouts/default.html +30 -22
- data/_layouts/front-page.html +9 -4
- data/_layouts/search.html +5 -0
- data/_plugins/swedbank-pay-design-guide-jekyll-theme.rb +3 -0
- data/_sass/accordion-table.scss +96 -0
- data/_sass/front-page.scss +21 -15
- data/_sass/sidebar.scss +33 -3
- data/_sass/swedbank-pay-design-guide-theme.scss +17 -1
- data/_sass/title-header.scss +3 -0
- data/assets/css/pygments-autumn.css +1 -1
- data/lib/gem_version.rb +1 -1
- data/lib/regex_capture_filter.rb +18 -0
- data/lib/sidebar.rb +8 -7
- data/lib/sidebar_html_builder.rb +27 -9
- data/lib/sidebar_page.rb +27 -10
- data/lib/sidebar_page_collection.rb +1 -2
- data/lib/sidebar_page_title.rb +29 -6
- data/lib/sidebar_parser.rb +41 -28
- data/lib/sidebar_renderer.rb +15 -18
- data/lib/sidebar_text_builder.rb +4 -3
- data/lib/sidebar_tree_builder.rb +17 -4
- data/lib/swedbank-pay-design-guide-jekyll-theme.rb +1 -0
- metadata +8 -3
- data/_plugins/sidebar.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f984dd5a90f6718b4089f2e18b45f61a934b8339e6299dc367f450a6f0a9605b
|
4
|
+
data.tar.gz: de505338b7b2736df5774cfb06392db0c2781263234b20ab412c9bac4b461c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22aece453b0c96cd8266a60141d4d8a380c571d1eb1fe11a972b58651c3c022218d89ad7964cc27941dfcf58c9222e15199dac4aba6006302c53b92333c49ca7
|
7
|
+
data.tar.gz: dfd54c1b22d51db540a77dfea8af743d8d35ce9b669d7164a29fe4b79bc466517574c94a3e26edbd244680ee117265eca1b02b83656868c419a06734fb6aa3e3
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{% assign content = include.content | markdownify%}
|
2
|
+
|
3
|
+
<div class="accordion accordion-table mb-4">
|
4
|
+
<button type="button" class="accordion-header pt-0" aria-expanded="false" aria-controls="exp-1">
|
5
|
+
<span class="mr-3 show">Show properties</span>
|
6
|
+
<span class="mr-3 hide">Hide properties</span>
|
7
|
+
</button>
|
8
|
+
<div class="accordion-body p-0" id="exp-1">
|
9
|
+
{{ content }}
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
{%- capture device_height_string -%}
|
11
11
|
(device-height: {{ device_height }})
|
12
12
|
{%- endcapture -%}
|
13
|
-
{%- if device_orientation != nil
|
13
|
+
{%- if device_orientation != nil and device_orientation != empty -%}
|
14
14
|
{%- capture device_orientation_string -%}
|
15
15
|
(orientation: {{ device_orientation }}) and
|
16
16
|
{%- endcapture -%}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{% assign github_branch = site.github.branch | default : "develop" %}
|
2
|
+
|
3
|
+
<a href="{{ site.github.repository_url }}/tree/{{ github_branch }}/{{ page.path }}"
|
4
|
+
class="github" target="_blank"
|
5
|
+
rel="noopener noreferrer" title="Edit '{{ page.title }}' on GitHub">
|
6
|
+
<svg aria-labelledby="simpleicons-github-icon" role="img" width="50" viewBox="0 0 24 24"
|
7
|
+
xmlns="http://www.w3.org/2000/svg">
|
8
|
+
<title id="simpleicons-github-icon">Edit "{{ page.title }}" on GitHub</title>
|
9
|
+
<path fill="#fff" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
|
10
|
+
</svg>
|
11
|
+
</a>
|
data/_includes/iterator.html
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
<nav class="iterator d-flex">
|
7
7
|
{% if prev_href != blank and prev_href != empty and prev_href != nil %}
|
8
|
-
<a class="mr-auto btn btn-
|
8
|
+
<a class="mr-auto btn btn-primary" role="button" rel="prev" href="{{ prev_href }}">
|
9
9
|
{{ prev_title }}
|
10
10
|
</a>
|
11
11
|
{% endif %}
|
12
12
|
|
13
13
|
{% if next_href != blank and next_href != empty and next_href != nil %}
|
14
|
-
<a class="ml-auto btn btn-
|
14
|
+
<a class="ml-auto btn btn-primary" role="button" rel="next" href="{{ next_href }}">
|
15
15
|
{{ next_title }}
|
16
16
|
</a>
|
17
17
|
{% endif %}
|
@@ -1,24 +1,25 @@
|
|
1
1
|
{% assign num_dates = include.num_dates %}
|
2
|
-
{%
|
3
|
-
{%
|
4
|
-
{% if
|
2
|
+
{% for page in site.pages %}
|
3
|
+
{% assign release_notes_url = '/resources/release-notes' %}
|
4
|
+
{% if page.url contains release_notes_url %}
|
5
5
|
<div class="release-notes-container">
|
6
|
-
{% assign dates =
|
7
|
-
{% assign variable = value %}
|
6
|
+
{% assign dates = page.content | markdownify | split: '<h2' | slice: 1, num_dates %}
|
8
7
|
|
9
8
|
{% for date in dates %}
|
10
9
|
<div class="row">
|
11
10
|
{% assign versions = date | split: '<h3' %}
|
11
|
+
{% assign date_id = date | regex_capture: 'id="([^"]+)"' | first %}
|
12
12
|
<div class="col-md-2 release-notes-date">
|
13
|
-
{% assign date_value = versions[0] | remove: '</h2>' |
|
14
|
-
{{ date_value[1] }}
|
13
|
+
{% assign date_value = versions[0] | remove: '</h2>' | split: '>' %}
|
14
|
+
<a href="{{ release_notes_url }}#{{ date_id }}">{{ date_value[1] | strip }}</a>
|
15
15
|
</div>
|
16
16
|
{% assign version_list = versions | shift %}
|
17
17
|
<div class="col-md-10">
|
18
18
|
{% for version in version_list %}
|
19
|
-
{% assign version_parts = version |
|
19
|
+
{% assign version_parts = version | split: '</h3>' %}
|
20
20
|
{% assign version_value = version_parts[0] | split: '>' %}
|
21
|
-
|
21
|
+
{% assign version_id = version | regex_capture: 'id="([^"]+)"' | first %}
|
22
|
+
<p class="h4"><a href="{{ release_notes_url }}#{{ version_id }}">{{ version_value[1] }}</a></p>
|
22
23
|
{{ version_parts[1] }}
|
23
24
|
{% endfor %}
|
24
25
|
</div>
|
@@ -26,4 +27,4 @@
|
|
26
27
|
{% endfor %}
|
27
28
|
</div>
|
28
29
|
{% endif %}
|
29
|
-
{% endfor %}
|
30
|
+
{% endfor %}
|
data/_includes/title-header.html
CHANGED
data/_layouts/default.html
CHANGED
@@ -1,31 +1,30 @@
|
|
1
|
-
{%- assign
|
1
|
+
{%- assign lead_title = page.lead_title -%}
|
2
|
+
{%- if lead_title == nil and page.sidebar.navigation == nil -%}
|
3
|
+
{%- unless page.name contains "index" -%}
|
4
|
+
{%- assign dirname = page.dir | split: "/" | last | remove: "/" | capitalize -%}
|
5
|
+
{%- unless dirname == "" -%}
|
6
|
+
{%- assign lead_title = dirname -%}
|
7
|
+
{%- endunless -%}
|
8
|
+
{%- endunless -%}
|
9
|
+
{%- endif -%}
|
10
|
+
{%- assign main_title = page.main_title | default: page.title | default: "PayEx Design Guide theme for Jekyll" -%}
|
11
|
+
{%- capture title -%}{%- if lead_title != nil -%}{{ lead_title }} – {% endif %}{{ main_title }}{%- endcapture -%}
|
2
12
|
{%- assign description = page.opengraph.description | default: site.opengraph.description -%}
|
3
13
|
{%- assign image = page.opengraph.image | default: site.opengraph.image -%}
|
4
|
-
{%- assign github_branch = site.github.branch | default : "develop" -%}
|
5
14
|
{%- assign design_guide_base_url = site.design_guide.base_url | default: 'https://design.swedbankpay.com' -%}
|
6
|
-
{%- assign design_guide_version = site.design_guide.version | default: '4.
|
15
|
+
{%- assign design_guide_version = site.design_guide.version | default: '4.8.1' -%}
|
7
16
|
{%- assign design_guide_url = design_guide_base_url | append: '/v/' | append: design_guide_version -%}
|
8
|
-
{%- if page.sidebar.navigation == nil -%}
|
9
|
-
{%- unless page.name contains "index" -%}
|
10
|
-
{%- assign dirname = page.dir | split: "/" | last | remove: "/" | capitalize -%}
|
11
|
-
{%- unless dirname == "" -%}
|
12
|
-
{%- assign title = dirname | append: " – " | append: title -%}
|
13
|
-
{%- endunless -%}
|
14
|
-
{%- endunless -%}
|
15
|
-
{%- endif -%}
|
16
17
|
<!DOCTYPE html>
|
17
18
|
<html lang="{{ site.lang | default: "en-US" }}">
|
18
|
-
|
19
19
|
<head>
|
20
20
|
<meta charset="utf-8" />
|
21
21
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
22
22
|
<meta name="mobile-web-app-capable" content="yes">
|
23
23
|
<meta name="theme-color" content="#000">
|
24
|
-
<meta name="application-name" content="{{
|
24
|
+
<meta name="application-name" content="{{ title }}">
|
25
25
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
26
26
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
27
|
-
<meta name="apple-mobile-web-app-title"
|
28
|
-
content="{{ page.title | default: 'PayEx Design Guide theme for Jekyll' }}">
|
27
|
+
<meta name="apple-mobile-web-app-title" content="{{ title }}">
|
29
28
|
<meta name="msapplication-TileColor" content="#000">
|
30
29
|
<meta name="msapplication-TileImage" content="{{ design_guide_version_url }}/icons/mstile-144x144.png">
|
31
30
|
<meta property="og:type" value="website" />
|
@@ -66,12 +65,26 @@
|
|
66
65
|
<nav class="sidebar-nav">
|
67
66
|
<a href="/" class="sidebar-header">
|
68
67
|
<img src="{{ design_guide_url }}/img/swedbankpay-logo-v.svg"
|
69
|
-
alt="Swedbank Pay vertical logo" />
|
68
|
+
alt="Swedbank Pay vertical logo" class="logotype-vertical logotype-lg"/>
|
70
69
|
<div class="sidebar-header-text">
|
71
70
|
<span>{</span>developer portal<span>}</span>
|
72
71
|
</div>
|
73
72
|
</a>
|
74
|
-
|
73
|
+
{% if site.search.enabled == true %}
|
74
|
+
<form class="search-container mx-2 my-4 px-3 py-2 d-flex"
|
75
|
+
method="get" action="{{ site.search.url | relative_url }}">
|
76
|
+
<input name="q" type="text" id="tipue_search_input"
|
77
|
+
class="search-input w-100 "
|
78
|
+
placeholder="Search in documentation"
|
79
|
+
onfocus="this.placeholder=''"
|
80
|
+
onblur="this.placeholder='Search in documentation'"
|
81
|
+
pattern=".{3,}"
|
82
|
+
title="At least 3 characters">
|
83
|
+
<label for="search-input" class="mb-0">
|
84
|
+
<i class="material-icons m-0" aria-hidden="true">search</i>
|
85
|
+
</label>
|
86
|
+
</form>
|
87
|
+
{% endif %}
|
75
88
|
<ul id="dx-sidebar-main-nav-ul" class="main-nav-ul">
|
76
89
|
</ul>
|
77
90
|
</nav>
|
@@ -93,12 +106,7 @@
|
|
93
106
|
</main>
|
94
107
|
</div>
|
95
108
|
</div>
|
96
|
-
|
97
|
-
<footer class="page-footer">
|
98
|
-
<p class="page-footer-rights">© Swedbank Pay</p>
|
99
|
-
</footer>
|
100
109
|
</div>
|
101
|
-
|
102
110
|
<script src="{{ design_guide_url }}/scripts/dg.js"></script>
|
103
111
|
<script src="{{ '/assets/js/swedbank-pay-design-guide-theme.js' | relative_url }}"></script>
|
104
112
|
{%- if site.google_analytics.tracking_id %}
|
data/_layouts/front-page.html
CHANGED
@@ -21,6 +21,8 @@ layout: default
|
|
21
21
|
<h2 id="front-page-start" class="heading-line heading-line-white">{{ front_page_start_heading }}</h2>
|
22
22
|
{% contentblock start %}
|
23
23
|
</div>
|
24
|
+
|
25
|
+
{% include github.html %}
|
24
26
|
</div>
|
25
27
|
<div class="front-page-container">
|
26
28
|
{% if show_merchants_bar == true %}
|
@@ -52,7 +54,7 @@ layout: default
|
|
52
54
|
</div>
|
53
55
|
</div>
|
54
56
|
{% endif %}
|
55
|
-
<
|
57
|
+
<div class="front-page-demoshop">
|
56
58
|
<span class="front-page-demoshop-text">
|
57
59
|
<span class="h2">Try our Demoshop</span>
|
58
60
|
<span class="demoshop-text-description">
|
@@ -61,8 +63,11 @@ layout: default
|
|
61
63
|
</span>
|
62
64
|
</span>
|
63
65
|
<span class="front-page-demoshop-link">
|
64
|
-
<
|
65
|
-
|
66
|
+
<a href="https://ecom.externalintegration.payex.com/pspdemoshop" class="text-decoration-none">
|
67
|
+
<span class="h3 mr-2">Go to the demoshop
|
68
|
+
<i class="material-icons ml-2">arrow_forward</i>
|
69
|
+
</span>
|
70
|
+
</a>
|
66
71
|
<span class="demoshop-link-img">
|
67
72
|
<img class="demoshop-link-img-mobile d-none d-md-flex"
|
68
73
|
src="/assets/img/demoshop-mobile.svg" alt="demoshop-mobile" />
|
@@ -72,7 +77,7 @@ layout: default
|
|
72
77
|
src="/assets/img/demoshop-web.svg" alt="demoshop-web" />
|
73
78
|
</span>
|
74
79
|
</span>
|
75
|
-
</
|
80
|
+
</div>
|
76
81
|
|
77
82
|
<div class="front-page-container">
|
78
83
|
<div class="front-page-cards-sdk">
|
@@ -0,0 +1,96 @@
|
|
1
|
+
@import 'colors.scss';
|
2
|
+
|
3
|
+
.accordion {
|
4
|
+
align-items: center;
|
5
|
+
|
6
|
+
&.accordion-table {
|
7
|
+
border: none;
|
8
|
+
|
9
|
+
.show {
|
10
|
+
display: block;
|
11
|
+
}
|
12
|
+
|
13
|
+
.hide {
|
14
|
+
display: none;
|
15
|
+
}
|
16
|
+
|
17
|
+
&.accordion-open {
|
18
|
+
border: none;
|
19
|
+
|
20
|
+
.show {
|
21
|
+
display: none;
|
22
|
+
}
|
23
|
+
|
24
|
+
.hide {
|
25
|
+
display: block;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
.accordion-header {
|
30
|
+
&:before {
|
31
|
+
bottom: 1rem;
|
32
|
+
margin: auto;
|
33
|
+
transition: .3s;
|
34
|
+
color: $brown;
|
35
|
+
}
|
36
|
+
|
37
|
+
span {
|
38
|
+
font-weight: normal;
|
39
|
+
}
|
40
|
+
&:hover {
|
41
|
+
span {
|
42
|
+
font-weight: bold;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
.accordion-body {
|
48
|
+
@media (min-width: 1250px) {
|
49
|
+
width: 70vw;
|
50
|
+
max-width: 80rem;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
table {
|
55
|
+
border: 1px solid rgba(153, 153, 153, 0.5);
|
56
|
+
border-radius: 0.25rem;
|
57
|
+
|
58
|
+
th {
|
59
|
+
font-size: 0.875rem;
|
60
|
+
}
|
61
|
+
|
62
|
+
tbody {
|
63
|
+
font-size: 0.875rem;
|
64
|
+
|
65
|
+
tr:nth-child(odd) {
|
66
|
+
background-color: #F9F8F6;
|
67
|
+
}
|
68
|
+
|
69
|
+
tr {
|
70
|
+
td:not(:last-child) {
|
71
|
+
font-family: $mono;
|
72
|
+
|
73
|
+
code {
|
74
|
+
border: none;
|
75
|
+
background-color: transparent;
|
76
|
+
padding: 0;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
td:not(:last-child):not(:nth-last-child(2)) {
|
81
|
+
code {
|
82
|
+
font-weight: 700;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
tr {
|
88
|
+
&:hover {
|
89
|
+
background-color: $apricot;
|
90
|
+
transition: .5s;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
data/_sass/front-page.scss
CHANGED
@@ -83,6 +83,10 @@ $front-page-max-width: 1312px;
|
|
83
83
|
color: $white;
|
84
84
|
font-size: 1.125rem;
|
85
85
|
}
|
86
|
+
|
87
|
+
a {
|
88
|
+
color: #43d0dd;
|
89
|
+
}
|
86
90
|
|
87
91
|
.front-page-hero-name {
|
88
92
|
font-family: $mono;
|
@@ -113,11 +117,10 @@ $front-page-max-width: 1312px;
|
|
113
117
|
}
|
114
118
|
|
115
119
|
@media screen and (min-width: $breakpoint-xxl) {
|
116
|
-
margin-bottom:
|
120
|
+
margin-bottom: 10rem;
|
117
121
|
|
118
122
|
.front-page-intro-cards {
|
119
123
|
position: absolute;
|
120
|
-
bottom: -7rem;
|
121
124
|
left: 0;
|
122
125
|
width: 100%;
|
123
126
|
padding: 0 4rem;
|
@@ -235,19 +238,6 @@ $front-page-max-width: 1312px;
|
|
235
238
|
text-decoration: none;
|
236
239
|
border-radius: 1rem;
|
237
240
|
|
238
|
-
&:hover,
|
239
|
-
&:focus {
|
240
|
-
.front-page-demoshop-link {
|
241
|
-
background-color: $white;
|
242
|
-
color: $brown;
|
243
|
-
|
244
|
-
.h3 {
|
245
|
-
color: $brown;
|
246
|
-
}
|
247
|
-
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
241
|
&:after {
|
252
242
|
display: none;
|
253
243
|
content: none;
|
@@ -299,6 +289,21 @@ $front-page-max-width: 1312px;
|
|
299
289
|
box-shadow: 1px 2px 10px rgba(0, 0, 0, 0.15);
|
300
290
|
max-width: $front-page-max-width;
|
301
291
|
width: 100%;
|
292
|
+
cursor: pointer;
|
293
|
+
|
294
|
+
a::after{
|
295
|
+
content: '';
|
296
|
+
}
|
297
|
+
|
298
|
+
&:hover,
|
299
|
+
&:focus {
|
300
|
+
background-color: $white;
|
301
|
+
color: $brown;
|
302
|
+
|
303
|
+
.h3 {
|
304
|
+
color: $brown;
|
305
|
+
}
|
306
|
+
}
|
302
307
|
|
303
308
|
.demoshop-link-img {
|
304
309
|
display: flex;
|
@@ -306,6 +311,7 @@ $front-page-max-width: 1312px;
|
|
306
311
|
position: absolute;
|
307
312
|
bottom: -1rem;
|
308
313
|
right: 3%;
|
314
|
+
pointer-events: none;
|
309
315
|
|
310
316
|
.demoshop-link-img-web {
|
311
317
|
width: 26.5rem;
|
data/_sass/sidebar.scss
CHANGED
@@ -6,14 +6,13 @@
|
|
6
6
|
display: flex;
|
7
7
|
flex-direction: column;
|
8
8
|
align-items: center;
|
9
|
-
margin-bottom: 2.5rem;
|
10
9
|
margin-top: 2rem;
|
11
10
|
text-decoration: none;
|
12
11
|
color: #512b2b;
|
13
12
|
|
14
13
|
img {
|
15
|
-
|
16
|
-
margin-
|
14
|
+
margin-top: 1.5rem;
|
15
|
+
margin-bottom: 1.25rem;
|
17
16
|
}
|
18
17
|
|
19
18
|
span {
|
@@ -30,6 +29,37 @@
|
|
30
29
|
}
|
31
30
|
}
|
32
31
|
|
32
|
+
.search-container {
|
33
|
+
box-shadow: 1px 2px 10px rgba(0, 0, 0, 0.15);
|
34
|
+
border-radius: 0.125rem;
|
35
|
+
|
36
|
+
&:focus-within {
|
37
|
+
outline: -webkit-focus-ring-color auto 0.5px;
|
38
|
+
}
|
39
|
+
|
40
|
+
.search-input {
|
41
|
+
color: $medium-brown;
|
42
|
+
font-size: 0.875rem;
|
43
|
+
border: none;
|
44
|
+
padding: 0.375rem;
|
45
|
+
|
46
|
+
&:focus {
|
47
|
+
color: $brown;
|
48
|
+
outline: none
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
i {
|
53
|
+
display: block;
|
54
|
+
color: $brown;
|
55
|
+
|
56
|
+
&:hover {
|
57
|
+
color: $turquoise-link;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
33
63
|
.main-nav-ul {
|
34
64
|
.nav-group {
|
35
65
|
.nav-ul {
|
@@ -7,6 +7,7 @@
|
|
7
7
|
@import 'code-view.scss';
|
8
8
|
@import 'front-page.scss';
|
9
9
|
@import 'heading.scss';
|
10
|
+
@import 'accordion-table.scss';
|
10
11
|
@import 'paragraph-highlight.scss';
|
11
12
|
@import 'sidebar.scss';
|
12
13
|
@import 'title-header.scss';
|
@@ -23,7 +24,6 @@ body {
|
|
23
24
|
}
|
24
25
|
|
25
26
|
.table {
|
26
|
-
|
27
27
|
th,
|
28
28
|
td {
|
29
29
|
>.material-icons {
|
@@ -292,4 +292,20 @@ a[href ^='https://']:not([href *='{{ site.url }}']):after {
|
|
292
292
|
font-size: 1rem !important;
|
293
293
|
}
|
294
294
|
}
|
295
|
+
|
296
|
+
.github {
|
297
|
+
opacity: .5;
|
298
|
+
position: absolute;
|
299
|
+
right: 4rem;
|
300
|
+
top: 4rem;
|
301
|
+
transition: opacity .3s;
|
302
|
+
}
|
303
|
+
|
304
|
+
a.github:after {
|
305
|
+
display: none;
|
306
|
+
}
|
307
|
+
|
308
|
+
a.github:hover {
|
309
|
+
opacity: 1;
|
310
|
+
}
|
295
311
|
}
|
data/_sass/title-header.scss
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
.highlight .nf { color: #00aa00 } /* Name.Function */
|
37
37
|
.highlight .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */
|
38
38
|
.highlight .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */
|
39
|
-
.highlight .nv { color: #
|
39
|
+
.highlight .nv { color: #e07088 } /* Name.Variable */
|
40
40
|
.highlight .ow { color: #0000aa } /* Operator.Word */
|
41
41
|
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
42
42
|
.highlight .mb { color: #009999 } /* Literal.Number.Bin */
|
data/lib/gem_version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'liquid'
|
4
|
+
|
5
|
+
# Jekyll
|
6
|
+
module Jekyll
|
7
|
+
# Adds a 'regex_capture' filter to Liquid. Performs a regular expression match
|
8
|
+
# on the provided string and returns the capture as an array. Example usage:
|
9
|
+
# {{ html | regex_capture: 'id="([^"]+)"' | first }}
|
10
|
+
module RegexCaptureFilter
|
11
|
+
def regex_capture(str, regex)
|
12
|
+
match = /#{regex}/.match(str)
|
13
|
+
match ? match.captures : []
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Liquid::Template.register_filter(Jekyll::RegexCaptureFilter)
|
data/lib/sidebar.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'jekyll'
|
4
4
|
require 'nokogiri'
|
@@ -15,15 +15,16 @@ module SwedbankPay
|
|
15
15
|
attr_reader :pages
|
16
16
|
|
17
17
|
def pre_render(site)
|
18
|
-
|
19
|
-
|
20
|
-
@pages = SidebarTreeBuilder.new(pages)
|
18
|
+
Jekyll.logger.debug(' Sidebar: pre_render')
|
19
|
+
@parser = SidebarParser.new(site)
|
20
|
+
@pages = SidebarTreeBuilder.new(@parser.pages)
|
21
21
|
Jekyll.logger.debug(" Sidebar: #{@pages.inspect}")
|
22
|
-
@sidebar_renderer = SidebarRenderer.new(@pages)
|
23
|
-
@sidebar_renderer.enrich_jekyll
|
24
22
|
end
|
25
23
|
|
26
24
|
def post_write
|
25
|
+
@sidebar_renderer = SidebarRenderer.new(@pages)
|
26
|
+
@parser.parse(@pages)
|
27
|
+
Jekyll.logger.debug(' Sidebar: post_write')
|
27
28
|
@sidebar_renderer.render
|
28
29
|
end
|
29
30
|
end
|
@@ -34,6 +35,6 @@ Jekyll::Hooks.register :site, :pre_render do |site, _|
|
|
34
35
|
SwedbankPay::Sidebar.pre_render site
|
35
36
|
end
|
36
37
|
|
37
|
-
Jekyll::Hooks.register :site, :post_write do
|
38
|
+
Jekyll::Hooks.register :site, :post_write do
|
38
39
|
SwedbankPay::Sidebar.post_write
|
39
40
|
end
|
data/lib/sidebar_html_builder.rb
CHANGED
@@ -24,10 +24,13 @@ module SwedbankPay
|
|
24
24
|
markup = ''
|
25
25
|
|
26
26
|
pages.each do |page|
|
27
|
+
current_page_name = current_page.respond_to?(:name) ? current_page.name : current_page.to_s
|
28
|
+
|
27
29
|
if page.hidden_for?(current_page)
|
28
|
-
|
29
|
-
Jekyll.logger.debug(" Sidebar: #{page.name} is hidden for #{name}")
|
30
|
+
Jekyll.logger.debug(" Sidebar: #{page.name} is hidden for #{current_page_name}")
|
30
31
|
next
|
32
|
+
elsif page.hidden?
|
33
|
+
Jekyll.logger.debug(" Sidebar: Hidden page #{page.name} is not hidden for #{current_page_name}")
|
31
34
|
end
|
32
35
|
|
33
36
|
sub_items_markup = sub_items_markup(page, current_page)
|
@@ -41,7 +44,7 @@ module SwedbankPay
|
|
41
44
|
# If we're rendering a leaf node, just set the level to a non-zero value
|
42
45
|
# to get the 'nav-subgroup' class and such.
|
43
46
|
level = is_leaf ? -1 : page.level
|
44
|
-
title_markup = title_markup(page, level)
|
47
|
+
title_markup = title_markup(page, level, is_leaf)
|
45
48
|
item_class = item_class(page, current_page, level, is_leaf)
|
46
49
|
group_heading_class = group_heading_class(level)
|
47
50
|
|
@@ -70,11 +73,12 @@ module SwedbankPay
|
|
70
73
|
"#{group_class}-heading"
|
71
74
|
end
|
72
75
|
|
73
|
-
def title_markup(page, level)
|
76
|
+
def title_markup(page, level, is_leaf)
|
74
77
|
lead_title = lead_title(page)
|
75
78
|
return "<span>#{lead_title}</span>" if level.zero?
|
76
79
|
|
77
|
-
main_title = main_title(page)
|
80
|
+
main_title = main_title(page, is_leaf)
|
81
|
+
|
78
82
|
"<a href=\"#{page.path}\">#{main_title}</a>"
|
79
83
|
end
|
80
84
|
|
@@ -96,7 +100,7 @@ module SwedbankPay
|
|
96
100
|
return leaf_markup(page.path, main_title, page.level) unless page.headers?
|
97
101
|
|
98
102
|
# If there's no children, only return the headers as leaf node items.
|
99
|
-
return page.headers.map { |h| header_markup(page, h) }.join('')
|
103
|
+
return page.headers.map { |h| header_markup(page, h) }.join('') unless page.children?
|
100
104
|
|
101
105
|
headers_markup = page.headers.map { |h| header_markup(page, h) }.join('')
|
102
106
|
headers_markup = "<ul class=\"nav-ul\">#{headers_markup}</ul>"
|
@@ -123,14 +127,28 @@ module SwedbankPay
|
|
123
127
|
''
|
124
128
|
end
|
125
129
|
|
126
|
-
def main_title(page)
|
130
|
+
def main_title(page, is_leaf)
|
127
131
|
unless page.nil? || page.title.nil?
|
128
|
-
|
132
|
+
lead_title = lead_title(page)
|
133
|
+
parent_lead_title = parent_lead_title(page)
|
134
|
+
main_title = page.title.main
|
135
|
+
|
136
|
+
# If the lead title is different to the parent's or we're not on a leaf
|
137
|
+
# node item, use the lead title as the main title. This causes 'section: Card'
|
138
|
+
# to be used as title for the Card item, but allows the nav-subgroup-heading
|
139
|
+
# 'Introduction' item to use the main title 'Introduction'.
|
140
|
+
main_title = lead_title unless lead_title == parent_lead_title || is_leaf
|
129
141
|
|
130
|
-
return
|
142
|
+
return main_title || page.title.to_s
|
131
143
|
end
|
132
144
|
|
133
145
|
''
|
134
146
|
end
|
147
|
+
|
148
|
+
def parent_lead_title(page)
|
149
|
+
return page.parent.title.lead unless page.parent.nil? || page.parent.title.nil?
|
150
|
+
|
151
|
+
nil
|
152
|
+
end
|
135
153
|
end
|
136
154
|
end
|
data/lib/sidebar_page.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'jekyll'
|
4
|
+
require 'nokogiri'
|
4
5
|
require_relative 'sidebar_path'
|
5
6
|
require_relative 'sidebar_page_title'
|
6
7
|
require_relative 'sidebar_page_collection'
|
@@ -11,13 +12,14 @@ module SwedbankPay
|
|
11
12
|
class SidebarPage
|
12
13
|
FIXNUM_MAX = (2**(0.size * 8 - 2) - 1)
|
13
14
|
|
14
|
-
attr_reader :path, :title, :level, :order, :children, :name
|
15
|
-
attr_accessor :headers, :
|
15
|
+
attr_reader :path, :title, :level, :order, :children, :name, :filename, :doc
|
16
|
+
attr_accessor :headers, :sidebar_container, :number, :parent
|
16
17
|
|
17
18
|
def initialize(jekyll_page)
|
18
19
|
raise ArgumentError, 'jekyll_page cannot be nil' if jekyll_page.nil?
|
19
20
|
raise ArgumentError, 'jekyll_page must be a Jekyll::Page' unless jekyll_page.is_a? Jekyll::Page
|
20
21
|
|
22
|
+
@filename = jekyll_page.destination('')
|
21
23
|
@jekyll_page = jekyll_page
|
22
24
|
sidebar_path = SidebarPath.new(jekyll_page['url'])
|
23
25
|
@path = sidebar_path.to_s
|
@@ -56,10 +58,6 @@ module SwedbankPay
|
|
56
58
|
def hidden_for?(other_page)
|
57
59
|
# The current page should be hidden for the other page unless the
|
58
60
|
# other page is also hidden.
|
59
|
-
#
|
60
|
-
# TODO: Make it so that hiddden pages within a section are visible
|
61
|
-
# for each other, but not for other sections, regardless if
|
62
|
-
# they are hidden or not.
|
63
61
|
hidden = hidden?
|
64
62
|
|
65
63
|
if other_page.nil? || !other_page.is_a?(SidebarPage)
|
@@ -67,7 +65,9 @@ module SwedbankPay
|
|
67
65
|
return hidden
|
68
66
|
end
|
69
67
|
|
70
|
-
|
68
|
+
# If the other page is hidden, the current page should not be hidden
|
69
|
+
# from it.
|
70
|
+
return false if other_page.hidden? && in_same_section_as?(other_page)
|
71
71
|
|
72
72
|
hidden
|
73
73
|
end
|
@@ -104,8 +104,7 @@ module SwedbankPay
|
|
104
104
|
return
|
105
105
|
end
|
106
106
|
|
107
|
-
Jekyll.logger.debug(" Sidebar:
|
108
|
-
Jekyll.logger.debug(" Sidebar: #{@name}.main_title '#{@title.main}'")
|
107
|
+
Jekyll.logger.debug(" Sidebar: <#{@path}>.lead_title('#{@title.lead}').main_title('#{@title.main}')")
|
109
108
|
|
110
109
|
@jekyll_page.data['lead_title'] = @title.lead
|
111
110
|
@jekyll_page.data['main_title'] = @title.main
|
@@ -120,16 +119,26 @@ module SwedbankPay
|
|
120
119
|
end
|
121
120
|
end
|
122
121
|
|
122
|
+
def children?
|
123
|
+
!children.nil? && children.any?
|
124
|
+
end
|
125
|
+
|
123
126
|
def headers?
|
124
127
|
!headers.nil? && headers.any?
|
125
128
|
end
|
126
129
|
|
127
130
|
def coordinate
|
128
131
|
return @number.to_s if @parent.nil?
|
132
|
+
return @number.to_s unless @parent.respond_to? :coordinate
|
129
133
|
|
130
134
|
"#{@parent.coordinate}.#{@number}"
|
131
135
|
end
|
132
136
|
|
137
|
+
def load
|
138
|
+
@doc = File.open(@filename) { |f| Nokogiri::HTML(f) }
|
139
|
+
@doc
|
140
|
+
end
|
141
|
+
|
133
142
|
private
|
134
143
|
|
135
144
|
def menu_order(jekyll_page)
|
@@ -160,5 +169,13 @@ module SwedbankPay
|
|
160
169
|
|
161
170
|
''
|
162
171
|
end
|
172
|
+
|
173
|
+
def in_same_section_as?(other_page)
|
174
|
+
# If this or the other page is the root index page, just ignore the
|
175
|
+
# hidden state completely
|
176
|
+
return false if other_page.path == '/' || @path == '/'
|
177
|
+
|
178
|
+
other_page.path.start_with?(@path) || @path.start_with?(other_page.path)
|
179
|
+
end
|
163
180
|
end
|
164
181
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'forwardable'
|
4
4
|
|
@@ -17,7 +17,6 @@ module SwedbankPay
|
|
17
17
|
pages.each_with_index do |page, index|
|
18
18
|
page.number = index
|
19
19
|
page.parent = parent
|
20
|
-
page.freeze
|
21
20
|
@pages.push(page)
|
22
21
|
end
|
23
22
|
end
|
data/lib/sidebar_page_title.rb
CHANGED
@@ -16,7 +16,8 @@ module SwedbankPay
|
|
16
16
|
|
17
17
|
title = jekyll_page['title']
|
18
18
|
section = jekyll_page['section']
|
19
|
-
|
19
|
+
|
20
|
+
return nil if title.nil? && section.nil?
|
20
21
|
|
21
22
|
SidebarPageTitle.new(title, section, sidebar_page)
|
22
23
|
end
|
@@ -45,11 +46,18 @@ module SwedbankPay
|
|
45
46
|
private
|
46
47
|
|
47
48
|
def initialize(title, section, page)
|
48
|
-
raise ArgumentError, 'title cannot be nil' if title.nil?
|
49
|
-
raise ArgumentError, 'title must be a String' unless title.is_a? String
|
49
|
+
raise ArgumentError, 'Both title and section cannot be nil' if title.nil? && section.nil?
|
50
50
|
raise ArgumentError, 'page cannot be nil' if page.nil?
|
51
51
|
raise ArgumentError, 'page must be a SidebarPage' unless page.is_a? SidebarPage
|
52
52
|
|
53
|
+
if title.nil?
|
54
|
+
raise ArgumentError, 'section must be a String' unless section.is_a? String
|
55
|
+
|
56
|
+
title = section
|
57
|
+
elsif section.nil?
|
58
|
+
raise ArgumentError, 'title must be a String' unless title.is_a? String
|
59
|
+
end
|
60
|
+
|
53
61
|
@page = page
|
54
62
|
@title = title
|
55
63
|
parts = title.split('–')
|
@@ -59,13 +67,28 @@ module SwedbankPay
|
|
59
67
|
end
|
60
68
|
|
61
69
|
def find_section(page)
|
70
|
+
raise ArgumentError, 'page cannot be nil' if page.nil?
|
71
|
+
raise ArgumentError, 'page must be a SidebarPage' unless page.is_a? SidebarPage
|
72
|
+
|
62
73
|
# Return the 'section' front matter if it can be found on the current page.
|
63
|
-
|
74
|
+
section = section_from_front_matter(page)
|
75
|
+
|
76
|
+
return section unless section.nil?
|
64
77
|
|
65
78
|
# Recurse upwards to the root (until there is no parent).
|
66
|
-
|
79
|
+
section_from_parent(page)
|
80
|
+
end
|
81
|
+
|
82
|
+
def section_from_front_matter(page)
|
83
|
+
return nil if page.nil? || page.title.nil? || page.title.section.nil? || page.title.section.empty?
|
84
|
+
|
85
|
+
page.title.section
|
86
|
+
end
|
87
|
+
|
88
|
+
def section_from_parent(page)
|
89
|
+
return nil if page.nil? || page.parent.nil?
|
67
90
|
|
68
|
-
nil
|
91
|
+
find_section(page.parent) unless page.nil? || page.parent.nil?
|
69
92
|
end
|
70
93
|
end
|
71
94
|
end
|
data/lib/sidebar_parser.rb
CHANGED
@@ -1,59 +1,65 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'jekyll'
|
4
|
+
require 'jekyll-redirect-from'
|
4
5
|
require_relative 'sidebar_path'
|
5
6
|
|
6
7
|
module SwedbankPay
|
7
8
|
# The Sidebar renderer
|
8
9
|
class SidebarParser
|
10
|
+
attr_reader :pages
|
11
|
+
|
9
12
|
def initialize(site)
|
10
13
|
raise ArgumentError, 'Site cannot be nil' if site.nil?
|
11
14
|
raise ArgumentError, 'Site must be a Jekyll::Site' unless site.is_a? Jekyll::Site
|
12
15
|
|
13
|
-
@
|
16
|
+
@pages = convert(site.pages)
|
14
17
|
end
|
15
18
|
|
16
|
-
def parse
|
17
|
-
|
19
|
+
def parse(tree)
|
20
|
+
raise ArgumentError, 'tree cannot be nil' if tree.nil?
|
21
|
+
raise ArgumentError, 'tree must be a SidebarTreeBuilder' unless tree.is_a? SidebarTreeBuilder
|
18
22
|
|
19
|
-
|
23
|
+
parse_html(tree)
|
24
|
+
end
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
26
|
+
private
|
27
|
+
|
28
|
+
def convert(pages)
|
29
|
+
pages_hash = {}
|
25
30
|
|
26
|
-
|
27
|
-
|
31
|
+
pages.each do |jekyll_page|
|
32
|
+
if skippable? jekyll_page
|
33
|
+
Jekyll.logger.debug(" Sidebar: Skipping <#{jekyll_page['url']}>")
|
28
34
|
next
|
29
35
|
end
|
30
36
|
|
31
|
-
|
32
|
-
|
33
|
-
page.headers = find_headers(doc)
|
34
|
-
page.sidebar_container = find_sidebar_container(filename, doc)
|
37
|
+
sidebar_page = SidebarPage.new(jekyll_page)
|
38
|
+
pages_hash[sidebar_page.path] = sidebar_page
|
35
39
|
end
|
36
40
|
|
37
|
-
|
41
|
+
pages_hash
|
38
42
|
end
|
39
43
|
|
40
|
-
|
44
|
+
def parse_html(pages)
|
45
|
+
return if pages.nil? || pages.empty?
|
41
46
|
|
42
|
-
|
43
|
-
|
47
|
+
pages.each do |page|
|
48
|
+
page.load
|
49
|
+
page.headers = find_headers(page)
|
50
|
+
page.sidebar_container = find_sidebar_container(page)
|
51
|
+
page.freeze
|
44
52
|
|
45
|
-
|
46
|
-
sidebar_page = SidebarPage.new(jekyll_page)
|
47
|
-
pages_hash[sidebar_page.path] = sidebar_page
|
53
|
+
parse_html(page.children)
|
48
54
|
end
|
49
55
|
|
50
|
-
|
56
|
+
pages
|
51
57
|
end
|
52
58
|
|
53
|
-
def find_headers(
|
59
|
+
def find_headers(page)
|
54
60
|
headers = []
|
55
61
|
|
56
|
-
doc.xpath('//h2').each do |header|
|
62
|
+
page.doc.xpath('//h2').each do |header|
|
57
63
|
next unless header['id']
|
58
64
|
|
59
65
|
child_markup = header.last_element_child
|
@@ -68,15 +74,22 @@ module SwedbankPay
|
|
68
74
|
headers
|
69
75
|
end
|
70
76
|
|
71
|
-
def find_sidebar_container(
|
72
|
-
sidebar_containers = doc.xpath('//*[@id="dx-sidebar-main-nav-ul"]')
|
77
|
+
def find_sidebar_container(page)
|
78
|
+
sidebar_containers = page.doc.xpath('//*[@id="dx-sidebar-main-nav-ul"]')
|
73
79
|
|
74
|
-
|
75
|
-
Jekyll.logger.
|
80
|
+
if sidebar_containers.empty?
|
81
|
+
Jekyll.logger.error(" Sidebar: No sidebar container found in <#{page.filename}>!")
|
76
82
|
return nil
|
77
83
|
end
|
78
84
|
|
79
85
|
sidebar_containers.first
|
80
86
|
end
|
87
|
+
|
88
|
+
def skippable?(jekyll_page)
|
89
|
+
return true if jekyll_page.is_a? JekyllRedirectFrom::RedirectPage
|
90
|
+
return true if jekyll_page.is_a? JekyllRedirectFrom::PageWithoutAFile
|
91
|
+
|
92
|
+
false
|
93
|
+
end
|
81
94
|
end
|
82
95
|
end
|
data/lib/sidebar_renderer.rb
CHANGED
@@ -10,6 +10,7 @@ module SwedbankPay
|
|
10
10
|
raise ArgumentError, 'pages must be an SidebarTreeBuilder' unless tree.is_a? SidebarTreeBuilder
|
11
11
|
|
12
12
|
@tree = tree
|
13
|
+
@html_builder = SidebarHTMLBuilder.new(@tree)
|
13
14
|
end
|
14
15
|
|
15
16
|
def enrich_jekyll
|
@@ -22,24 +23,22 @@ module SwedbankPay
|
|
22
23
|
|
23
24
|
private
|
24
25
|
|
25
|
-
def enrich_jekyll_pages(pages)
|
26
|
-
return if pages.empty?
|
27
|
-
|
28
|
-
pages.each do |page|
|
29
|
-
page.enrich_jekyll
|
30
|
-
|
31
|
-
enrich_jekyll_pages(page.children)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
26
|
def render_pages(pages)
|
36
27
|
return if pages.empty?
|
37
28
|
|
38
29
|
pages.each do |page|
|
39
|
-
sidebar_html =
|
30
|
+
sidebar_html = render_sidebar(page)
|
31
|
+
name = page.filename || page.name || page.to_s
|
32
|
+
|
33
|
+
if sidebar_html.nil?
|
34
|
+
Jekyll.logger.warn(" Sidebar: No HTML rendered for #{name}.")
|
35
|
+
next
|
36
|
+
end
|
40
37
|
|
41
|
-
|
42
|
-
|
38
|
+
if page.sidebar_container.nil?
|
39
|
+
Jekyll.logger.warn(" Sidebar: No sidebar container found in '#{name}'. #{page.filename}")
|
40
|
+
next
|
41
|
+
end
|
43
42
|
|
44
43
|
page.sidebar_container.inner_html = sidebar_html
|
45
44
|
|
@@ -49,19 +48,17 @@ module SwedbankPay
|
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
52
|
-
def
|
51
|
+
def render_sidebar(page)
|
53
52
|
sidebar_html = nil
|
54
53
|
|
55
54
|
begin
|
56
|
-
|
57
|
-
sidebar_html = builder.build(page)
|
55
|
+
sidebar_html = @html_builder.build(page)
|
58
56
|
|
59
57
|
File.open('_site/sidebar.html', 'w') { |f| f.write(sidebar_html) }
|
60
58
|
rescue StandardError => e
|
61
|
-
name = page.filename || page.name
|
59
|
+
name = page.filename || page.name || page.to_s
|
62
60
|
Jekyll.logger.error(" Sidebar: Unable to render sidebar for '#{name}'.")
|
63
61
|
Jekyll.logger.debug(" Sidebar: #{e.message}. #{e.backtrace.inspect}")
|
64
|
-
return nil
|
65
62
|
end
|
66
63
|
|
67
64
|
sidebar_html
|
data/lib/sidebar_text_builder.rb
CHANGED
@@ -13,10 +13,11 @@ module SwedbankPay
|
|
13
13
|
|
14
14
|
def to_s
|
15
15
|
name = @page.name == '/' ? '/' : "/#{@page.name}"
|
16
|
-
|
17
|
-
|
16
|
+
lead_title = @page.title.nil? ? '?' : @page.title.lead
|
17
|
+
main_title = @page.title.nil? ? '?' : @page.title.main
|
18
|
+
s = "#{indent} #{@page.coordinate}. #{name}: #{lead_title} – #{main_title}\n"
|
18
19
|
|
19
|
-
|
20
|
+
if @page.children?
|
20
21
|
@page.children.each do |child|
|
21
22
|
s << child.to_s
|
22
23
|
end
|
data/lib/sidebar_tree_builder.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
+
require 'jekyll'
|
3
4
|
require 'forwardable'
|
4
5
|
require_relative 'sidebar_page_collection'
|
5
6
|
|
@@ -8,12 +9,14 @@ module SwedbankPay
|
|
8
9
|
class SidebarTreeBuilder
|
9
10
|
include Enumerable
|
10
11
|
extend Forwardable
|
11
|
-
def_delegators :@
|
12
|
+
def_delegators :@tree, :each, :length, :empty?, :<<, :[], :count
|
12
13
|
|
13
14
|
def initialize(pages)
|
14
|
-
raise ArgumentError, '
|
15
|
+
raise ArgumentError, 'pages cannot be nil' if pages.nil?
|
16
|
+
raise ArgumentError, 'pages must be a Hash' unless pages.is_a? Hash
|
15
17
|
|
16
|
-
@
|
18
|
+
@tree = tree(pages)
|
19
|
+
enrich_jekyll_pages(@tree)
|
17
20
|
end
|
18
21
|
|
19
22
|
def to_s
|
@@ -31,7 +34,7 @@ module SwedbankPay
|
|
31
34
|
|
32
35
|
if inspection
|
33
36
|
output << ":\n"
|
34
|
-
@
|
37
|
+
@tree.each do |page|
|
35
38
|
output << "#{page}\n"
|
36
39
|
end
|
37
40
|
end
|
@@ -69,5 +72,15 @@ module SwedbankPay
|
|
69
72
|
def sort_by_path_reversed(pages)
|
70
73
|
pages.sort_by { |path, _| path }.reverse
|
71
74
|
end
|
75
|
+
|
76
|
+
def enrich_jekyll_pages(pages)
|
77
|
+
return if pages.empty?
|
78
|
+
|
79
|
+
pages.each do |page|
|
80
|
+
page.enrich_jekyll
|
81
|
+
|
82
|
+
enrich_jekyll_pages(page.children)
|
83
|
+
end
|
84
|
+
end
|
72
85
|
end
|
73
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swedbank-pay-design-guide-jekyll-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swedbank Pay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -207,6 +207,7 @@ extra_rdoc_files: []
|
|
207
207
|
files:
|
208
208
|
- LICENSE
|
209
209
|
- README.md
|
210
|
+
- _includes/accordion-table.html
|
210
211
|
- _includes/alert.html
|
211
212
|
- _includes/anchor_headings.html
|
212
213
|
- _includes/apple-mobile-headers.html
|
@@ -217,6 +218,7 @@ files:
|
|
217
218
|
- _includes/card-horizontal-list.html
|
218
219
|
- _includes/card-list.html
|
219
220
|
- _includes/card.html
|
221
|
+
- _includes/github.html
|
220
222
|
- _includes/google_analytics.html
|
221
223
|
- _includes/img/merchants/logo-coop.svg
|
222
224
|
- _includes/img/merchants/logo-elkjop.svg
|
@@ -243,7 +245,9 @@ files:
|
|
243
245
|
- _includes/toc.html
|
244
246
|
- _layouts/default.html
|
245
247
|
- _layouts/front-page.html
|
246
|
-
-
|
248
|
+
- _layouts/search.html
|
249
|
+
- _plugins/swedbank-pay-design-guide-jekyll-theme.rb
|
250
|
+
- _sass/accordion-table.scss
|
247
251
|
- _sass/breakpoints.scss
|
248
252
|
- _sass/card.scss
|
249
253
|
- _sass/code-view.scss
|
@@ -270,6 +274,7 @@ files:
|
|
270
274
|
- assets/tipuesearch/tipuesearch_content.js
|
271
275
|
- assets/tipuesearch/tipuesearch_set.js
|
272
276
|
- lib/gem_version.rb
|
277
|
+
- lib/regex_capture_filter.rb
|
273
278
|
- lib/safe_merge.rb
|
274
279
|
- lib/sanitized_filename.rb
|
275
280
|
- lib/sidebar.rb
|
data/_plugins/sidebar.rb
DELETED