jekyll-geolexica 1.4.1 → 1.5.0

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: f4af820f6b04bb909021588008cdedd298324f13aa4f4b1c50239cf372dd78dd
4
- data.tar.gz: 4f3d6cb5bae735a523a1be7364810f870ff249efc90beca1c925ad9fed7e4ebf
3
+ metadata.gz: 9061ca7ab8416d7410b611eef734939fbd9e4a19ba834b197130a7200f7739b7
4
+ data.tar.gz: ce890669ec7bd794ee4c9f48c40088dd1d0ca550568279bbc8bbdb6ad8b60b8b
5
5
  SHA512:
6
- metadata.gz: f5911a94c4790a8861b5b839c5e1769a3f2bed8f4244b59a41b92c687b1a92eedc6f9a596b8ce2ce4132b4e1530c3f3571e023a97871790557f6c6b3845948f9
7
- data.tar.gz: 0be54b8eb39d76d78ac760aaa53c1b8d6075446dfb8f5a83d01acff2ebfb99fc0aff7d39ddf8ce4fc11200202aa6023a9377969c5738f7bed3124c90359fe957
6
+ metadata.gz: 85a90a13c2b61627fcf570dcbc462e428e0205059ef8d5d2dd76ad0bb018f176d03735e14fe5d572ce9cc8e972229ce9ea1cc7bd231950d19fec9ea5911cbcb3
7
+ data.tar.gz: 03de01f7b8f0e267e24e9017734189b3314a8fe7f4c4d87dacefdbc48f90bcba7478a494203a5008a0d3516473c240fe1c10e547029438acf2abed55c1c8bb74
@@ -1,11 +1,15 @@
1
1
  ---
2
- permalink: "/api/concepts-index-list.json"
2
+ permalink: "/api/concept-search-index.json"
3
3
  ---
