jekyll-rdf 3.0.0.pre.develop.334 → 3.0.0.pre.develop.343
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-rdf.rb +5 -3
- data/lib/jekyll/drops/rdf_literal.rb +12 -10
- data/lib/jekyll/drops/rdf_resource.rb +213 -210
- data/lib/jekyll/drops/rdf_resource_class.rb +47 -45
- data/lib/jekyll/drops/rdf_statement.rb +32 -30
- data/lib/jekyll/drops/rdf_term.rb +67 -64
- data/lib/jekyll/filters/rdf_collection.rb +13 -14
- data/lib/jekyll/filters/rdf_container.rb +26 -26
- data/lib/jekyll/filters/rdf_get.rb +13 -13
- data/lib/jekyll/filters/rdf_property.rb +75 -76
- data/lib/jekyll/filters/rdf_resolve_prefix.rb +18 -16
- data/lib/jekyll/filters/rdf_sparql_query.rb +41 -42
- data/lib/jekyll/helper/rdf_class_extraction.rb +51 -0
- data/lib/jekyll/helper/rdf_general_helper.rb +26 -22
- data/lib/jekyll/helper/rdf_generator_helper.rb +124 -0
- data/lib/jekyll/helper/rdf_page_helper.rb +59 -0
- data/lib/jekyll/hooks/rdf_page_pointer.rb +1 -1
- data/lib/jekyll/rdf_main_generator.rb +3 -3
- data/lib/jekyll/rdf_page_data.rb +1 -1
- data/lib/jekyll/rdf_template_mapper.rb +1 -1
- metadata +6 -6
- data/lib/jekyll/rdf_class_extraction.rb +0 -47
- data/lib/jekyll/rdf_generator_helper.rb +0 -120
- data/lib/jekyll/rdf_page_helper.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9255ac5d8912fd3200919a85fa010e84ea40ba9b8c47e8fcca1ad66788387ed
|
4
|
+
data.tar.gz: 5a8c256c0d62129f3ec4cafa6fca75abb207660a29ace1b8e60825d4aa22b8a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cd76f82301aa6628f57b5787b5f5b0ca1cdacf4ae5f3e1277e9526b80a0a05e5206e6d8e60311e48cc8f3738ce225981817695c42ae1aa09033eb0909f1359c
|
7
|
+
data.tar.gz: fca2156b0169d18b5e9ce248b145cc8deec6eb52357937d70ed6924f9f604ee491997badf2d52d73128376c1d5acb8e490a28464d556a70e7f4f5f2ed1bffd47
|
data/lib/jekyll-rdf.rb
CHANGED
@@ -42,6 +42,9 @@ require 'jekyll/exceptions/NoPrefixMapped'
|
|
42
42
|
require 'jekyll/exceptions/NoPrefixesDefined'
|
43
43
|
require 'jekyll/exceptions/UnMarkedUri'
|
44
44
|
require 'jekyll/helper/rdf_general_helper'
|
45
|
+
require 'jekyll/helper/rdf_class_extraction'
|
46
|
+
require 'jekyll/helper/rdf_page_helper'
|
47
|
+
require 'jekyll/helper/rdf_generator_helper'
|
45
48
|
require 'jekyll/hooks/rdf_page_pointer'
|
46
49
|
require 'jekyll/filters/rdf_resolve_prefix'
|
47
50
|
require 'jekyll/filters/rdf_sparql_query'
|
@@ -49,9 +52,8 @@ require 'jekyll/filters/rdf_property'
|
|
49
52
|
require 'jekyll/filters/rdf_collection'
|
50
53
|
require 'jekyll/filters/rdf_container'
|
51
54
|
require 'jekyll/filters/rdf_get'
|
52
|
-
|
55
|
+
|
56
|
+
Liquid::Template.register_filter(Jekyll::JekyllRdf::Filter)
|
53
57
|
require 'jekyll/rdf_main_generator'
|
54
|
-
require 'jekyll/rdf_page_helper'
|
55
58
|
require 'jekyll/rdf_page_data'
|
56
|
-
require 'jekyll/rdf_class_extraction'
|
57
59
|
require 'jekyll/rdf_template_mapper'
|
@@ -24,20 +24,22 @@
|
|
24
24
|
#
|
25
25
|
|
26
26
|
module Jekyll
|
27
|
-
module
|
28
|
-
|
29
|
-
##
|
30
|
-
# Represents an RDF literal to the Liquid template engine
|
31
|
-
#
|
32
|
-
class RdfLiteral < RdfTerm
|
27
|
+
module JekyllRdf
|
28
|
+
module Drops
|
33
29
|
|
34
30
|
##
|
35
|
-
#
|
31
|
+
# Represents an RDF literal to the Liquid template engine
|
36
32
|
#
|
37
|
-
|
38
|
-
term.to_s
|
39
|
-
end
|
33
|
+
class RdfLiteral < RdfTerm
|
40
34
|
|
35
|
+
##
|
36
|
+
# Return a user-facing string representing this RdfLiteral
|
37
|
+
#
|
38
|
+
def literal
|
39
|
+
term.to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -24,275 +24,278 @@
|
|
24
24
|
#
|
25
25
|
|
26
26
|
module Jekyll #:nodoc:
|
27
|
-
module
|
28
|
-
|
29
|
-
##
|
30
|
-
# Represents an RDF resource to the Liquid template engine
|
31
|
-
#
|
32
|
-
class RdfResource < RdfTerm
|
27
|
+
module JekyllRdf #:nodoc:
|
28
|
+
module Drops #:nodoc:
|
33
29
|
|
34
30
|
##
|
35
|
-
#
|
31
|
+
# Represents an RDF resource to the Liquid template engine
|
36
32
|
#
|
37
|
-
|
33
|
+
class RdfResource < RdfTerm
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
##
|
36
|
+
# The Jekyll::Site of this Jekyll::JekyllRdf::Drops::RdfResource
|
37
|
+
#
|
38
|
+
attr_accessor :site
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
40
|
+
##
|
41
|
+
# The Jekyll::RdfPageData of this Jekyll::JekyllRdf::Drops::RdfResource
|
42
|
+
#
|
43
|
+
attr_accessor :page
|
48
44
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
##
|
46
|
+
#
|
47
|
+
#
|
48
|
+
attr_reader :covered
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
super(term)
|
59
|
-
if(site.is_a?(Jekyll::Site))
|
60
|
-
@site = site
|
61
|
-
end
|
62
|
-
if(page.is_a?(Jekyll::Page))
|
63
|
-
@page = page
|
64
|
-
end
|
65
|
-
@subResources = {}
|
66
|
-
@covered = covered
|
67
|
-
end
|
50
|
+
##
|
51
|
+
#
|
52
|
+
#
|
53
|
+
attr_accessor :subResources
|
68
54
|
|
69
|
-
|
70
|
-
|
71
|
-
|
55
|
+
##
|
56
|
+
#
|
57
|
+
#
|
58
|
+
def initialize(term, site = nil, page = nil, covered = false)
|
59
|
+
super(term)
|
60
|
+
if(site.is_a?(Jekyll::Site))
|
61
|
+
@site = site
|
62
|
+
end
|
63
|
+
if(page.is_a?(Jekyll::Page))
|
64
|
+
@page = page
|
65
|
+
end
|
66
|
+
@subResources = {}
|
67
|
+
@covered = covered
|
72
68
|
end
|
73
|
-
|
74
|
-
|
69
|
+
|
70
|
+
def add_necessities(site, page)
|
71
|
+
if(site.is_a?(Jekyll::Site))
|
72
|
+
@site ||= site
|
73
|
+
end
|
74
|
+
if(page.is_a?(Jekyll::Page))
|
75
|
+
@page ||= page
|
76
|
+
end
|
77
|
+
return self
|
75
78
|
end
|
76
|
-
return self
|
77
|
-
end
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
|
80
|
+
def ready?
|
81
|
+
return (@site.is_a?(Jekyll::Site)||@page.is_a?(Jekyll::Page))
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
84
|
+
##
|
85
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose subject, predicate or object is the RDF resource represented by the receiver
|
86
|
+
#
|
87
|
+
def statements
|
88
|
+
@statements ||= statements_as_subject + statements_as_predicate + statements_as_object
|
89
|
+
end
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
91
|
+
##
|
92
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose subject is the RDF resource represented by the receiver
|
93
|
+
#
|
94
|
+
def statements_as_subject
|
95
|
+
@statements_as_subject ||= statements_as :subject
|
96
|
+
end
|
96
97
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
##
|
99
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose predicate is the RDF resource represented by the receiver
|
100
|
+
#
|
101
|
+
def statements_as_predicate
|
102
|
+
@statements_as_predicate ||= statements_as :predicate
|
103
|
+
end
|
103
104
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
##
|
106
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose object is the RDF resource represented by the receiver
|
107
|
+
#
|
108
|
+
def statements_as_object
|
109
|
+
@statements_as_object ||= statements_as :object
|
110
|
+
end
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
112
|
+
##
|
113
|
+
# Return a filename corresponding to the RDF resource represented by the receiver. The mapping between RDF resources and filenames should be bijective.
|
114
|
+
#
|
115
|
+
def filename(domain_name, baseurl)
|
116
|
+
@filename ||= generate_file_name(domain_name, baseurl)
|
117
|
+
end
|
117
118
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
119
|
+
def direct_classes
|
120
|
+
@direct_classes ||= begin
|
121
|
+
classes=[]
|
122
|
+
selection = statements_as(:subject).select{ |s| s.predicate.term.to_s=="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }
|
123
|
+
unless selection.empty?
|
124
|
+
selection.each{|s| classes << s.object.term.to_s}
|
125
|
+
end
|
126
|
+
classes.uniq!
|
127
|
+
classes
|
124
128
|
end
|
125
|
-
classes.uniq!
|
126
|
-
classes
|
127
129
|
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def iri
|
131
|
-
term.to_s
|
132
|
-
end
|
133
130
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
131
|
+
##
|
132
|
+
# Return the URL of the page representing this RdfResource
|
133
|
+
#
|
134
|
+
def page_url
|
135
|
+
return @page_url unless @page_url.nil?
|
136
|
+
generate_file_name(@site.config["url"], @site.config["baseurl"])
|
137
|
+
@page_url
|
138
|
+
end
|
142
139
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
140
|
+
##
|
141
|
+
# Return the path to the page representing this RdfResource
|
142
|
+
#
|
143
|
+
def render_path
|
144
|
+
return @render_path unless @page_url.nil?
|
145
|
+
generate_file_name(@site.config["url"], @site.config["baseurl"])
|
146
|
+
@render_path
|
147
|
+
end
|
151
148
|
|
152
|
-
|
153
|
-
|
154
|
-
# * +role+ - which role the represented RDF resource should play:
|
155
|
-
# :subject ::
|
156
|
-
# Return a list of Jekyll::Drops::RdfStatements whose subject is the RDF resource represented by the receiver
|
157
|
-
# :predicate ::
|
158
|
-
# Return a list of Jekyll::Drops::RdfStatements whose predicate is the RDF resource represented by the receiver
|
159
|
-
# :object ::
|
160
|
-
# Return a list of Jekyll::Drops::RdfStatements whose object is the RDF resource represented by the receiver
|
161
|
-
#
|
162
|
-
def statements_as(role)
|
163
|
-
if(!term.to_s[0..1].eql? "_:")
|
164
|
-
input_uri = "<#{term.to_s}>"
|
165
|
-
elsif(:predicate.eql? role)
|
166
|
-
return []
|
167
|
-
else
|
168
|
-
input_uri = term.to_s
|
149
|
+
def iri
|
150
|
+
term.to_s
|
169
151
|
end
|
170
152
|
|
171
|
-
|
153
|
+
##
|
154
|
+
# Return a list of RDF statements where the represented RDF resource plays a role
|
155
|
+
# * +role+ - which role the represented RDF resource should play:
|
156
|
+
# :subject ::
|
157
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose subject is the RDF resource represented by the receiver
|
158
|
+
# :predicate ::
|
159
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose predicate is the RDF resource represented by the receiver
|
160
|
+
# :object ::
|
161
|
+
# Return a list of Jekyll::JekyllRdf::Drops::RdfStatements whose object is the RDF resource represented by the receiver
|
162
|
+
#
|
163
|
+
def statements_as(role)
|
164
|
+
if(!term.to_s[0..1].eql? "_:")
|
165
|
+
input_uri = "<#{term.to_s}>"
|
166
|
+
elsif(:predicate.eql? role)
|
167
|
+
return []
|
168
|
+
else
|
169
|
+
input_uri = term.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
case role
|
172
173
|
when :subject
|
173
174
|
query = "SELECT ?p ?o ?dt ?lit ?lang WHERE{ #{input_uri} ?p ?o BIND(datatype(?o) AS ?dt) BIND(isLiteral(?o) AS ?lit) BIND(lang(?o) AS ?lang)}"
|
174
|
-
Jekyll::RdfHelper::sparql.query(query).map do |solution|
|
175
|
+
Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(query).map do |solution|
|
175
176
|
check = check_solution(solution)
|
176
177
|
create_statement(term.to_s, solution.p, solution.o, solution.lit, check[:lang], check[:data_type])
|
177
178
|
end
|
178
179
|
when :predicate
|
179
180
|
query = "SELECT ?s ?o ?dt ?lit ?lang WHERE{ ?s #{input_uri} ?o BIND(datatype(?o) AS ?dt) BIND(isLiteral(?o) AS ?lit) BIND(lang(?o) AS ?lang)}"
|
180
|
-
Jekyll::RdfHelper::sparql.query(query).map do |solution|
|
181
|
+
Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(query).map do |solution|
|
181
182
|
check = check_solution(solution)
|
182
183
|
create_statement(solution.s, term.to_s, solution.o, solution.lit, check[:lang], check[:data_type])
|
183
184
|
end
|
184
185
|
when :object
|
185
186
|
query = "SELECT ?s ?p WHERE{ ?s ?p #{input_uri}}"
|
186
|
-
Jekyll::RdfHelper::sparql.query(query).map do |solution|
|
187
|
+
Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(query).map do |solution|
|
187
188
|
create_statement( solution.s, solution.p, term.to_s)
|
188
189
|
end
|
189
190
|
else
|
190
191
|
Jekyll.logger.error "Not existing role found in #{term.to_s}"
|
191
192
|
return
|
193
|
+
end
|
192
194
|
end
|
193
|
-
end
|
194
195
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
end
|
199
|
-
|
200
|
-
#checks if a query solution contains a language or type tag and returns those in a hash
|
201
|
-
private
|
202
|
-
def check_solution(solution)
|
203
|
-
result = {:lang => nil, :data_type => nil}
|
204
|
-
if((solution.bound?(:lang)) && (!solution.lang.to_s.eql?("")))
|
205
|
-
result[:lang] = solution.lang.to_s.to_sym
|
196
|
+
def inspect
|
197
|
+
obj_id = ('%x' % (self.object_id << 1)).to_s
|
198
|
+
return "#<RdfResource:0x#{"0"*(14 - obj_id.length)}#{obj_id} @iri=#{iri} @subResources=[#{subResources.map { |x| x.inspect}.join(", ")}]>"
|
206
199
|
end
|
207
|
-
|
208
|
-
|
200
|
+
|
201
|
+
#checks if a query solution contains a language or type tag and returns those in a hash
|
202
|
+
private
|
203
|
+
def check_solution(solution)
|
204
|
+
result = {:lang => nil, :data_type => nil}
|
205
|
+
if((solution.bound?(:lang)) && (!solution.lang.to_s.eql?("")))
|
206
|
+
result[:lang] = solution.lang.to_s.to_sym
|
207
|
+
end
|
208
|
+
if(solution.bound? :dt)
|
209
|
+
result[:data_type] = solution.dt
|
210
|
+
end
|
211
|
+
return result
|
209
212
|
end
|
210
|
-
return result
|
211
|
-
end
|
212
213
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
214
|
+
def create_statement(subject_string, predicate_string, object_string, is_lit = nil, lang = nil, data_type = nil)
|
215
|
+
subject = RDF::URI(subject_string)
|
216
|
+
predicate = RDF::URI(predicate_string)
|
217
|
+
if(!is_lit.nil?&&is_lit.true?)
|
218
|
+
object = RDF::Literal(object_string, language: lang, datatype: RDF::URI(data_type))
|
219
|
+
else
|
220
|
+
object = RDF::URI(object_string)
|
221
|
+
end
|
222
|
+
return RdfStatement.new(RDF::Statement( subject, predicate, object), @site)
|
220
223
|
end
|
221
|
-
return RdfStatement.new(RDF::Statement( subject, predicate, object), @site)
|
222
|
-
end
|
223
224
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
uri[:scheme] = nil
|
247
|
-
uri[:host] = nil
|
248
|
-
file_name = ""
|
249
|
-
elsif(uri[:path].length > baseurl.length) #baseurl might be the first part of :path
|
250
|
-
if(uri[:path][0..(baseurl.length - 1)].eql? baseurl)
|
251
|
-
uri[:path] = uri[:path][(baseurl.length)..-1]
|
225
|
+
##
|
226
|
+
# Generate a filename corresponding to the RDF resource represented by the receiver. The mapping between RDF resources and filenames should be bijective. If the url of the rdf is the same as of the hosting site it will be omitted.
|
227
|
+
# * +domain_name+
|
228
|
+
#
|
229
|
+
def generate_file_name(domain_name, baseurl)
|
230
|
+
fragment_holder = nil
|
231
|
+
domain_name = domain_name.to_s
|
232
|
+
baseurl = baseurl.to_s
|
233
|
+
(("/".eql? baseurl[-1]) || (baseurl.empty? && ("/".eql? domain_name[-1]))) ? rdfsites="rdfsites/": rdfsites="/rdfsites/"
|
234
|
+
if(term.to_s[0..1].eql? "_:")
|
235
|
+
file_name = "#{rdfsites}blanknode/#{term.to_s.gsub('_:','blanknode_')}/" # ':' can not be used on windows
|
236
|
+
else
|
237
|
+
begin
|
238
|
+
uri = Addressable::URI.parse(term.to_s).to_hash
|
239
|
+
file_name = rdfsites # in this directory all external RDF sites are stored
|
240
|
+
if((uri[:host].eql? domain_name) || ("#{uri[:scheme]}://#{uri[:host]}".eql? domain_name))
|
241
|
+
if((baseurl.length == 0)) #Special cases like baseurl == path or non-existent baseurl
|
242
|
+
uri[:scheme] = nil
|
243
|
+
uri[:host] = nil
|
244
|
+
file_name = ""
|
245
|
+
elsif(uri[:path].eql?(baseurl))
|
246
|
+
uri[:path] = nil
|
252
247
|
uri[:scheme] = nil
|
253
248
|
uri[:host] = nil
|
254
249
|
file_name = ""
|
250
|
+
elsif(uri[:path].length > baseurl.length) #baseurl might be the first part of :path
|
251
|
+
if(uri[:path][0..(baseurl.length - 1)].eql? baseurl)
|
252
|
+
uri[:path] = uri[:path][(baseurl.length)..-1]
|
253
|
+
uri[:scheme] = nil
|
254
|
+
uri[:host] = nil
|
255
|
+
file_name = ""
|
256
|
+
end
|
255
257
|
end
|
256
258
|
end
|
259
|
+
#An URI consists of these fields [:scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment]
|
260
|
+
file_name << "#{uri[:scheme]}/" unless uri[:scheme].nil?
|
261
|
+
file_name << "#{uri[:userinfo]}@" unless uri[:userinfo].nil?
|
262
|
+
file_name << "#{uri[:host]}/" unless uri[:host].nil?
|
263
|
+
file_name << "#{uri[:port]}/" unless uri[:port].nil?
|
264
|
+
# registry purpose unknown
|
265
|
+
file_name << "#{uri[:path][0..-1]}" unless uri[:path].nil?
|
266
|
+
fragment_holder = "##{uri[:fragment]}" unless uri[:fragment].nil?
|
267
|
+
# opaque jekyll produces static pages, so we do not dereferencing
|
268
|
+
# query queries do not address resources
|
269
|
+
# file_name << "#/#{uri[:fragment]}" unless uri[:fragment].nil? fragments are not evaluated by browsers, only by clients
|
270
|
+
rescue Addressable::URI::InvalidURIError => x
|
271
|
+
file_name = "invalids/#{term.to_s}"
|
272
|
+
Jekyll.logger.error("Invalid resource found: #{term.to_s} is not a proper uri")
|
273
|
+
Jekyll.logger.error("URI parser exited with message: #{x.message}")
|
257
274
|
end
|
258
|
-
#An URI consists of these fields [:scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment]
|
259
|
-
file_name << "#{uri[:scheme]}/" unless uri[:scheme].nil?
|
260
|
-
file_name << "#{uri[:userinfo]}@" unless uri[:userinfo].nil?
|
261
|
-
file_name << "#{uri[:host]}/" unless uri[:host].nil?
|
262
|
-
file_name << "#{uri[:port]}/" unless uri[:port].nil?
|
263
|
-
# registry purpose unknown
|
264
|
-
file_name << "#{uri[:path][0..-1]}" unless uri[:path].nil?
|
265
|
-
fragment_holder = "##{uri[:fragment]}" unless uri[:fragment].nil?
|
266
|
-
# opaque jekyll produces static pages, so we do not dereferencing
|
267
|
-
# query queries do not address resources
|
268
|
-
# file_name << "#/#{uri[:fragment]}" unless uri[:fragment].nil? fragments are not evaluated by browsers, only by clients
|
269
|
-
rescue Addressable::URI::InvalidURIError => x
|
270
|
-
file_name = "invalids/#{term.to_s}"
|
271
|
-
Jekyll.logger.error("Invalid resource found: #{term.to_s} is not a proper uri")
|
272
|
-
Jekyll.logger.error("URI parser exited with message: #{x.message}")
|
273
275
|
end
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
file_name << "index.html"
|
282
|
-
else
|
283
|
-
last_slash = file_name.rindex('/')
|
284
|
-
last_slash = 0 if last_slash.nil?
|
285
|
-
ending = ""
|
286
|
-
if(file_name[-5..-1].eql? ".html")
|
287
|
-
ending = ".html" #in case .html is already contained by the term.url
|
276
|
+
file_name = file_name.gsub('//','/') # needs a better regex to include /// ////...
|
277
|
+
file_name = file_name.strip
|
278
|
+
if(file_name[-2..-1] == "#/")
|
279
|
+
file_name = file_name[0..-3]
|
280
|
+
end
|
281
|
+
if(file_name[-1] == '/')
|
282
|
+
file_name << "index.html"
|
288
283
|
else
|
289
|
-
|
284
|
+
last_slash = file_name.rindex('/')
|
285
|
+
last_slash = 0 if last_slash.nil?
|
286
|
+
ending = ""
|
287
|
+
if(file_name[-5..-1].eql? ".html")
|
288
|
+
ending = ".html" #in case .html is already contained by the term.url
|
289
|
+
else
|
290
|
+
file_name[last_slash..-1] = "#{file_name[last_slash..-1]}.html"
|
291
|
+
end
|
290
292
|
end
|
293
|
+
@render_path = file_name
|
294
|
+
@page_url = "#{file_name.chomp('index.html').chomp('.html')}#{ending}#{fragment_holder}"
|
295
|
+
file_name
|
291
296
|
end
|
292
|
-
@render_path = file_name
|
293
|
-
@page_url = "#{file_name.chomp('index.html').chomp('.html')}#{ending}#{fragment_holder}"
|
294
|
-
file_name
|
295
297
|
end
|
298
|
+
|
296
299
|
end
|
297
300
|
end
|
298
301
|
end
|