jekyll-geolexica 1.5.1 → 1.5.2

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: f479dfc2225e9c5a6fded676c733ae54d9d2e9c42b92d2fc59d46f0f8ab14213
4
- data.tar.gz: a8f4492903569521e575ca726a0734910f6db2c6d3c4842ff74d4b5a2a6630db
3
+ metadata.gz: 84b336a4bbc401ff60ff72c59f3f4e5086f6b300182b37a1a7e12bc0e532a73d
4
+ data.tar.gz: 10443bf14b7126ce05c80f1beb7130152e97cf1ed0eb7d8060ea0b725438def6
5
5
  SHA512:
6
- metadata.gz: cc239129a0e3c802d88cfaae5bc78f6833d9eb3e92f431876c64211760ed5ebdd1cb9be0066d91b9ca9f25aa37ca0d24fd6d34d65bf2cf3138c7427ad9910c54
7
- data.tar.gz: d6a09b8b8090246eec080a775d7a4a41ca1e9ce23db85cd8eb766aa64c88e79103a5beba9916ad74e0f981ac8339443c1cb345559c509c96b04fca77595db5fc
6
+ metadata.gz: 510924b7936929b37e8bba19999d392bfbf253c5719a47389ae335594c0cf91d51496ed8eb03bf17bab689b7dd7b5dd39000fc9ea0a41bb8a21207ccc371c44a
7
+ data.tar.gz: 06d4421c7db00c7adf24e51072dfa8b8a37a028ee4a92eea2601471605daf759466e159218344d2786dde901ec34f8c590f3a2874df05c61ca38c85c48f75ed6
@@ -1,11 +1,6 @@
1
- {%- assign english = page["eng"] -%}
2
1
  <section class="field source">
3
2
  <p class="field-name">source</p>
4
3
  <p class="field-value">
5
- {% if english.authoritative_source.link %}
6
- <a href="{{ english.authoritative_source.link }}">{{ english.authoritative_source.ref | default: english.authoritative_source.link | escape_once }}</a>{% if english.authoritative_source.clause %}, {{ english.authoritative_source.clause }}{% endif %}
7
- {% else %}
8
- {{ english.authoritative_source.ref }}{% if english.authoritative_source.clause %}, {{ english.authoritative_source.clause }}{% endif %}
9
- {% endif %}
4
+ {{ page["eng"].authoritative_source | display_authoritative_source }}
10
5
  </p>
11
6
  </section>
@@ -26,16 +26,9 @@
26
26
  {% endif %}
27
27
 
28
28
  {% if localized_term.authoritative_source.ref != english.authoritative_source.ref %}
29
- {% if localized_term.authoritative_source.link %}
30
29
  <p class="source localized">
31
- [SOURCE: <a href="{{ localized_term.authoritative_source.link }}">
32
- {{ localized_term.authoritative_source.ref }}</a>{% if localized_term.authoritative_source.clause %}, {{ localized_term.authoritative_source.clause }}{% endif %}]
30
+ [SOURCE: {{ localized_term.authoritative_source | display_authoritative_source }}]
33
31
  </p>
34
- {% else %}
35
- <p class="source localized">
36
- [SOURCE: {{ localized_term.authoritative_source.ref }}{% if localized_term.authoritative_source.clause %}, {{ localized_term.authoritative_source.clause }}{% endif %}]
37
- </p>
38
- {% endif %}
39
32
  <span class="warning">
40
33
  This translated term may not be from the same source as the normative term.
41
34
  </span>
@@ -16,6 +16,7 @@ require_relative "geolexica/configuration"
16
16
  require_relative "geolexica/concept_page"
17
17
  require_relative "geolexica/concept_serializer"
18
18
  require_relative "geolexica/concepts_generator"
19
+ require_relative "geolexica/filters"
19
20
  require_relative "geolexica/glossary"
20
21
  require_relative "geolexica/hooks"
21
22
  require_relative "geolexica/meta_pages_generator"
@@ -0,0 +1,26 @@
1
+ module Jekyll
2
+ module Geolexica
3
+ module Filters
4
+ # Renders authoritative source hash as HTML.
5
+ #
6
+ # @param input [Hash] authoritative source hash.
7
+ # @return [String]
8
+ #
9
+ # TODO Maybe support string inputs.
10
+ def display_authoritative_source(input)
11
+ ref, clause, link = input.values_at("ref", "clause", "link") rescue nil
12
+
13
+ return "" if ref.nil? && link.nil?
14
+
15
+ ref_caption = escape_once(ref || link)
16
+ ref_part = link ? %[<a href="#{link}">#{ref_caption}</a>] : ref_caption
17
+
18
+ clause_part = clause && escape_once(clause)
19
+
20
+ [ref_part, clause_part].compact.join(", ")
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ Liquid::Template.register_filter(Jekyll::Geolexica::Filters)
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Jekyll
5
5
  module Geolexica
6
- VERSION = "1.5.1".freeze
6
+ VERSION = "1.5.2".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.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -187,6 +187,7 @@ files:
187
187
  - lib/jekyll/geolexica/concept_serializer.rb
188
188
  - lib/jekyll/geolexica/concepts_generator.rb
189
189
  - lib/jekyll/geolexica/configuration.rb
190
+ - lib/jekyll/geolexica/filters.rb
190
191
  - lib/jekyll/geolexica/glossary.rb
191
192
  - lib/jekyll/geolexica/hooks.rb
192
193
  - lib/jekyll/geolexica/meta_pages_generator.rb
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  - !ruby/object:Gem::Version
217
218
  version: '0'
218
219
  requirements: []
219
- rubygems_version: 3.1.2
220
+ rubygems_version: 3.1.4
220
221
  signing_key:
221
222
  specification_version: 4
222
223
  summary: Geolexica plugin for Jekyll