jekyll-theme-open-project-helpers 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +10 -0
- data/Gemfile +6 -0
- data/Rakefile +12 -0
- data/jekyll-theme-open-project-helpers.gemspec +1 -1
- data/lib/jekyll-theme-open-project-helpers/spec_builders/png_diagrams.rb +73 -46
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5340ebd6b73a77f544854b7425860b5a2fa78ae1508182b0fa53f2aaa6002906
|
4
|
+
data.tar.gz: 2f9025c1a872c6176924c2f936c9bc1fdb7f14c5ce272da54a96ded564528122
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992ce56cd7eafea9d7167384a227eaff95d3dc20bd368e277f386238b13725db49662185aef4f0f415f28784fe392036bf01196af7d715fb3b1790f4ec66848e
|
7
|
+
data.tar.gz: 9e6d476f0a89b3aee43f1c3e5d0becc5ca2b3ee3d297eb371143587ae19d7182248fd3c6c1c14fe69bfda241e1522a062fcd363dedab3273ee05a5fc323fbb1e
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
inherit_from:
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
5
|
+
|
6
|
+
# local repo-specific modifications
|
7
|
+
# ...
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 2.5
|
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -1,92 +1,119 @@
|
|
1
|
-
require
|
1
|
+
require "fastimage"
|
2
2
|
|
3
3
|
# Recursively go through given list of nav_items, including any nested items,
|
4
4
|
# and return a flat array containing navigation items with path specified.
|
5
5
|
def get_nav_items_with_path(nav_items)
|
6
6
|
items_with_path = []
|
7
7
|
|
8
|
-
|
9
|
-
if item[
|
8
|
+
nav_items.each do |item|
|
9
|
+
if item["path"]
|
10
10
|
items_with_path.push(item)
|
11
11
|
end
|
12
12
|
|
13
|
-
if item[
|
14
|
-
items_with_path.concat(get_nav_items_with_path(item[
|
13
|
+
if item["items"]
|
14
|
+
items_with_path.concat(get_nav_items_with_path(item["items"]))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
items_with_path
|
19
19
|
end
|
20
20
|
|
21
21
|
module Builder
|
22
|
-
|
23
22
|
class PngDiagramPage < Jekyll::Page
|
24
|
-
|
23
|
+
EXTRA_STYLESHEETS = [{
|
24
|
+
"href" => "https://unpkg.com/leaflet@1.3.4/dist/leaflet.css",
|
25
|
+
"integrity" => "sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==", # rubocop:disable Layout/LineLength
|
26
|
+
"crossorigin" => "",
|
27
|
+
}].freeze
|
28
|
+
|
29
|
+
EXTRA_SCRIPTS = [{
|
30
|
+
"src" => "https://unpkg.com/leaflet@1.3.4/dist/leaflet.js",
|
31
|
+
"integrity" => "sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA==", # rubocop:disable Layout/LineLength
|
32
|
+
"crossorigin" => "",
|
33
|
+
}].freeze
|
34
|
+
|
35
|
+
def initialize(site, base, dir, data) # rubocop:disable Lint/MissingSuper
|
25
36
|
@site = site
|
26
37
|
@base = base
|
27
38
|
@dir = dir
|
28
|
-
@name =
|
39
|
+
@name = "index.html"
|
29
40
|
|
30
|
-
|
41
|
+
process(@name)
|
31
42
|
self.data ||= data
|
32
43
|
|
33
|
-
self.data[
|
34
|
-
|
35
|
-
|
36
|
-
"crossorigin" => "",
|
37
|
-
}]
|
38
|
-
|
39
|
-
self.data['extra_scripts'] = [{
|
40
|
-
"src" => "https://unpkg.com/leaflet@1.3.4/dist/leaflet.js",
|
41
|
-
"integrity" => "sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA==",
|
42
|
-
"crossorigin" => "",
|
43
|
-
}]
|
44
|
-
|
45
|
-
self.data['layout'] = 'spec'
|
44
|
+
self.data["extra_stylesheets"] = EXTRA_STYLESHEETS
|
45
|
+
self.data["extra_scripts"] = EXTRA_SCRIPTS
|
46
|
+
self.data["layout"] = "spec"
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
49
50
|
def build_spec_pages(site, spec_info, source, destination, opts)
|
50
51
|
images_path = source
|
51
52
|
spec_root = destination
|
52
|
-
stub_path = "#{File.dirname(__FILE__)}/png_diagram.html"
|
53
53
|
pages = []
|
54
54
|
|
55
|
-
diagram_nav_items = get_nav_items_with_path(
|
55
|
+
diagram_nav_items = get_nav_items_with_path(
|
56
|
+
spec_info.data["navigation"]["items"],
|
57
|
+
)
|
58
|
+
not_found_items = diagram_nav_items.dup
|
56
59
|
|
57
60
|
Dir.glob("#{images_path}/*.png") do |pngfile|
|
58
61
|
png_name = File.basename(pngfile)
|
59
62
|
png_name_noext = File.basename(png_name, File.extname(png_name))
|
60
63
|
|
61
|
-
nav_item = diagram_nav_items.select
|
62
|
-
item[
|
63
|
-
|
64
|
-
|
65
|
-
png_dimensions = FastImage.size(pngfile)
|
66
|
-
data = spec_info.data.clone
|
67
|
-
data['image_path'] = "/#{spec_root}/images/#{png_name}"
|
68
|
-
data['image_width'] = png_dimensions[0]
|
69
|
-
data['image_height'] = png_dimensions[1]
|
64
|
+
nav_item = diagram_nav_items.select do |item|
|
65
|
+
item["path"].start_with?(png_name_noext)
|
66
|
+
end [0].clone
|
70
67
|
|
71
68
|
if nav_item == nil
|
72
|
-
|
69
|
+
warn "UNUSED PNG: #{png_name} detected at source without " \
|
70
|
+
"a corresponding navigation item at (#{spec_root})."
|
71
|
+
next
|
73
72
|
end
|
74
73
|
|
75
|
-
|
74
|
+
not_found_items.delete_if { |item| item["title"] == nav_item["title"] }
|
75
|
+
|
76
|
+
data = build_spec_page_data(pngfile, spec_root, png_name, nav_item,
|
77
|
+
spec_info)
|
76
78
|
|
77
|
-
|
78
|
-
|
79
|
+
pages << build_spec_page(site, spec_root, png_name_noext, data)
|
80
|
+
end
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
data)
|
85
|
-
page.content = File.read(stub_path)
|
86
|
-
pages << page
|
82
|
+
not_found_items.each do |item|
|
83
|
+
title = item["title"]
|
84
|
+
warn "SPECIFIED PNG NOT FOUND: #{title}.png not found at source " \
|
85
|
+
"as specified at (#{spec_root})."
|
87
86
|
end
|
88
87
|
|
89
|
-
|
88
|
+
pages
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_spec_page(site, spec_root, png_name_noext, data)
|
92
|
+
page = PngDiagramPage.new(
|
93
|
+
site,
|
94
|
+
site.source,
|
95
|
+
File.join(spec_root, png_name_noext),
|
96
|
+
data,
|
97
|
+
)
|
98
|
+
|
99
|
+
stub_path = "#{File.dirname(__FILE__)}/png_diagram.html"
|
100
|
+
page.content = File.read(stub_path)
|
101
|
+
|
102
|
+
page
|
90
103
|
end
|
91
104
|
|
105
|
+
def build_spec_page_data(pngfile, spec_root, png_name, nav_item, spec_info)
|
106
|
+
png_dimensions = FastImage.size(pngfile)
|
107
|
+
data = spec_info.data.clone
|
108
|
+
data["image_path"] = "/#{spec_root}/images/#{png_name}"
|
109
|
+
data["image_width"] = png_dimensions[0]
|
110
|
+
data["image_height"] = png_dimensions[1]
|
111
|
+
|
112
|
+
data = data.merge(nav_item)
|
113
|
+
|
114
|
+
data["title"] = "#{spec_info['title']}: #{nav_item['title']}"
|
115
|
+
data["article_header_title"] = nav_item["title"].to_s
|
116
|
+
|
117
|
+
data
|
118
|
+
end
|
92
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-open-project-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -87,8 +87,12 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rubocop.yml"
|
92
|
+
- Gemfile
|
90
93
|
- LICENSE.txt
|
91
94
|
- README.md
|
95
|
+
- Rakefile
|
92
96
|
- develop/release
|
93
97
|
- jekyll-theme-open-project-helpers.gemspec
|
94
98
|
- lib/jekyll-theme-open-project-helpers.rb
|
@@ -119,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
123
|
- !ruby/object:Gem::Version
|
120
124
|
version: '0'
|
121
125
|
requirements: []
|
122
|
-
rubygems_version: 3.0.
|
126
|
+
rubygems_version: 3.0.3
|
123
127
|
signing_key:
|
124
128
|
specification_version: 4
|
125
129
|
summary: Helpers for the Open Project Jekyll theme
|