ttl2html 0.3.0 → 0.3.1

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: 5c6cc6b025ce5ec57709788d914a9507dc66160feed31a083e101acb2d128461
4
- data.tar.gz: 994ea0ec7c5131b21ba7c709c4693c9fe341a9cb3e19f8d53b28f8f2a9d39056
3
+ metadata.gz: 8a4695d17d266cffe1bdc9b1b902c3cec45dcda2a6278a705d52a7d13b4fea50
4
+ data.tar.gz: bed7947d84c69ddc661c7d12da8c53aa6f63ec331430c18a9d2f5fdbbbdfe9ef
5
5
  SHA512:
6
- metadata.gz: fb77aca35e592354697fddd2b32e65ba8515ed6631bf8edfbf5ddd1ee2442f62f0a872a17a27fb1230c2665b1b5067a13b1e504c31aedfa3c613f87ec0ce1881
7
- data.tar.gz: b0d58cf7689127f8d1a47e3f4fbc500e228e075baf49c9edb7f6c3e86378c8f861f8336cabbe5f0e8ad87778091fcfb970a86e2e62a2e894e49cf7bad4dd0eb2
6
+ metadata.gz: 8c8b4b8b7c5497477b7ebcd4fd51e79a9d5e1db04c26b9382aecc3af71433eb3b720c0cc0c0cb78295a47634de6fb445ce422bef78a9f40f4b66f153df000993
7
+ data.tar.gz: 5516d4fc1c2a4f7ebb590bb67ee4a4fe11015548b9c0ea3cdd6b3eca4edeb2d7a3eba9c6265aec58ad26466d7df1f6c3d031e43904530be15ed3c0ad5f08ff24
data/bin/catttl CHANGED
@@ -1,18 +1,24 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require "zlib"
3
4
  require "ttl2html"
4
- include Textbook
5
+ include TTL2HTML
5
6
 
6
7
  prefix = {}
7
8
  ttl = []
8
9
 
9
10
  ARGV.each do |file|
10
11
  filename = find_turtle(file)
12
+ if filename.nil?
13
+ STDERR.puts "#{file} not found. skipping."
14
+ next
15
+ end
11
16
  klass = File
12
- if File.extname(file) == ".gz"
17
+ if File.extname(filename) == ".gz"
13
18
  klass = Zlib::GzipReader
14
19
  end
15
- klass.readlines(filename).each do |line|
20
+ io = klass.open(filename)
21
+ io.each do |line|
16
22
  line = line.chomp
17
23
  next if line.empty?
18
24
  if line =~ /^@prefix\s+(\w[\w\-]*):\s*<(.+)>/
@@ -1 +1 @@
1
- TTL2HTML::VERSION = "0.3.0"
1
+ TTL2HTML::VERSION = "0.3.1"
data/lib/ttl2html.rb CHANGED
@@ -64,19 +64,6 @@ module TTL2HTML
64
64
  STDERR.puts "#{count} triples. #{@data.size} subjects."
65
65
  @data
66
66
  end
67
- def find_turtle(filename, params = {})
68
- if params[:noexpand] == true
69
- filename if File.exists? filename
70
- else
71
- file = nil
72
- basename = File.basename(filename, ".ttl")
73
- dirname = File.dirname(filename)
74
- files = Dir.glob("#{dirname}/#{basename}-[0-9]*.ttl{,.gz}")
75
- file = files.sort.last
76
- file
77
- end
78
- end
79
-
80
67
  def format_turtle(subject, depth = 1)
81
68
  turtle = RDF::Turtle::Writer.new
82
69
  result = ""
@@ -247,4 +234,17 @@ module TTL2HTML
247
234
  end
248
235
  end
249
236
  end
237
+
238
+ def find_turtle(filename, params = {})
239
+ if params[:noexpand] == true
240
+ filename if File.exists? filename
241
+ else
242
+ file = nil
243
+ basename = File.basename(filename, ".ttl")
244
+ dirname = File.dirname(filename)
245
+ files = Dir.glob("#{dirname}/#{basename}-[0-9]*.ttl{,.gz}")
246
+ file = files.sort.last
247
+ file
248
+ end
249
+ end
250
250
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttl2html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masao Takaku
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2021-10-23 00:00:00.000000000 Z
@@ -134,7 +134,7 @@ homepage: https://github.com/masao/ttl2html
134
134
  licenses:
135
135
  - MIT
136
136
  metadata: {}
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -149,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.1.2
153
- signing_key:
152
+ rubygems_version: 3.2.3
153
+ signing_key:
154
154
  specification_version: 4
155
155
  summary: ttl2html
156
156
  test_files: []