jekyll-rdf 3.1.1.pre.develop.702 → 3.1.1.pre.develop.715
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 +4 -4
- data/lib/jekyll/helper/rdf_hook_helper.rb +92 -0
- data/lib/jekyll/helper/rdf_page_helper.rb +1 -0
- data/lib/jekyll/hooks/rdf_page_pointer.rb +29 -4
- data/lib/jekyll-rdf.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f31e594c1f05d2400c1c8e3bee0db8e84d3fc1d1f9041f50acdcb2991be3ec8
|
4
|
+
data.tar.gz: 99cc0c8baf2ccfa039cf6b7fb152491687a720c428540027fda384ea760ac5da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efbbec3733dc98a1bf4f5917155b03e6f54e74f00ab6f943715c32f3eccfe9a15e1efe9d956beb7e6e8163e4c3f26d1921e07e10c9b20ffe4eda7c8e4a83f543
|
7
|
+
data.tar.gz: b6f9da19b00f142664cf187beab9e3d69de0fa82600607dd9ece509f28a5b62531a0ac706f161eb75603a737a99122174729c5c03834d203bb520297a9c751e1
|
@@ -0,0 +1,92 @@
|
|
1
|
+
##
|
2
|
+
# MIT License
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017 Sebastian Zänker
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
#
|
24
|
+
|
25
|
+
module Jekyll
|
26
|
+
module JekyllRdf
|
27
|
+
module Helper
|
28
|
+
module RdfHookHelper
|
29
|
+
def backload_prefixes page, payload
|
30
|
+
prefix_path = page.data["rdf_prefix_path"]
|
31
|
+
begin
|
32
|
+
if(!prefix_path.nil? && !page.data["rdf_prefix_set?"] && !page.data["layout"].nil?)
|
33
|
+
# rdf_prefix_path is set but not defined through the page
|
34
|
+
base_path = search_prefix_definition page.site.layouts[page.data["layout"]], prefix_path
|
35
|
+
elsif (prefix_path.nil? && !page.data["layout"].nil?)
|
36
|
+
# page might be a post (does not contain values from layout frontmatter)
|
37
|
+
# |->rdf_prefix_path can still be set in a layout
|
38
|
+
locations = check_prefix_definition page.site.layouts[page.data["layout"]]
|
39
|
+
base_path = locations[0]
|
40
|
+
prefix_path = locations[1]
|
41
|
+
elsif(!prefix_path.nil? && page.data["rdf_prefix_set?"])
|
42
|
+
# rdf_prefix_path is set directly in the fronmatter of the page
|
43
|
+
base_path = page.instance_variable_get(:@base_dir)
|
44
|
+
base_path ||= payload.site["source"]
|
45
|
+
end
|
46
|
+
rescue NoMethodError => ne
|
47
|
+
#just in case the error was caused by something different then a missing template
|
48
|
+
if(ne.message.eql? "undefined method `data' for nil:NilClass")
|
49
|
+
return
|
50
|
+
else
|
51
|
+
raise
|
52
|
+
end
|
53
|
+
end
|
54
|
+
if(page.data["rdf_prefixes"].nil? && !(prefix_path.nil? || base_path.nil?))
|
55
|
+
Jekyll::JekyllRdf::Helper::RdfHelper.load_prefixes(
|
56
|
+
File.join(
|
57
|
+
base_path,
|
58
|
+
prefix_path
|
59
|
+
),
|
60
|
+
page.data
|
61
|
+
)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def search_prefix_definition layout, rdf_prefix_path
|
66
|
+
if(rdf_prefix_path.eql? layout.data["rdf_prefix_path"])
|
67
|
+
return layout.instance_variable_get(:@base_dir)
|
68
|
+
end
|
69
|
+
return search_prefix_definition layout.site.layouts[layout.data["layout"]], rdf_prefix_path unless layout.data["layout"].nil?
|
70
|
+
return nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def check_prefix_definition layout
|
74
|
+
unless(layout.data["rdf_prefix_path"].nil?)
|
75
|
+
return [layout.instance_variable_get(:@base_dir), layout.data["rdf_prefix_path"]]
|
76
|
+
end
|
77
|
+
return check_prefix_definition layout.site.layouts[layout.data["layout"]] unless layout.data["layout"].nil?
|
78
|
+
return [nil, nil]
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
class EqualObject
|
83
|
+
def eql? object
|
84
|
+
true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
@@equal_object = EqualObject.new
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -112,6 +112,7 @@ module Jekyll
|
|
112
112
|
|
113
113
|
##
|
114
114
|
# loads the prefix data passed in the layout yaml-frontmatter into page.data["rdf_prefixes"] and page.data["rdf_prefix_map"]
|
115
|
+
# only covers a specific case that can not be done by hooks (rdf_prefix_path is defined in a template that serves as page object)
|
115
116
|
def load_prefixes_yaml
|
116
117
|
unless self.data["rdf_prefix_path"].nil?
|
117
118
|
load_prefixes(File.join(@site.layouts[@template].instance_variable_get(:@base_dir), self.data["rdf_prefix_path"].strip), self.data)
|
@@ -22,14 +22,37 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
#
|
24
24
|
|
25
|
+
Jekyll::Hooks.register :documents, :post_init do |page|
|
26
|
+
if(page.data["rdf_prefix_path"].nil?)
|
27
|
+
page.data["rdf_prefix_set?"] = false
|
28
|
+
else
|
29
|
+
page.data["rdf_prefix_set?"] = true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Jekyll::Hooks.register :pages, :post_init do |page|
|
34
|
+
if(page.data["rdf_prefix_path"].nil?)
|
35
|
+
page.data["rdf_prefix_set?"] = false
|
36
|
+
else
|
37
|
+
page.data["rdf_prefix_set?"] = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Jekyll::Hooks.register :posts, :post_init do |page|
|
42
|
+
if(page.data["rdf_prefix_path"].nil?)
|
43
|
+
page.data["rdf_prefix_set?"] = false
|
44
|
+
else
|
45
|
+
page.data["rdf_prefix_set?"] = true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
25
49
|
|
26
50
|
Jekyll::Hooks.register :pages, :pre_render do |page, payload|
|
27
51
|
unless(page.data['rdf'].nil?)
|
28
52
|
payload["content"] = ""
|
29
53
|
end
|
30
|
-
|
31
|
-
|
32
|
-
end
|
54
|
+
include Jekyll::JekyllRdf::Helper::RdfHookHelper
|
55
|
+
backload_prefixes page, payload if page.data["rdf_prefixes"].nil?
|
33
56
|
Jekyll::JekyllRdf::Helper::RdfHelper::page = page
|
34
57
|
end
|
35
58
|
|
@@ -38,5 +61,7 @@ Jekyll::Hooks.register :documents, :pre_render do |page, payload|
|
|
38
61
|
end
|
39
62
|
|
40
63
|
Jekyll::Hooks.register :posts, :pre_render do |page, payload|
|
64
|
+
include Jekyll::JekyllRdf::Helper::RdfHookHelper
|
65
|
+
backload_prefixes page, payload
|
41
66
|
Jekyll::JekyllRdf::Helper::RdfHelper::page = page
|
42
|
-
end
|
67
|
+
end
|
data/lib/jekyll-rdf.rb
CHANGED
@@ -53,6 +53,7 @@ require 'jekyll/helper/rdf_class_extraction'
|
|
53
53
|
require 'jekyll/helper/rdf_page_helper'
|
54
54
|
require 'jekyll/helper/rdf_generator_helper'
|
55
55
|
require 'jekyll/helper/rdf_filter_helper'
|
56
|
+
require 'jekyll/helper/rdf_hook_helper'
|
56
57
|
require 'jekyll/hooks/rdf_page_pointer'
|
57
58
|
require 'jekyll/filters/rdf_sparql_query'
|
58
59
|
require 'jekyll/filters/rdf_property'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-rdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.1.pre.develop.
|
4
|
+
version: 3.1.1.pre.develop.715
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elias Saalmann
|
@@ -18,7 +18,7 @@ authors:
|
|
18
18
|
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date: 2019-03-
|
21
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: net-http-persistent
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/jekyll/helper/rdf_filter_helper.rb
|
227
227
|
- lib/jekyll/helper/rdf_general_helper.rb
|
228
228
|
- lib/jekyll/helper/rdf_generator_helper.rb
|
229
|
+
- lib/jekyll/helper/rdf_hook_helper.rb
|
229
230
|
- lib/jekyll/helper/rdf_page_helper.rb
|
230
231
|
- lib/jekyll/helper/rdf_prefix_helper.rb
|
231
232
|
- lib/jekyll/helper/rdf_types.rb
|