jekyll-open-sdg-plugins 1.0.0.rc13 → 1.0.0.rc14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec6a82fc746845dce8607f5828fc220a00cf4ba028d46abba039e73b76b28bb0
4
- data.tar.gz: 4568e2076c2204fd8e0198e705a73a900b22e390faa18a215315ddceeee9a566
3
+ metadata.gz: 59d6f3eaabd828643b02677cb134b0bcab05de421949403016d627e818c1475b
4
+ data.tar.gz: 3954c2d68019bd52efde4a9416b19fb150f6506bcd6ec9593f6985c2ff228239
5
5
  SHA512:
6
- metadata.gz: f42b5609bdc5adfdb846ec7be9e263ad1d7225ca17ccdb52699e13809a633c6025afb7cf1c0fd99d5c455107f9c65ff14fe3835639942b5a954e3490951c774d
7
- data.tar.gz: 5906c9596f21a0e3c2613f80b730b00c3637cd54af49ad862a43aeb67b04ace9efee0f901a7b8cddba9616820ef7ea3145622a23ebbb07f42d788a871cc74546
6
+ metadata.gz: b614025cb47c5282a3aaae79d53c263db3c06b075501774e80f2712c58a6f9c3319b896ed46ca081bdd3cc39af24152f9129bb382c8278836125c61bcac62d65
7
+ data.tar.gz: b9793d65fbf4cdff3478666159378f71f04a1e8339d8c84a6be8b668f222612aea227cc93163345d09223ab38c74e99953cbf4f1876291886b4d739c3b3848aa
@@ -8,6 +8,16 @@ module JekyllOpenSdgPlugins
8
8
  # NOTE: This must be executed **after** the sdg_variables.rb file, since it
9
9
  # relies heavily on the variables created there.
10
10
 
11
+ # Helper function to prepare content for the search index.
12
+ def prepare_content(site, content)
13
+ # First compile any Markdown.
14
+ converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
15
+ content = converter.convert(content)
16
+ # Now strip any HTML.
17
+ content = content.gsub(/<\/?[^>]*>/, "")
18
+ return content
19
+ end
20
+
11
21
  def generate(site)
12
22
 
13
23
  # Generate a hash of items to include in the search index.
@@ -34,14 +44,14 @@ module JekyllOpenSdgPlugins
34
44
  # For the title, use the indicator name.
35
45
  item['title'] = doc.data['indicator']['name']
36
46
  # For the content, use the 'page_content' field.
37
- item['content'] = doc.data['indicator']['page_content']
47
+ item['content'] = prepare_content(site, doc.data['indicator']['page_content'])
38
48
  # For the hidden field, use the ID number.
39
49
  item['hidden'] = doc.data['indicator']['number']
40
50
  # Also index any additional metadata fields.
41
51
  if site.config['search_index_extra_fields']
42
52
  site.config['search_index_extra_fields'].each do |field|
43
53
  if doc.data['indicator'].has_key? field
44
- item['hidden'] += ' ' + doc.data['indicator'][field]
54
+ item['hidden'] += ' ' + prepare_content(site, doc.data['indicator'][field])
45
55
  end
46
56
  end
47
57
  end
@@ -59,7 +69,7 @@ module JekyllOpenSdgPlugins
59
69
  # Otherwise assume it is a normal Jekyll document.
60
70
  item['url'] = doc.url
61
71
  item['title'] = doc.data['title']
62
- item['content'] = doc.content
72
+ item['content'] = prepare_content(site, doc.content)
63
73
  item['hidden'] = ''
64
74
  end
65
75
 
@@ -1,3 +1,3 @@
1
1
  module JekyllOpenSdgPlugins
2
- VERSION = "1.0.0.rc13".freeze
2
+ VERSION = "1.0.0.rc14".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-open-sdg-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc13
4
+ version: 1.0.0.rc14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brock Fanning
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-12 00:00:00.000000000 Z
11
+ date: 2020-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: 1.3.1
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.7.1
84
+ rubygems_version: 2.7.6
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Jekyll plugins for use with the Open SDG platform