jekyll-geolexica 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +6 -0
- data/README.adoc +102 -0
- data/_config.yml +88 -0
- data/_data/lang.yaml +96 -0
- data/_includes/_title.html +5 -0
- data/_includes/head.html +48 -0
- data/_includes/localized-concept.html +99 -0
- data/_includes/newsroll-entry.html +17 -0
- data/_includes/page-header.html +31 -0
- data/_includes/resource-tree-item.html +49 -0
- data/_includes/script.html +0 -0
- data/_layouts/base-page.html +7 -0
- data/_layouts/concept.html +154 -0
- data/_layouts/concept.jsonld.html +152 -0
- data/_layouts/concept.ttl.html +83 -0
- data/_layouts/custom-home.html +33 -0
- data/_layouts/custom-post.html +7 -0
- data/_layouts/default.html +176 -0
- data/_layouts/home.html +6 -0
- data/_layouts/page.html +6 -0
- data/_layouts/post.html +13 -0
- data/_layouts/posts.html +10 -0
- data/_layouts/resource-index.html +14 -0
- data/_layouts/resource-page.html +25 -0
- data/_pages/404.adoc +12 -0
- data/_pages/api/rdf-profile.ttl +225 -0
- data/_pages/concepts-index-list.json +24 -0
- data/_pages/concepts-index.json +14 -0
- data/_pages/concepts.adoc +38 -0
- data/_pages/index.adoc +8 -0
- data/_pages/posts.adoc +6 -0
- data/_pages/stats.adoc +18 -0
- data/_pages/stats.json +5 -0
- data/_sass/adoc-markup.scss +197 -0
- data/_sass/concept.scss +171 -0
- data/_sass/concepts.scss +18 -0
- data/_sass/expandable-nav.scss +187 -0
- data/_sass/geolexica_home.scss +174 -0
- data/_sass/home.scss +87 -0
- data/_sass/jekyll-theme-isotc211.scss +146 -0
- data/_sass/legacy-crossbrowser.scss +67 -0
- data/_sass/main.scss +413 -0
- data/_sass/mixins.scss +39 -0
- data/_sass/normalize.scss +424 -0
- data/_sass/offsets.scss +59 -0
- data/_sass/post.scss +16 -0
- data/_sass/posts.scss +18 -0
- data/assets/algolia-search.js +28 -0
- data/assets/js/concept-search-worker.js +103 -0
- data/assets/js/concept-search.js +293 -0
- data/assets/js/ga.js +15 -0
- data/assets/js/nav.js +125 -0
- data/assets/js/resource-browser.js +79 -0
- data/assets/logo-ribose.svg +1 -0
- data/assets/resource-viewer-placeholder.html +11 -0
- data/assets/style.scss +11 -0
- data/babel.config.js +16 -0
- data/browserconfig.xml +12 -0
- data/fonts/MetaWebPro-Normal.woff +0 -0
- data/fonts/MetaWebPro-Thin.woff +0 -0
- data/jekyll-geolexica.gemspec +45 -0
- data/lib/jekyll-geolexica.rb +5 -0
- data/lib/jekyll/geolexica.rb +19 -0
- data/lib/jekyll/geolexica/concept_page.rb +169 -0
- data/lib/jekyll/geolexica/concept_serializer.rb +44 -0
- data/lib/jekyll/geolexica/concepts_generator.rb +64 -0
- data/lib/jekyll/geolexica/configuration.rb +47 -0
- data/lib/jekyll/geolexica/glossary.rb +95 -0
- data/lib/jekyll/geolexica/hooks.rb +33 -0
- data/lib/jekyll/geolexica/meta_pages_generator.rb +58 -0
- data/lib/jekyll/geolexica/version.rb +8 -0
- data/package-lock.json +2921 -0
- data/package.json +10 -0
- metadata +209 -0
data/assets/js/ga.js
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var gaid = document.documentElement.getAttribute('data-gaid');
|
4
|
+
|
5
|
+
if (gaid) {
|
6
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
7
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
8
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
9
|
+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
10
|
+
|
11
|
+
ga('create', gaid, 'auto');
|
12
|
+
ga('send', 'pageview');
|
13
|
+
}
|
14
|
+
|
15
|
+
}());
|
data/assets/js/nav.js
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
// Requires accompanying CSS rules, based on classes on main container
|
4
|
+
// (body) that style header, menu and trigger button.
|
5
|
+
// Container classes used: .with-expandable-nav, .with-expanded-nav
|
6
|
+
|
7
|
+
class NavTrigger {
|
8
|
+
constructor({ triggerTemplateSelector, onTriggerClick }) {
|
9
|
+
this.onTriggerClick = onTriggerClick;
|
10
|
+
this.triggerTemplate = document.querySelector(`${triggerTemplateSelector}`);
|
11
|
+
this.triggerEl = document.importNode(this.triggerTemplate.content, true);
|
12
|
+
}
|
13
|
+
|
14
|
+
render() {
|
15
|
+
const wrapper = this.triggerEl.children[0];
|
16
|
+
wrapper.addEventListener('click', this.onTriggerClick);
|
17
|
+
return wrapper;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
class ExpandableContainer {
|
22
|
+
constructor({
|
23
|
+
containerEl,
|
24
|
+
headerEl,
|
25
|
+
mainEl,
|
26
|
+
footerEl,
|
27
|
+
expandableNavEl, priorityNavEl,
|
28
|
+
expandableHtmlClass, expandedHtmlClass }) {
|
29
|
+
|
30
|
+
this.toggle = this.toggle.bind(this);
|
31
|
+
|
32
|
+
this.expandedHtmlClass = expandedHtmlClass;
|
33
|
+
|
34
|
+
this.containerEl = containerEl;
|
35
|
+
this.headerEl = headerEl;
|
36
|
+
this.mainEl = mainEl;
|
37
|
+
this.footerEl = footerEl;
|
38
|
+
this.expandableNavEl = expandableNavEl;
|
39
|
+
this.priorityNavEl = priorityNavEl;
|
40
|
+
|
41
|
+
this.expandableNavBottomOffset = 20;
|
42
|
+
this.containerEl.classList.add(expandableHtmlClass);
|
43
|
+
|
44
|
+
this.expanded = false;
|
45
|
+
this.animationTimeout = undefined;
|
46
|
+
}
|
47
|
+
|
48
|
+
toggle() {
|
49
|
+
this.expanded = !this.expanded;
|
50
|
+
this.update();
|
51
|
+
}
|
52
|
+
|
53
|
+
update() {
|
54
|
+
if (this.expanded) {
|
55
|
+
window.clearTimeout(this.animationTimeout);
|
56
|
+
|
57
|
+
// Hold main position
|
58
|
+
const mainTopOffset =
|
59
|
+
this.mainEl.getBoundingClientRect().top +
|
60
|
+
document.documentElement.scrollTop -
|
61
|
+
(document.documentElement.clientTop || document.body.clientTop || 0);
|
62
|
+
this.mainEl.style.marginTop = `${mainTopOffset}px`;
|
63
|
+
|
64
|
+
this.containerEl.classList.add(this.expandedHtmlClass);
|
65
|
+
|
66
|
+
const expH = this.expandableNavEl ?
|
67
|
+
this.expandableNavEl.getBoundingClientRect().height :
|
68
|
+
0;
|
69
|
+
|
70
|
+
const prioH = this.priorityNavEl ?
|
71
|
+
this.priorityNavEl.getBoundingClientRect().height :
|
72
|
+
0;
|
73
|
+
|
74
|
+
const heightDifference = expH - prioH + this.expandableNavBottomOffset;
|
75
|
+
|
76
|
+
this.headerEl.style.paddingBottom = `${heightDifference}px`;
|
77
|
+
this.headerEl.style.zIndex = '2';
|
78
|
+
this.headerEl.style.position = 'absolute';
|
79
|
+
this.headerEl.style.top = '0px';
|
80
|
+
this.headerEl.style.left = '0px';
|
81
|
+
this.headerEl.style.right = '0px';
|
82
|
+
|
83
|
+
} else {
|
84
|
+
this.containerEl.classList.remove(this.expandedHtmlClass);
|
85
|
+
this.headerEl.style.removeProperty('padding-bottom');
|
86
|
+
|
87
|
+
window.clearTimeout(this.animationTimeout);
|
88
|
+
|
89
|
+
this.animationTimeout = window.setTimeout(() => {
|
90
|
+
this.mainEl.style.removeProperty('margin-top');
|
91
|
+
this.headerEl.style.removeProperty('z-index');
|
92
|
+
this.headerEl.style.removeProperty('position');
|
93
|
+
}, 1000);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
const body = document.querySelector('body');
|
99
|
+
const headerEl = document.querySelector('body > header');
|
100
|
+
const expandableNavEl = headerEl.querySelector('nav.expandable-nav');
|
101
|
+
const committeeMenuEl = headerEl.querySelector('.committee-widget .committee-menu');
|
102
|
+
|
103
|
+
if (expandableNavEl || committeeMenuEl) {
|
104
|
+
|
105
|
+
const container = new ExpandableContainer({
|
106
|
+
containerEl: body,
|
107
|
+
expandableHtmlClass: 'with-expandable-nav',
|
108
|
+
expandedHtmlClass: 'with-expanded-nav',
|
109
|
+
headerEl: headerEl,
|
110
|
+
footerEl: document.querySelector('body > footer'),
|
111
|
+
mainEl: document.querySelector('body > main'),
|
112
|
+
expandableNavEl: expandableNavEl,
|
113
|
+
priorityNavEl: headerEl.querySelector('nav.priority-nav'),
|
114
|
+
});
|
115
|
+
|
116
|
+
const trigger = new NavTrigger({
|
117
|
+
triggerTemplateSelector: '#expandableNavTrigger',
|
118
|
+
onTriggerClick: container.toggle,
|
119
|
+
});
|
120
|
+
|
121
|
+
headerEl.appendChild(trigger.render());
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
}());
|
@@ -0,0 +1,79 @@
|
|
1
|
+
(function () {
|
2
|
+
var viewer = document.querySelector('.two-pane-viewer');
|
3
|
+
|
4
|
+
if (viewer) {
|
5
|
+
var browser = viewer.querySelector('.browser.bp3-tree');
|
6
|
+
var iframe = viewer.querySelector('.viewer iframe');
|
7
|
+
if (browser && iframe) {
|
8
|
+
|
9
|
+
function selectItem (item) {
|
10
|
+
for (var el of browser.querySelectorAll('a')) {
|
11
|
+
el.classList.remove('selected');
|
12
|
+
}
|
13
|
+
item.classList.add('selected');
|
14
|
+
}
|
15
|
+
|
16
|
+
for (var el of browser.querySelectorAll('.bp3-tree-node-label a')) {
|
17
|
+
el.addEventListener('click', function (evt) {
|
18
|
+
iframe.setAttribute('src', 'about:blank');
|
19
|
+
|
20
|
+
var itemUrl = evt.target.getAttribute('href');
|
21
|
+
// var extension = itemUrl.slice('-1');
|
22
|
+
fetchResource(itemUrl, function () {
|
23
|
+
if (this.responseXML) {
|
24
|
+
try {
|
25
|
+
iframe.setAttribute('src', 'about:blank');
|
26
|
+
iframe.contentWindow.document.open();
|
27
|
+
iframe.contentWindow.document.write(
|
28
|
+
'<pre>' +
|
29
|
+
new Option(prettyPrintXML(this.responseXML)).innerHTML +
|
30
|
+
'</pre>');
|
31
|
+
iframe.contentWindow.document.close();
|
32
|
+
|
33
|
+
} catch (e) {
|
34
|
+
iframe.setAttribute('src', itemUrl);
|
35
|
+
}
|
36
|
+
} else {
|
37
|
+
iframe.setAttribute('src', itemUrl);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
selectItem(evt.target);
|
42
|
+
|
43
|
+
evt.preventDefault();
|
44
|
+
return false;
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
function fetchResource(url, handleResourceResponse) {
|
51
|
+
var oReq = new XMLHttpRequest();
|
52
|
+
oReq.addEventListener("load", handleResourceResponse);
|
53
|
+
oReq.open("GET", url);
|
54
|
+
// oReq.overrideMimeType("text/plain; charset=x-user-defined");
|
55
|
+
oReq.send();
|
56
|
+
}
|
57
|
+
|
58
|
+
function prettyPrintXML(xmlDoc) {
|
59
|
+
var xsltDoc = new DOMParser().parseFromString([
|
60
|
+
// describes how we want to modify the XML - indent everything
|
61
|
+
'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">',
|
62
|
+
' <xsl:strip-space elements="*"/>',
|
63
|
+
' <xsl:template match="para[content-style][not(text())]">', // change to just text() to strip space in text nodes
|
64
|
+
' <xsl:value-of select="normalize-space(.)"/>',
|
65
|
+
' </xsl:template>',
|
66
|
+
' <xsl:template match="node()|@*">',
|
67
|
+
' <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy>',
|
68
|
+
' </xsl:template>',
|
69
|
+
' <xsl:output indent="yes"/>',
|
70
|
+
'</xsl:stylesheet>',
|
71
|
+
].join('\n'), 'application/xml');
|
72
|
+
|
73
|
+
var xsltProcessor = new XSLTProcessor();
|
74
|
+
xsltProcessor.importStylesheet(xsltDoc);
|
75
|
+
var resultDoc = xsltProcessor.transformToDocument(xmlDoc);
|
76
|
+
var resultXml = new XMLSerializer().serializeToString(resultDoc);
|
77
|
+
return resultXml;
|
78
|
+
};
|
79
|
+
}());
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 501"><title>ribose logo normal</title><path d="M180.9,31.3h36.2l18.1,31.3h36.2l18.1,31.3-18.1,31.4,18.1,31.3-18.1,31.3,18.1,31.3-18.1,31.3H235.2l-18.1,31.3,18.1,31.3h36.2l18.1,31.4-18.1,31.3,18.1,31.3-18.1,31.3,18.1,31.3L272.1,501H235.9l-18.8-31.3,18.1-31.3-18.1-31.3,18.1-31.3-18.1-31.3H180.9l-18.1-31.4H126.7l-18.1-31.3H72.4L54.3,313.1l18.1,31.4L54.3,375.8l18.1,31.3L54.3,438.4l18.1,31.3L55,501H18.8L0,469.7l18.1-31.3L0,407.1l18.1-31.3L0,344.5l18.1-31.4L0,281.8l18.1-31.3L0,219.2l18.1-31.3L0,156.6l18.1-31.3L0,93.9,18.1,62.6H54.3L72.4,31.3h36.2L126.7,0h36.1ZM126.7,250.5h36.1l18.1-31.3h36.2l18.1-31.3-18.1-31.3,18.1-31.3L217.1,93.9H180.9L162.8,62.6H126.7L108.6,93.9H72.4L54.3,125.3l18.1,31.3L54.3,187.9l18.1,31.3h36.2Z"/><path d="M470.2,93.9l-18.1,31.4H416L397.9,93.9,416,62.6h36.1Zm0,125.3-18.1,31.3,18.1,31.3-18.1,31.3,18.1,31.4-18.1,31.3,18.1,31.3-18.1,31.3,18.1,31.3L452.8,501H416.7l-18.8-31.3L416,438.4l-18.1-31.3L416,375.8l-18.1-31.3L416,313.1l-18.1-31.3L416,250.5l-18.1-31.3L416,187.9h36.1Z"/><path d="M659.9,31.3,641.8,62.6l18.1,31.3-18.1,31.4,18.1,31.3-18.1,31.3,18.1,31.3h36.2l18.1-31.3h36.2l18.1,31.3h36.2l18.1,31.3h36.1L877,281.8l-18.1,31.3L877,344.5l-18.1,31.3L877,407.1l-18.1,31.3H822.8l-18.1,31.3H768.5L751.1,501H714.9l-18.8-31.3H659.9L642.5,501H606.3l-18.7-31.3,18.1-31.3-18.1-31.3,18.1-31.3-18.1-31.3,18.1-31.4-18.1-31.3,18.1-31.3-18.1-31.3,18.1-31.3-18.1-31.3,18.1-31.3L587.6,93.9l18.1-31.3L587.6,31.3,605.7,0h36.1ZM822.8,375.8l-18.1-31.3,18.1-31.4-18.1-31.3H768.5l-18.1-31.3H714.2l-18.1,31.3H659.9l-18.1,31.3,18.1,31.4-18.1,31.3,18.1,31.3h36.2l18.1,31.3h36.2l18.1-31.3h36.2Z"/><path d="M1034.6,219.2h36.2l18.1-31.3H1125l18.1,31.3h36.2l18.1,31.3h36.2l18.1,31.3-18.1,31.3,18.1,31.4-18.1,31.3,18.1,31.3-18.1,31.3h-36.2l-18.1,31.3h-36.2L1125.7,501h-36.1l-18.8-31.3h-36.2l-18.1-31.3H980.3l-18.1-31.3,18.1-31.3-18.1-31.3,18.1-31.4-18.1-31.3,18.1-31.3h36.2Zm0,125.3-18.1,31.3,18.1,31.3h36.2l18.1,31.3H1125l18.1-31.3h36.2l18.1-31.3-18.1-31.3,18.1-31.4-18.1-31.3h-36.2L1125,250.5h-36.1l-18.1,31.3h-36.2l-18.1,31.3Z"/><path d="M1408,219.2h36.2l18.1-31.3h36.2l18.1,31.3h36.2l18.1,31.3h36.2l18,31.3-18,31.3h-36.2l-18.1-31.3h-36.2l-18.1-31.3h-36.2l-18.1,31.3,18.1,31.3h36.2l18.1,31.4h36.2l18.1,31.3h36.2l18,31.3-18,31.3h-36.2l-18.1,31.3h-36.2L1499.2,501H1463l-18.8-31.3H1408l-18.1-31.3h-36.2l-18-31.3,18-31.3h36.2l18.1,31.3h36.2l18.1,31.3h36.2l18.1-31.3-18.1-31.3h-36.2l-18.1-31.3H1408l-18.1-31.4h-36.2l-18-31.3,18-31.3h36.2Z"/><path d="M1782.9,219.2h36.2l18.1-31.3h36.2l18,31.3h36.2l18.1,31.3h36.2l18.1,31.3-18.1,31.3h-36.2l-18.1,31.4h-36.2l-18,31.3h-36.2l-18.1-31.3,18.1-31.4h36.2l18-31.3-18-31.3h-36.2l-18.1,31.3h-36.2l-18.1,31.3,18.1,31.4-18.1,31.3,18.1,31.3h36.2l18.1,31.3h36.2l18-31.3h36.2l18.1-31.3h36.2l18.1,31.3-18.1,31.3h-36.2l-18.1,31.3h-36.2L1874.1,501h-36.2l-18.8-31.3h-36.2l-18.1-31.3h-36.2l-18.1-31.3,18.1-31.3-18.1-31.3,18.1-31.4-18.1-31.3,18.1-31.3h36.2Z"/></svg>
|
data/assets/style.scss
ADDED
data/babel.config.js
ADDED
data/browserconfig.xml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<browserconfig>
|
3
|
+
<msapplication>
|
4
|
+
<tile>
|
5
|
+
<square70x70logo src="images/mstile-70x70.png"/>
|
6
|
+
<square150x150logo src="images/mstile-150x150.png"/>
|
7
|
+
<square310x310logo src="images/mstile-310x310.png"/>
|
8
|
+
<wide310x150logo src="images/mstile-310x150.png"/>
|
9
|
+
<TileColor>#ffffff</TileColor>
|
10
|
+
</tile>
|
11
|
+
</msapplication>
|
12
|
+
</browserconfig>
|
Binary file
|
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# (c) Copyright 2020 Ribose Inc.
|
2
|
+
#
|
3
|
+
|
4
|
+
require_relative "lib/jekyll/geolexica/version"
|
5
|
+
|
6
|
+
all_files_in_git = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
7
|
+
|
8
|
+
ribose_url = "https://open.ribose.com/"
|
9
|
+
github_url = "https://github.com/geolexica/geolexica-server"
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = "jekyll-geolexica"
|
13
|
+
spec.version = Jekyll::Geolexica::VERSION
|
14
|
+
spec.authors = ["Ribose Inc."]
|
15
|
+
spec.email = ["open.source@ribose.com"]
|
16
|
+
|
17
|
+
spec.summary = "Geolexica plugin for Jekyll"
|
18
|
+
spec.homepage = ribose_url
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.metadata = {
|
22
|
+
"bug_tracker_uri" => (github_url + "/issues"),
|
23
|
+
"homepage_uri" => ribose_url,
|
24
|
+
"source_code_uri" => github_url,
|
25
|
+
}
|
26
|
+
|
27
|
+
spec.files = all_files_in_git.reject do |f|
|
28
|
+
[
|
29
|
+
f.match(%r{^(test|spec|features|.github)/}),
|
30
|
+
f.match(%r{^\.}),
|
31
|
+
].any?
|
32
|
+
end
|
33
|
+
|
34
|
+
spec.bindir = "exe"
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
spec.add_runtime_dependency "jekyll", ">= 3.8.5", "< 4.1"
|
39
|
+
spec.add_runtime_dependency "jekyll-asciidoc"
|
40
|
+
|
41
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
42
|
+
spec.add_development_dependency "pry"
|
43
|
+
spec.add_development_dependency "rake", ">= 10"
|
44
|
+
spec.add_development_dependency "rspec", "~> 3.9"
|
45
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# The Jekyll convention is to use kebab-case in gem names only, even though
|
2
|
+
# it conflicts with Ruby conventions. This file is meant to bridge those
|
3
|
+
# two conventions together, otherwise this plugin won't work if loaded
|
4
|
+
# via _config.yml.
|
5
|
+
require "jekyll/geolexica"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# (c) Copyright 2020 Ribose Inc.
|
2
|
+
#
|
3
|
+
|
4
|
+
require "jekyll"
|
5
|
+
|
6
|
+
module Jekyll
|
7
|
+
module Geolexica
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require_relative "geolexica/configuration"
|
12
|
+
require_relative "geolexica/concept_page"
|
13
|
+
require_relative "geolexica/concept_serializer"
|
14
|
+
require_relative "geolexica/concepts_generator"
|
15
|
+
require_relative "geolexica/glossary"
|
16
|
+
require_relative "geolexica/hooks"
|
17
|
+
require_relative "geolexica/meta_pages_generator"
|
18
|
+
|
19
|
+
Jekyll::Geolexica::Hooks.register_all_hooks
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# (c) Copyright 2020 Ribose Inc.
|
2
|
+
#
|
3
|
+
|
4
|
+
module Jekyll
|
5
|
+
module Geolexica
|
6
|
+
class ConceptPage < PageWithoutAFile
|
7
|
+
attr_reader :concept
|
8
|
+
|
9
|
+
def initialize(site, concept)
|
10
|
+
@concept = concept
|
11
|
+
@data = default_data.merge(concept.data)
|
12
|
+
|
13
|
+
super(site, site.source, "concepts", page_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def termid
|
17
|
+
concept.termid
|
18
|
+
end
|
19
|
+
|
20
|
+
def type
|
21
|
+
self.collection_name.to_sym
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def default_data
|
27
|
+
{
|
28
|
+
"layout" => layout,
|
29
|
+
"permalink" => permalink,
|
30
|
+
"representations" => concept.pages,
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Disables Liquid processing for given content.
|
35
|
+
#
|
36
|
+
# FIXME Still may break if +content+ contains the "{% endraw %}" sequence,
|
37
|
+
# which is very unlikely as we work with trusted input.
|
38
|
+
# Preferred solution is to make the whole page a non-Liquid file,
|
39
|
+
# or mark as already processed, or something, but it is unclear how
|
40
|
+
# to achieve that.
|
41
|
+
def escape_liquid(content)
|
42
|
+
[
|
43
|
+
"{\% raw \%}",
|
44
|
+
content,
|
45
|
+
"{\% endraw \%}",
|
46
|
+
].join("")
|
47
|
+
end
|
48
|
+
|
49
|
+
class HTML < ConceptPage
|
50
|
+
def page_name
|
51
|
+
"#{termid}.html"
|
52
|
+
end
|
53
|
+
|
54
|
+
def collection_name
|
55
|
+
"concepts"
|
56
|
+
end
|
57
|
+
|
58
|
+
def layout
|
59
|
+
"concept"
|
60
|
+
end
|
61
|
+
|
62
|
+
def permalink
|
63
|
+
"/concepts/#{termid}/"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class JSON < ConceptPage
|
68
|
+
def page_name
|
69
|
+
"#{termid}.json"
|
70
|
+
end
|
71
|
+
|
72
|
+
def collection_name
|
73
|
+
"concepts_json"
|
74
|
+
end
|
75
|
+
|
76
|
+
def layout
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
|
80
|
+
def content
|
81
|
+
s = ConceptSerializer.new(concept, site)
|
82
|
+
escape_liquid(s.to_json)
|
83
|
+
end
|
84
|
+
|
85
|
+
def permalink
|
86
|
+
"/api/concepts/#{termid}.json"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class JSONLD < ConceptPage
|
91
|
+
def page_name
|
92
|
+
"#{termid}.jsonld"
|
93
|
+
end
|
94
|
+
|
95
|
+
def collection_name
|
96
|
+
"concepts_jsonld"
|
97
|
+
end
|
98
|
+
|
99
|
+
def layout
|
100
|
+
"concept.jsonld"
|
101
|
+
end
|
102
|
+
|
103
|
+
def permalink
|
104
|
+
"/api/concepts/#{termid}.jsonld"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class Turtle < ConceptPage
|
109
|
+
def page_name
|
110
|
+
"#{termid}.ttl"
|
111
|
+
end
|
112
|
+
|
113
|
+
def collection_name
|
114
|
+
"concepts_ttl"
|
115
|
+
end
|
116
|
+
|
117
|
+
def layout
|
118
|
+
"concept.ttl"
|
119
|
+
end
|
120
|
+
|
121
|
+
def permalink
|
122
|
+
"/api/concepts/#{termid}.ttl"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class TBX < ConceptPage
|
127
|
+
def page_name
|
128
|
+
"#{termid}.tbx.xml"
|
129
|
+
end
|
130
|
+
|
131
|
+
def collection_name
|
132
|
+
"concepts_tbx"
|
133
|
+
end
|
134
|
+
|
135
|
+
def layout
|
136
|
+
"concept.tbx.xml"
|
137
|
+
end
|
138
|
+
|
139
|
+
def permalink
|
140
|
+
"/api/concepts/#{termid}.tbx.xml"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class YAML < ConceptPage
|
145
|
+
def page_name
|
146
|
+
"#{termid}.yaml"
|
147
|
+
end
|
148
|
+
|
149
|
+
def collection_name
|
150
|
+
"concepts_yaml"
|
151
|
+
end
|
152
|
+
|
153
|
+
def layout
|
154
|
+
nil
|
155
|
+
end
|
156
|
+
|
157
|
+
def content
|
158
|
+
s = ConceptSerializer.new(concept, site)
|
159
|
+
escape_liquid(s.to_yaml)
|
160
|
+
end
|
161
|
+
|
162
|
+
def permalink
|
163
|
+
"/api/concepts/#{termid}.yaml"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|