ttl2html 0.3.1 → 1.0.0
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/ttl2html/template.rb +13 -1
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +18 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abc6dcc7ac8d23455d722dae7c9667f18ee48b7c7c797687922c5493037535d5
|
4
|
+
data.tar.gz: aa6d348addb6bfe3b95cc024da7d8dcb7639d532bbd337eac0b42321bc7687d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 733765aed31be6e74dc2f27acc18764385e09a08932f4d1413aa89369640a89426357f1c8395cef1746dfb24f85df41858b4b9a6ba2ed0768d6b401fa7c985a0
|
7
|
+
data.tar.gz: c44db48f508966a30b7953b0425c5f3d72ad1b07c69bb4f0ae5f22894486793f50c8504135a9b3bba812ce57bed5273025c898fb461389b497522c2ea5b843a7
|
data/lib/ttl2html/template.rb
CHANGED
@@ -169,7 +169,19 @@ module TTL2HTML
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
def format_triples(triples)
|
172
|
-
param_local = @param.merge(data: triples)
|
172
|
+
param_local = @param.dup.merge(data: triples)
|
173
|
+
if @param[:labels_with_class] and triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]
|
174
|
+
@param[:labels_with_class].reverse_each do |k, v|
|
175
|
+
triples["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"].each do |entity_class|
|
176
|
+
if entity_class == k
|
177
|
+
v.each do |property, label_value|
|
178
|
+
param_local[:labels] ||= {}
|
179
|
+
param_local[:labels][property] = label_value
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
173
185
|
to_html_raw("triples.html.erb", param_local)
|
174
186
|
end
|
175
187
|
end
|
data/lib/ttl2html/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
TTL2HTML::VERSION = "0.
|
1
|
+
TTL2HTML::VERSION = "1.0.0"
|
data/lib/ttl2html.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "zlib"
|
3
4
|
require "yaml"
|
4
5
|
require "nokogiri"
|
5
6
|
require "rdf/turtle"
|
@@ -129,12 +130,23 @@ module TTL2HTML
|
|
129
130
|
param[:data_inverse] = @data_inverse[uri]
|
130
131
|
param[:data_global] = @data
|
131
132
|
param[:title] = template.get_title(v)
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
file = nil
|
134
|
+
if @config[:uri_mappings]
|
135
|
+
@config[:uri_mappings].each do |mapping|
|
136
|
+
local_file = uri.sub(@config[:base_uri], "")
|
137
|
+
if mapping["regexp"] =~ local_file
|
138
|
+
file = local_file.sub(mapping["regexp"], mapping["path"])
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
if file.nil?
|
143
|
+
if @data.keys.find{|e| e.start_with?(uri + "/") }
|
144
|
+
file = uri + "/index.html"
|
145
|
+
elsif uri.end_with?("/")
|
146
|
+
file = uri + "index.html"
|
147
|
+
else
|
148
|
+
file = uri + ".html"
|
149
|
+
end
|
138
150
|
end
|
139
151
|
#p uri, param
|
140
152
|
file = file.sub(@config[:base_uri], "")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttl2html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masao Takaku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|