4
4
  [
5
5
  {% for concept in site.concepts %}
6
6
  {
7
- "termid": {{ concept.termid }},
7
+ "termid": {{ concept.termid | jsonify }},
8
8
  "term": {{ concept.eng.terms.first.designation | jsonify }},
9
+ "term_url": {{ concept.url | jsonify }},
10
+ "sort_order": {
11
+ "natural": {{ forloop.index }}
12
+ },
9
13
 
10
14
  {% assign english_concept = concept["eng"] %}
11
15
  {% for lang in site.geolexica.term_languages %}
@@ -13,6 +17,7 @@ permalink: "/api/concepts-index-list.json"
13
17
  "{{ lang }}": {% if concept[lang] %}{
14
18
  "term": {{ concept[lang].terms.first.designation | jsonify }},
15
19
  "id": {{ concept[lang].id | jsonify }},
20
+ "term_url": {{ concept.url | append: "#entry-lang-" | append: lang | jsonify }},
16
21
  "entry_status": {{ english_concept.entry_status | jsonify }},
17
22
  "language_code": {{ concept[lang].language_code | jsonify }},
18
23
  "review_decision": {{ english_concept.review_decision | jsonify }}
@@ -1,21 +1,16 @@
1
+ ---
2
+ ---
1
3
  importScripts('/assets/js/babel-polyfill.js');
2
4
 
3
- const CONCEPTS_URL = '/api/concepts-index-list.json';
5
+ const CONCEPTS_URL = '/api/concept-search-index.json';
4
6
 
5
- const LANGUAGES = [
6
- 'eng',
7
- 'ara',
8
- 'spa',
9
- 'swe',
10
- 'kor',
11
- 'rus',
12
- 'ger',
13
- 'fre',
14
- 'fin',
15
- 'jpn',
16
- 'dan',
17
- 'chi',
18
- ];
7
+ /** For example:
8
+ * const LANGUAGES = [ 'eng', 'deu' ];
9
+ * Having a wrapper function helps not to break syntax highlight.
10
+ */
11
+ const LANGUAGES = (function() {
12
+ return {{ site.geolexica.term_languages | jsonify }} || [];
13
+ })();
19
14
 
20
15
  var concepts = null;
21
16
  var latestQuery = null;
@@ -39,7 +34,7 @@ async function filterAndSort(params) {
39
34
  const matchingLanguages = LANGUAGES.
40
35
  filter((lang) => {
41
36
  const term = (item[lang] || {}).term;
42
- return term && term.toLowerCase().indexOf(params.string) >= 0;
37
+ return term && term.toLowerCase().indexOf(queryString) >= 0;
43
38
  });
44
39
 
45
40
  if (matchingLanguages.length > 0) {
@@ -77,7 +72,7 @@ async function filterAndSort(params) {
77
72
  });
78
73
  }
79
74
 
80
- return concepts.sort((item1, item2) => item1.termid - item2.termid);
75
+ return concepts.sort((item1, item2) => item1.sort_order.natural - item2.sort_order.natural);
81
76
  }
82
77
 
83
78
  onmessage = async function(msg) {
@@ -1,22 +1,24 @@
1
+ ---
2
+ ---
1
3
  (function () {
2
4
 
3
5
  const searchWorker = new Worker('/assets/js/concept-search-worker.js');
4
6
 
5
- // TODO: Move to a shared module
6
- const LANGUAGES = [
7
- 'eng',
8
- 'ara',
9
- 'spa',
10
- 'swe',
11
- 'kor',
12
- 'rus',
13
- 'ger',
14
- 'fre',
15
- 'fin',
16
- 'jpn',
17
- 'dan',
18
- 'chi',
19
- ];
7
+ /** For example:
8
+ * const LANGUAGES = [ 'eng', 'deu' ];
9
+ * Having a wrapper function helps not to break syntax highlight.
10
+ */
11
+ const LANGUAGES = (function() {
12
+ return {{ site.geolexica.term_languages | jsonify }} || [];
13
+ })();
14
+
15
+ /** For example:
16
+ * const SEARCH_REFINEMENTS = [ 'validity' ];
17
+ * Having a wrapper function helps not to break syntax highlight.
18
+ */
19
+ const SEARCH_REFINEMENTS = (function() {
20
+ return {{ site.geolexica.search.refinements | jsonify }} || [];
21
+ })();
20
22
 
21
23
 
22
24
  // React-based concept browser
@@ -57,7 +59,7 @@
57
59
  this.stringInputRef = React.createRef();
58
60
 
59
61
  this.state = {
60
- valid: 'valid', // Required value of the entry_status field, or undefined
62
+ valid: SEARCH_REFINEMENTS.indexOf('validity') >= 0 ? 'valid' : undefined, // Required value of the entry_status field, or undefined
61
63
  string: '',
62
64
  };
63
65
  }
@@ -75,10 +77,10 @@
75
77
  onChange: this.handleSearchStringChange}),
76
78
  ];
77
79
 
78
- if (this.state.string.length > 1 && (this.props.refineControls || []).length > 0) {
80
+ if (this.state.string.length > 1 && (SEARCH_REFINEMENTS).length > 0) {
79
81
  var refineControls = [];
80
82
 
81
- if (this.props.refineControls.indexOf('validity') >= 0) {
83
+ if (SEARCH_REFINEMENTS.indexOf('validity') >= 0) {
82
84
  refineControls.push(
83
85
  el('div', { key: 'validity', className: 'validity' }, [
84
86
  el('input', {
@@ -218,7 +220,7 @@
218
220
  el('div', { key: 'search-controls', className: 'search-controls' },
219
221
  el(SearchControls, {
220
222
  onSearchChange: this.handleSearchQuery,
221
- refineControls: ['validity'],
223
+ refineControls: SEARCH_REFINEMENTS,
222
224
  })
223
225
  ),
224
226
  ];
@@ -265,13 +267,7 @@
265
267
  ReactDOM.render(el(ConceptBrowser, null), document.querySelector('.browse-concepts'))
266
268
 
267
269
  function getConceptPermalink(concept) {
268
- if (concept.termid) {
269
- return `/concepts/${concept.termid}/`;
270
- } else if (concept.id && concept.language_code) {
271
- return `/concepts/${concept.id}/#entry-lang-${concept.language_code}`;
272
- } else {
273
- return null;
274
- }
270
+ return concept.term_url;
275
271
  }
276
272
 
277
273
  function updateBodyClass({ searchQuery, expanded }) {
@@ -5,6 +5,10 @@ require "jekyll"
5
5
 
6
6
  module Jekyll
7
7
  module Geolexica
8
+ def self.load_tasks
9
+ tasks_path = File.expand_path("../tasks", __dir__)
10
+ Rake.add_rakelib(tasks_path)
11
+ end
8
12
  end
9
13
  end
10
14
 
@@ -44,7 +44,7 @@ module Jekyll
44
44
  end
45
45
 
46
46
  def sort_pages
47
- generated_pages.sort_by! { |p| p.termid.to_s }
47
+ generated_pages.sort_by! { |p| p.termid }
48
48
  end
49
49
 
50
50
  def initialize_collections
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Jekyll
5
5
  module Geolexica
6
- VERSION = "1.4.1".freeze
6
+ VERSION = "1.5.0".freeze
7
7
  end
8
8
  end
@@ -0,0 +1,41 @@
1
+ namespace :geolexica do
2
+
3
+ desc "Deploy site to S3"
4
+ task :s3_deploy do
5
+ s3sync_patterns_and_options = {
6
+ "*.html" => ["--content-type", "text/html; charset=utf-8"],
7
+ "*.json" => ["--content-type", "application/json; charset=utf-8"],
8
+ "*.jsonld" => ["--content-type", "application/ld+json; charset=utf-8"],
9
+ "*.tbx.xml" => ["--content-type", "application/xml; charset=utf-8"],
10
+ "*.ttl" => ["--content-type", "text/turtle; charset=utf-8"],
11
+ "*.yaml" => ["--content-type", "text/yaml; charset=utf-8"],
12
+ }
13
+
14
+ s3sync_patterns_and_options.each_pair do |pattern, options|
15
+ s3_sync "--exclude", "*", "--include", pattern, *options
16
+ end
17
+
18
+ # Remaining files
19
+ remaining_patterns = s3sync_patterns_and_options.keys
20
+ s3_sync "--include", "*", *remaining_patterns.flat_map { |k| ["--exclude", k] }
21
+
22
+ aws "configure", "set", "preview.cloudfront", "true"
23
+
24
+ aws "cloudfront", "create-invalidation",
25
+ "--distribution-id", ENV["CLOUDFRONT_DISTRIBUTION_ID"],
26
+ "--paths", "/*"
27
+ end
28
+
29
+ def s3_sync(*args)
30
+ source = "_site"
31
+ target = "s3://#{ENV["S3_BUCKET_NAME"]}"
32
+ common_options = ["--region", ENV["AWS_REGION"], "--delete", "--no-progress"]
33
+
34
+ aws "s3", "sync", source, target, *common_options, *args
35
+ end
36
+
37
+ def aws(*args)
38
+ system "aws", *args, exception: true
39
+ end
40
+
41
+ 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.4.1
4
+ version: 1.5.0
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-07-20 00:00:00.000000000 Z
11
+ date: 2020-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -148,7 +148,7 @@ files:
148
148
  - _layouts/resource-page.html
149
149
  - _pages/404.adoc
150
150
  - _pages/api/rdf-profile.ttl
151
- - _pages/concepts-index-list.json
151
+ - _pages/concept-search-index.json
152
152
  - _pages/concepts-index.json
153
153
  - _pages/concepts.adoc
154
154
  - _pages/index.adoc
@@ -190,6 +190,7 @@ files:
190
190
  - lib/jekyll/geolexica/hooks.rb
191
191
  - lib/jekyll/geolexica/meta_pages_generator.rb
192
192
  - lib/jekyll/geolexica/version.rb
193
+ - lib/tasks/deploy.rake
193
194
  - package-lock.json
194
195
  - package.json
195
196
  homepage: https://open.ribose.com/