jekyll-geolexica 1.8.6 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 953781d4af25bb0fddf2369620b0eb6f80dbe78b5ed0513a2ccb936cb4766fcd
4
- data.tar.gz: 92a2f81efd01b51138ad95e3c2a3821688684ec2bc544f188b558999b35d91d8
3
+ metadata.gz: 16891afbfd31bfa320715e20de559a8ae6b96eecc2cfc53b38ab1654f5c1e156
4
+ data.tar.gz: 1fb4b721b4029abaa5d1c6fdb5f4026ef1eca64fc4f29288bc81f8edfb6be7b2
5
5
  SHA512:
6
- metadata.gz: 9eb581e4730853549c2560c406370a849638db0019f3da67d3893a14e9e356bf44d4ce9e0253cf87ffaac85b4edf523ee639c0129236010c284bd952a695ebeb
7
- data.tar.gz: 17c3fabebc23db2294405d7ee8914dd0bd895759fc33c582345ade2807a5c85660fa6c4af44abda90642d0154b0f3789d0784d3c6f8f94bed966a4ddfc3ee881
6
+ metadata.gz: e5b2fcbcebd7174d974e5579caf37f921f245f47bd68c824c6bce4ebe70db6c5356ee769fd7a3998a7b80080fe8b38c97c42af8333a0ae221acf05159fd90a1d
7
+ data.tar.gz: 2f6a10a96391e6384f1c4a2b3e97d6ea62ba2eccbdcff936adf199c3dc4412625f7d9ca2b0bf4a87ee9acae804ec11e70b670ab29b199fd62d0ad2cd033eb9c7
@@ -8,20 +8,20 @@ module Jekyll
8
8
 
9
9
  attr_reader :site
10
10
 
11
- alias_method :each_concept, :each_value
12
- alias_method :each_termid, :each_key
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("Geolexica:", "Loading concepts")
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["termid"], concept)
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
- "language_statistics" => language_statistics,
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("Geolexica:",
42
- "reading concept from file #{concept_file_path}")
41
+ Jekyll.logger.debug('Geolexica:',
42
+ "reading concept from file #{concept_file_path}")
43
43
 
44
- concept_hash = if glossary_format == "paneron"
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("Geolexica:",
54
- "failed to read concept from file #{concept_file_path}")
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["termid"] = concept["data"]["identifier"]
66
+ concept['termid'] = concept['data']['identifier']
67
67
 
68
- concept["data"]["localizedConcepts"].each do |lang, local_concept_id|
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)["data"]
70
+ concept[lang] = YAML.safe_load(File.read(localized_concept_path), **safe_load_options)['data']
71
71
 
72
- if lang == "eng" && concept[lang]
73
- concept["term"] = concept[lang]["terms"].first["designation"]
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['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
- flat_map{ |concept| term_languages & concept.data.keys }.
87
- group_by(&:itself).
88
- transform_values(&:count)
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["termid"]
111
+ data['termid']
108
112
  end
109
113
 
110
114
  class LiquidCompatibleHash < Hash
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Jekyll
5
5
  module Geolexica
6
- VERSION = "1.8.6".freeze
6
+ VERSION = "1.8.7".freeze
7
7
  end
8
8
  end
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.6
4
+ version: 1.8.7
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-20 00:00:00.000000000 Z
11
+ date: 2023-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll