swedbank-pay-design-guide-jekyll-theme 1.6.1.pre.PullRequest0137.pre.0064 → 1.9.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.
- checksums.yaml +4 -4
- data/_includes/sidebar.html +1 -2
- data/_layouts/default.html +4 -5
- data/_layouts/front-page.html +112 -0
- data/_plugins/sidebar.rb +2 -1
- data/lib/gem_version.rb +1 -1
- data/lib/safe_merge.rb +28 -0
- data/lib/sanitized_filename.rb +12 -0
- data/lib/sidebar.rb +27 -190
- data/lib/sidebar_html_builder.rb +141 -0
- data/lib/sidebar_page.rb +117 -0
- data/lib/sidebar_page_collection.rb +37 -0
- data/lib/sidebar_page_title.rb +29 -0
- data/lib/sidebar_parser.rb +62 -0
- data/lib/sidebar_path.rb +62 -0
- data/lib/sidebar_renderer.rb +51 -0
- data/lib/sidebar_text_builder.rb +46 -0
- data/lib/sidebar_tree_builder.rb +73 -0
- metadata +45 -6
- data/_includes/front-page.html +0 -240
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4baacc614edb524f53a8b0a23788382fba5ec477f10f08888adf08fcbde24998
|
4
|
+
data.tar.gz: 0cb1ef91541ba25c94708789ab05379ea92fc94ea0a7a62c336182f108a62544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bf78e21de260346ee939876981e7cfeb2558e74a2d492217a07c4a23bde14018eb746225e7ad5f23420cacf89c2c82e07dc8c008a2ed588e7a5a9934ea2862f
|
7
|
+
data.tar.gz: bba4b0c952ee13e087c0e6f38c738d3999874e0670a3881e053b2b7fc58ae5e39ec748af3d64e3548c45efe79e9984539f193340ebaf73263e10ebddcdbe74e4
|
data/_includes/sidebar.html
CHANGED
@@ -19,7 +19,7 @@ Original creator: https://sebnitu.com/2016/10/13/dynamic-menus-in-jekyll/
|
|
19
19
|
{% endif %}
|
20
20
|
|
21
21
|
<ul class="main-nav-ul">
|
22
|
-
{% assign pages = site.pages | sort: '
|
22
|
+
{% assign pages = site.pages | sort: 'menu_order' %}
|
23
23
|
{% for node in pages %}
|
24
24
|
{% assign node_parts = node.url | split: '/' %}
|
25
25
|
{% assign node_depth = node_parts | size %}
|
@@ -113,4 +113,3 @@ Original creator: https://sebnitu.com/2016/10/13/dynamic-menus-in-jekyll/
|
|
113
113
|
</ul>
|
114
114
|
</nav>
|
115
115
|
</div>
|
116
|
-
|
data/_layouts/default.html
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
{%- assign title = page.title | default: "PayEx Design Guide theme for Jekyll" -%}
|
2
|
-
{%- assign front_page = page.front_page | default: false -%}
|
3
2
|
{%- assign description = page.opengraph.description | default: site.opengraph.description -%}
|
4
3
|
{%- assign image = page.opengraph.image | default: site.opengraph.image -%}
|
5
4
|
{%- assign github_branch = site.github.branch | default : "develop" -%}
|
@@ -80,14 +79,14 @@
|
|
80
79
|
</div>
|
81
80
|
|
82
81
|
<main class="doc-view col-xxl-10 col-lg-9">
|
83
|
-
{% if
|
82
|
+
{% if page.layout != 'front-page' %}
|
84
83
|
{% assign title_lead = title | split: '–' | first %}
|
85
84
|
{% assign title_main = title | split: '–' | last %}
|
86
85
|
{% assign description = page.description %}
|
87
86
|
{% assign estimated_read = page.estimated_read %}
|
88
87
|
<div class="title-header">
|
89
88
|
<div class="title-header-container
|
90
|
-
{% if page.card_overview%} max-width-card-overview
|
89
|
+
{% if page.card_overview %} max-width-card-overview
|
91
90
|
{% else %} max-width
|
92
91
|
{% endif %}">
|
93
92
|
{% if title_lead != title_main %}
|
@@ -106,8 +105,8 @@
|
|
106
105
|
</div>
|
107
106
|
</div>
|
108
107
|
{% endif %}
|
109
|
-
<div class="doc-container{% if
|
110
|
-
{% elsif page.card_overview%} normal-padding max-width-card-overview
|
108
|
+
<div class="doc-container{% if page.layout == 'front-page' %} no-padding
|
109
|
+
{% elsif page.card_overview %} normal-padding max-width-card-overview
|
111
110
|
{% else %} normal-padding max-width
|
112
111
|
{% endif %}">
|
113
112
|
<article>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
---
|
4
|
+
|
5
|
+
{% assign show_merchants_bar = page.front_page.show_merchants_bar | default: false %}
|
6
|
+
{% assign front_page_title = page.front_page.title | default: 'developer portal' %}
|
7
|
+
{% assign front_page_hero = page.front_page.hero | default: "Welcome to the Swedbank Pay" %}
|
8
|
+
{% assign front_page_ingress = page.front_page.ingress | default: "Our developer portal gives you the full tool box for integrating our payment instruments and getting started with easy, flexible and safe payments on your e-commerce website." %}
|
9
|
+
{% assign front_page_start_heading = page.front_page.start_heading | default: "Start your integration" %}
|
10
|
+
|
11
|
+
<div class="front-page">
|
12
|
+
<div class="front-page-container">
|
13
|
+
<div class="front-page-top">
|
14
|
+
<div class="front-page-hero">
|
15
|
+
<h3>{{ front_page_hero }}</h3>
|
16
|
+
<div class="front-page-hero-name">
|
17
|
+
{<span>{{ front_page_title }}</span>}
|
18
|
+
</div>
|
19
|
+
<p>{{ front_page_ingress }}</p>
|
20
|
+
</div>
|
21
|
+
<div class="front-page-intro-cards">
|
22
|
+
<h2 id="front-page-start" class="heading-line heading-line-white">{{ front_page_start_heading }}</h2>
|
23
|
+
{% contentblock start %}
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
{% if show_merchants_bar == true %}
|
27
|
+
<div class="front-page-merchants">
|
28
|
+
<h6>Trusted by</h6>
|
29
|
+
<div class="merchants-container justify-content-xxl-between">
|
30
|
+
<a class="merchant-link">
|
31
|
+
{% include img/merchants/logo-schibsted.svg %}
|
32
|
+
</a>
|
33
|
+
<a class="merchant-link">
|
34
|
+
{% include img/merchants/logo-ica.svg %}
|
35
|
+
</a>
|
36
|
+
<a class="merchant-link">
|
37
|
+
{% include img/merchants/logo-elkjop.svg %}
|
38
|
+
</a>
|
39
|
+
<a class="merchant-link">
|
40
|
+
{% include img/merchants/logo-synsam.svg %}
|
41
|
+
</a>
|
42
|
+
<a class="merchant-link">
|
43
|
+
{% include img/merchants/logo-coop.svg %}
|
44
|
+
</a>
|
45
|
+
<a class="merchant-link">
|
46
|
+
{% include img/merchants/logo-svenskaspel.svg %}
|
47
|
+
</a>
|
48
|
+
<a class="merchant-link">
|
49
|
+
{% include img/merchants/logo-skanetrafiken.svg %}
|
50
|
+
</a>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
{% endif %}
|
55
|
+
<a href="https://ecom.externalintegration.payex.com/pspdemoshop" class="front-page-demoshop">
|
56
|
+
<span class="front-page-demoshop-text">
|
57
|
+
<span class="h2">Try our Demoshop<span>.</span></span>
|
58
|
+
<span class="demoshop-text-description">
|
59
|
+
Unsure about how it all works? See how our checkout and payment methods are used
|
60
|
+
in practice!
|
61
|
+
</span>
|
62
|
+
</span>
|
63
|
+
<span class="front-page-demoshop-link">
|
64
|
+
<span class="h3">Go to the demoshop</span>
|
65
|
+
<i class="material-icons">arrow_forward</i>
|
66
|
+
<span class="demoshop-link-img">
|
67
|
+
<img class="demoshop-link-img-mobile d-md-none d-lg-flex d-xl-none d-xxl-flex"
|
68
|
+
src="/assets/img/demoshop-mobile.svg" alt="demoshop-mobile" />
|
69
|
+
<img class="demoshop-link-img-mobile d-none d-md-none d-lg-flex d-xl-none"
|
70
|
+
src="/assets/img/demoshop-mobile2.svg" alt="demoshop-mobile2" />
|
71
|
+
<img class="demoshop-link-img-web d-none d-sm-none d-md-flex d-lg-none d-xl-flex"
|
72
|
+
src="/assets/img/demoshop-web.svg" alt="demoshop-web" />
|
73
|
+
</span>
|
74
|
+
</span>
|
75
|
+
</a>
|
76
|
+
|
77
|
+
<div class="front-page-container">
|
78
|
+
<div class="front-page-cards-sdk">
|
79
|
+
{% contentblock sdks %}
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<div class="front-page-cards-module">
|
83
|
+
{% contentblock modules %}
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div class="front-page-release-notes">
|
87
|
+
{% contentblock release_notes %}
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<div class="front-page-cards-extra">
|
91
|
+
{% contentblock extras %}
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div class="front-page-contact">
|
95
|
+
<div class="front-page-contact-content">
|
96
|
+
<div class="row">
|
97
|
+
<div class="col-xl-7">
|
98
|
+
<h2 id="front-page-contact" class="heading-line heading-line-long">Can't find what you are
|
99
|
+
looking for?</h2>
|
100
|
+
<p>
|
101
|
+
We are always trying to make the developer portal as
|
102
|
+
good as it can be please don’t hesitate to contact us.
|
103
|
+
</p>
|
104
|
+
</div>
|
105
|
+
<div class="col-xl-5 d-flex align-items-center justify-content-center">
|
106
|
+
<button class="btn">Contact us here</button>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</div>
|
data/_plugins/sidebar.rb
CHANGED
data/lib/gem_version.rb
CHANGED
data/lib/safe_merge.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The Hash class
|
4
|
+
class Hash
|
5
|
+
# Safely merges the current Hash with an 'other' Hash.
|
6
|
+
def safe_merge(other)
|
7
|
+
all_keys = keys | other.keys
|
8
|
+
result_hash = {}
|
9
|
+
|
10
|
+
all_keys.each do |key|
|
11
|
+
hash_value = {}
|
12
|
+
|
13
|
+
if key? key
|
14
|
+
value = self[key]
|
15
|
+
hash_value = value unless value.nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
if other.key? key
|
19
|
+
value = other[key]
|
20
|
+
hash_value = hash_value.merge(value) unless value.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
result_hash[key] = hash_value
|
24
|
+
end
|
25
|
+
|
26
|
+
result_hash
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The String class
|
4
|
+
class String
|
5
|
+
# Sanitizes a filename
|
6
|
+
def sanitized
|
7
|
+
match = match(/(?m)(?<=\b_site).*$/)
|
8
|
+
sanitized_filename = match ? match[0] : self
|
9
|
+
sanitized_filename = sanitized_filename.gsub('index.html', '')
|
10
|
+
sanitized_filename.gsub('.html', '')
|
11
|
+
end
|
12
|
+
end
|
data/lib/sidebar.rb
CHANGED
@@ -3,209 +3,46 @@
|
|
3
3
|
require 'jekyll'
|
4
4
|
require 'nokogiri'
|
5
5
|
require 'json'
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
hide_from_sidebar = page['hide_from_sidebar'].nil? ? false : page['hide_from_sidebar']
|
20
|
-
url = page['url'].gsub('index.html', '').gsub('.html', '')
|
21
|
-
@hash_pre_render[url] = {
|
22
|
-
title: page['title'],
|
23
|
-
url: page['url'].gsub('.html', ''),
|
24
|
-
name: page['name'],
|
25
|
-
menu_order: menu_order,
|
26
|
-
hide_from_sidebar: hide_from_sidebar
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
def post_write(site)
|
31
|
-
files = []
|
32
|
-
Dir.glob("#{site.config['destination']}/**/*.html") do |filename|
|
33
|
-
doc = File.open(filename) { |f| Nokogiri::HTML(f) }
|
34
|
-
files.push(doc)
|
35
|
-
|
36
|
-
headers = []
|
37
|
-
doc.xpath('//h2 ').each do |header|
|
38
|
-
next unless header['id']
|
39
|
-
|
40
|
-
child = header.last_element_child
|
41
|
-
header = {
|
42
|
-
id: header['id'],
|
43
|
-
title: header.content.strip,
|
44
|
-
hash: (child['href']).to_s
|
45
|
-
}
|
46
|
-
headers.push(header)
|
47
|
-
end
|
48
|
-
sanitized_filename = sanitize_filename(filename)
|
49
|
-
@filename_with_headers[sanitized_filename] = { headers: headers }
|
50
|
-
end
|
51
|
-
|
52
|
-
Dir.glob("#{site.config['destination']}/**/*.html") do |filename|
|
53
|
-
sanitized_filename = sanitize_filename(filename)
|
54
|
-
sidebar = render(sanitized_filename)
|
55
|
-
file = File.open(filename) { |f| Nokogiri::HTML(f) }
|
56
|
-
file.xpath('//*[@id="dx-sidebar-main-nav-ul"]').each do |location|
|
57
|
-
location.inner_html = sidebar
|
58
|
-
end
|
59
|
-
File.open(filename, 'w') { |f| f.write(file.to_html(encoding: 'UTF-8')) }
|
60
|
-
end
|
61
|
-
|
62
|
-
# File.open('_site/sidebar.html', 'w') { |f| f.write(sidebar) }
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def sanitize_filename(filename)
|
68
|
-
sanitized_filename = filename.match(/(?m)(?<=\b_site).*$/)[0]
|
69
|
-
sanitized_filename = sanitized_filename.gsub('index.html', '')
|
70
|
-
sanitized_filename.gsub('.html', '')
|
71
|
-
end
|
72
|
-
|
73
|
-
def generateSubgroup(filename, key, value, all_subgroups, level)
|
74
|
-
title = value[:title].split('–').last
|
75
|
-
subsubgroup_list = all_subgroups.select do |subsubgroup_key, _subsubgroup_value|
|
76
|
-
subsubgroup_key.include? key and subsubgroup_key != key and \
|
77
|
-
key.split('/').length > level
|
78
|
-
end
|
79
|
-
|
80
|
-
subgroup = ''
|
81
|
-
has_subgroups = !all_subgroups.empty?
|
82
|
-
if value[:headers].any? || !subsubgroup_list.empty?
|
83
|
-
if has_subgroups
|
84
|
-
url = value[:url]
|
85
|
-
active = active?(filename, url, true)
|
86
|
-
# puts "#{url}, #{filename}, #{key}" if active
|
87
|
-
item_class = active || (url.split('/').length > level && filename.start_with?(url)) ? 'nav-subgroup active' : 'nav-subgroup'
|
88
|
-
subgroup << "<li class=\"#{item_class}\">"
|
89
|
-
subgroup << "<div class=\"nav-subgroup-heading\"><i class=\"material-icons\">arrow_right</i><a href=\"#{url}\">#{title}</a></div>"
|
90
|
-
subgroup << '<ul class="nav-ul">'
|
91
|
-
|
92
|
-
if subsubgroup_list.empty?
|
93
|
-
value[:headers].each do |header|
|
94
|
-
subgroup << "<li class=\"nav-leaf\"><a href=\"#{value[:url]}#{header[:hash]}\">#{header[:title]}</a></li>"
|
95
|
-
end
|
96
|
-
else
|
97
|
-
subgroup_leaf_class = active ? 'nav-leaf nav-subgroup-leaf active' : 'nav-leaf nav-subgroup-leaf'
|
98
|
-
subgroup << "<li class=\"#{subgroup_leaf_class}\"><a href=\"#{value[:url]}\">#{title} overview</a></li>"
|
99
|
-
|
100
|
-
subsubgroup_list.each do |subsubgroup_key, subsubgroup_value|
|
101
|
-
subgroup << generateSubgroup(filename, subsubgroup_key, subsubgroup_value, subsubgroup_list, 3)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
subgroup << '</ul>'
|
106
|
-
subgroup << '</li>'
|
107
|
-
else
|
108
|
-
value[:headers].each do |header|
|
109
|
-
subgroup << "<li class=\"nav-leaf\"><a href=\"#{value[:url]}#{header[:hash]}\">#{header[:title]}</a></li>"
|
110
|
-
end
|
111
|
-
end
|
112
|
-
else
|
113
|
-
subgroup << if has_subgroups
|
114
|
-
"<li class=\"nav-leaf nav-subgroup-leaf\"><a href=\"#{value[:url]}\">#{title}</a></li>"
|
115
|
-
else
|
116
|
-
"<li class=\"nav-leaf\"><a href=\"#{value[:url]}\">#{title}</a></li>"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
subgroup
|
121
|
-
end
|
122
|
-
|
123
|
-
def render(filename)
|
124
|
-
sidebar = ''
|
125
|
-
|
126
|
-
merged = merge(@hash_pre_render, @filename_with_headers).sort_by { |_key, value| value[:menu_order] }
|
127
|
-
merged.select { |key, _value| key.split('/').length <= 2 }.each do |key, value|
|
128
|
-
next if value[:title].nil?
|
129
|
-
next if value[:hide_from_sidebar]
|
130
|
-
|
131
|
-
subgroups = merged.select { |subgroup_key, _subgroup_value| subgroup_key.include? key and subgroup_key != key and key != '/' }
|
132
|
-
|
133
|
-
active = active?(filename, key)
|
134
|
-
# puts "#{filename}, #{key}" if active
|
135
|
-
item_class = active ? 'nav-group active' : 'nav-group'
|
136
|
-
|
137
|
-
child = "<li class=\"#{item_class}\">"
|
138
|
-
child << "<div class=\"nav-group-heading\"><i class=\"material-icons\">arrow_right</i><span>#{value[:title].split('–').first}</span></div>"
|
139
|
-
|
140
|
-
child << '<ul class="nav-ul">'
|
141
|
-
|
142
|
-
subgroup = generateSubgroup(filename, key, value, subgroups, 2)
|
143
|
-
|
144
|
-
child << subgroup
|
145
|
-
|
146
|
-
if subgroups.any?
|
147
|
-
subgroups.select { |subgroup_key, _subgroup_value| subgroup_key.split('/').length <= 3 }.each do |subgroup_key, subgroup_value|
|
148
|
-
subgroup = generateSubgroup(filename, subgroup_key, subgroup_value, subgroups, 2)
|
149
|
-
child << subgroup
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
child << '</ul>'
|
154
|
-
child << '</li>'
|
155
|
-
sidebar << child
|
6
|
+
require_relative 'sidebar_page'
|
7
|
+
require_relative 'sidebar_parser'
|
8
|
+
require_relative 'sidebar_renderer'
|
9
|
+
require_relative 'sidebar_tree_builder'
|
10
|
+
|
11
|
+
module SwedbankPay
|
12
|
+
# A nice sidebar
|
13
|
+
module Sidebar
|
14
|
+
class << self
|
15
|
+
attr_reader :pages
|
16
|
+
|
17
|
+
def init
|
18
|
+
@pages_hash = {}
|
156
19
|
end
|
157
20
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
def active?(filename, url, exact = false)
|
163
|
-
if filename == '/' || url == '/'
|
164
|
-
if filename == '/' && url == '/'
|
165
|
-
return true
|
166
|
-
else
|
167
|
-
return false
|
168
|
-
end
|
21
|
+
def pre_render(jekyll_page)
|
22
|
+
sidebar_page = SidebarPage.new(jekyll_page)
|
23
|
+
@pages_hash[sidebar_page.path] = sidebar_page
|
169
24
|
end
|
170
25
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
all_keys.each do |key|
|
179
|
-
hash_value = {}
|
180
|
-
|
181
|
-
if hash1.key? key
|
182
|
-
value = hash1[key]
|
183
|
-
|
184
|
-
hash_value = value unless value.nil?
|
185
|
-
end
|
186
|
-
|
187
|
-
if hash2.key? key
|
188
|
-
value = hash2[key]
|
189
|
-
|
190
|
-
hash_value = hash_value.merge(value) unless value.nil?
|
191
|
-
end
|
192
|
-
|
193
|
-
result_hash[key] = hash_value
|
26
|
+
def post_write(site)
|
27
|
+
parser = SidebarParser.new(site)
|
28
|
+
pages = parser.parse(@pages_hash)
|
29
|
+
@pages = SidebarTreeBuilder.new(pages)
|
30
|
+
Jekyll.logger.debug(" Sidebar: #{@pages.inspect}")
|
31
|
+
renderer = SidebarRenderer.new
|
32
|
+
renderer.render(@pages)
|
194
33
|
end
|
195
|
-
|
196
|
-
result_hash
|
197
34
|
end
|
198
35
|
end
|
199
36
|
end
|
200
37
|
|
201
|
-
|
38
|
+
SwedbankPay::Sidebar.init
|
202
39
|
|
203
|
-
Jekyll::Hooks.register :site, :pre_render do |site,
|
40
|
+
Jekyll::Hooks.register :site, :pre_render do |site, _|
|
204
41
|
site.pages.each do |page|
|
205
|
-
|
42
|
+
SwedbankPay::Sidebar.pre_render page
|
206
43
|
end
|
207
44
|
end
|
208
45
|
|
209
46
|
Jekyll::Hooks.register :site, :post_write do |site|
|
210
|
-
|
47
|
+
SwedbankPay::Sidebar.post_write site
|
211
48
|
end
|