jekyll-geolexica 1.8.6 → 1.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +15 -0
- data/lib/jekyll/geolexica/glossary.rb +28 -24
- data/lib/jekyll/geolexica/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28a92c6437e168d14b81c6230871e51b864ad78ca6e8a465c2361553d5273f10
|
4
|
+
data.tar.gz: 0f42f094620da7d67a4b744020e4f6063996f661281afb05488ccfdd422f9896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c3892fd357900d2c6793b2725fcb43ec9cb2b24c3ca2e8ad536c266046c7fc1b6a0e3d88b6b1d18fd85694d09a99675cc5bfb7060da2c4e07a333530c52efa
|
7
|
+
data.tar.gz: e09f1a3c68284ac5a859cca8ac4dd8357f3c1b5212a8ae0e8ccc55afb4824127f28383245132342a95abcfde8ba8d96a72c313b80387d0ed50e44cdb93eb51bd
|
data/README.adoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
= jekyll-geolexica
|
2
|
+
|
3
|
+
image:https://github.com/geolexica/jekyll-geolexica/actions/workflows/test.yaml/badge.svg[Build Status,link=https://github.com/geolexica/jekyll-geolexica/actions/workflows/test.yaml]
|
4
|
+
image:https://img.shields.io/gem/v/jekyll-geolexica.svg[Gem Version,link=https://rubygems.org/gems/jekyll-geolexica]
|
5
|
+
image:https://img.shields.io/github/issues-pr-raw/geolexica/jekyll-geolexica.svg[Pull Requests,link=https://github.com/geolexica/jekyll-geolexica/pulls]
|
6
|
+
image:https://img.shields.io/github/commits-since/geolexica/jekyll-geolexica/latest.svg[Commits since latest,link=https://github.com/geolexica/jekyll-geolexica/releases]
|
7
|
+
|
8
|
+
Jekyll plugin for Geolexica by the Geolexica Team.
|
9
|
+
|
10
|
+
== Releasing
|
11
|
+
|
12
|
+
=== New approach
|
13
|
+
|
14
|
+
Do `+git tag ${version-tag}+` or, start release manually with the
|
15
|
+
https://github.com/geolexica/jekyll-geolexica/actions/workflows/release.yml[`release.yml` workflow]
|
@@ -8,20 +8,20 @@ module Jekyll
|
|
8
8
|
|
9
9
|
attr_reader :site
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
alias each_concept each_value
|
12
|
+
alias each_termid each_key
|
13
13
|
|
14
14
|
def initialize(site)
|
15
15
|
@site = site
|
16
16
|
end
|
17
17
|
|
18
18
|
def load_glossary
|
19
|
-
Jekyll.logger.info(
|
19
|
+
Jekyll.logger.info('Geolexica:', 'Loading concepts')
|
20
20
|
Dir.glob(concepts_glob).each { |path| load_concept(path) }
|
21
21
|
end
|
22
22
|
|
23
23
|
def store(concept)
|
24
|
-
super(concept.data[
|
24
|
+
super(concept.data['termid'], concept)
|
25
25
|
end
|
26
26
|
|
27
27
|
def language_statistics
|
@@ -31,17 +31,17 @@ module Jekyll
|
|
31
31
|
# Defines how Glossary is exposed in Liquid templates.
|
32
32
|
def to_liquid
|
33
33
|
{
|
34
|
-
|
34
|
+
'language_statistics' => language_statistics
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
38
38
|
protected
|
39
39
|
|
40
40
|
def load_concept(concept_file_path)
|
41
|
-
Jekyll.logger.debug(
|
42
|
-
|
41
|
+
Jekyll.logger.debug('Geolexica:',
|
42
|
+
"reading concept from file #{concept_file_path}")
|
43
43
|
|
44
|
-
concept_hash = if glossary_format ==
|
44
|
+
concept_hash = if glossary_format == 'paneron'
|
45
45
|
read_paneron_concept_file(concept_file_path)
|
46
46
|
else
|
47
47
|
read_concept_file(concept_file_path)
|
@@ -49,9 +49,9 @@ module Jekyll
|
|
49
49
|
|
50
50
|
preprocess_concept_hash(concept_hash)
|
51
51
|
store Concept.new(concept_hash)
|
52
|
-
rescue
|
53
|
-
Jekyll.logger.error(
|
54
|
-
|
52
|
+
rescue StandardError
|
53
|
+
Jekyll.logger.error('Geolexica:',
|
54
|
+
"failed to read concept from file #{concept_file_path}")
|
55
55
|
raise
|
56
56
|
end
|
57
57
|
|
@@ -63,14 +63,19 @@ module Jekyll
|
|
63
63
|
def read_paneron_concept_file(path)
|
64
64
|
safe_load_options = { permitted_classes: [Date, Time] }
|
65
65
|
concept = YAML.safe_load(File.read(path), **safe_load_options)
|
66
|
-
concept[
|
66
|
+
concept['termid'] = concept['data']['identifier']
|
67
67
|
|
68
|
-
concept[
|
68
|
+
concept['data']['localizedConcepts'].each do |lang, local_concept_id|
|
69
69
|
localized_concept_path = File.join(localized_concepts_path, "#{local_concept_id}.yaml")
|
70
|
-
concept[lang] = YAML.safe_load(File.read(localized_concept_path), **safe_load_options)[
|
70
|
+
concept[lang] = YAML.safe_load(File.read(localized_concept_path), **safe_load_options)['data']
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
next unless concept[lang]
|
73
|
+
|
74
|
+
concept['term'] = concept[lang]['terms'].first['designation'] if lang == 'eng'
|
75
|
+
|
76
|
+
if concept[lang]['status'] && !concept[lang]['status'].empty? &&
|
77
|
+
(concept[lang]['entry_status'].nil? || concept[lang]['entry_status'].empty?)
|
78
|
+
concept[lang]['entry_status'] = concept[lang]['status']
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
@@ -78,14 +83,13 @@ module Jekyll
|
|
78
83
|
end
|
79
84
|
|
80
85
|
# Does nothing, but some sites may replace this method.
|
81
|
-
def preprocess_concept_hash(concept_hash)
|
82
|
-
end
|
86
|
+
def preprocess_concept_hash(concept_hash); end
|
83
87
|
|
84
88
|
def calculate_language_statistics
|
85
|
-
unsorted = each_value.lazy
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
+
unsorted = each_value.lazy
|
90
|
+
.flat_map { |concept| term_languages & concept.data.keys }
|
91
|
+
.group_by(&:itself)
|
92
|
+
.transform_values(&:count)
|
89
93
|
|
90
94
|
# This is not crucial, but gives nicer output, and ensures that
|
91
95
|
# all +term_languages+ are present.
|
@@ -95,7 +99,7 @@ module Jekyll
|
|
95
99
|
class Concept
|
96
100
|
attr_reader :data
|
97
101
|
|
98
|
-
# TODO Maybe some kind of Struct instead of Hash.
|
102
|
+
# TODO: Maybe some kind of Struct instead of Hash.
|
99
103
|
attr_reader :pages
|
100
104
|
|
101
105
|
def initialize(data)
|
@@ -104,7 +108,7 @@ module Jekyll
|
|
104
108
|
end
|
105
109
|
|
106
110
|
def termid
|
107
|
-
data[
|
111
|
+
data['termid']
|
108
112
|
end
|
109
113
|
|
110
114
|
class LiquidCompatibleHash < Hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-geolexica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -156,6 +156,7 @@ extensions: []
|
|
156
156
|
extra_rdoc_files: []
|
157
157
|
files:
|
158
158
|
- Gemfile
|
159
|
+
- README.adoc
|
159
160
|
- Rakefile
|
160
161
|
- _config.yml
|
161
162
|
- _data/lang.yaml
|