ttl2html 0.3.1 → 1.0.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: 8a4695d17d266cffe1bdc9b1b902c3cec45dcda2a6278a705d52a7d13b4fea50
4
- data.tar.gz: bed7947d84c69ddc661c7d12da8c53aa6f63ec331430c18a9d2f5fdbbbdfe9ef
3
+ metadata.gz: abc6dcc7ac8d23455d722dae7c9667f18ee48b7c7c797687922c5493037535d5
4
+ data.tar.gz: aa6d348addb6bfe3b95cc024da7d8dcb7639d532bbd337eac0b42321bc7687d9
5
5
  SHA512:
6
- metadata.gz: 8c8b4b8b7c5497477b7ebcd4fd51e79a9d5e1db04c26b9382aecc3af71433eb3b720c0cc0c0cb78295a47634de6fb445ce422bef78a9f40f4b66f153df000993
7
- data.tar.gz: 5516d4fc1c2a4f7ebb590bb67ee4a4fe11015548b9c0ea3cdd6b3eca4edeb2d7a3eba9c6265aec58ad26466d7df1f6c3d031e43904530be15ed3c0ad5f08ff24
6
+ metadata.gz: 733765aed31be6e74dc2f27acc18764385e09a08932f4d1413aa89369640a89426357f1c8395cef1746dfb24f85df41858b4b9a6ba2ed0768d6b401fa7c985a0
7
+ data.tar.gz: c44db48f508966a30b7953b0425c5f3d72ad1b07c69bb4f0ae5f22894486793f50c8504135a9b3bba812ce57bed5273025c898fb461389b497522c2ea5b843a7
@@ -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
@@ -1 +1 @@
1
- TTL2HTML::VERSION = "0.3.1"
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
- if @data.keys.find{|e| e.start_with?(uri + "/") }
133
- file = uri + "/index.html"
134
- elsif uri.end_with?("/")
135
- file = uri + "index.html"
136
- else
137
- file = uri + ".html"
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.3.1
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-10-23 00:00:00.000000000 Z
11
+ date: 2021-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri