anystyle 1.3.14 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +6 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/anystyle/dictionary/marshal.rb +1 -1
- data/lib/anystyle/document.rb +1 -3
- data/lib/anystyle/finder.rb +1 -1
- data/lib/anystyle/parser.rb +0 -6
- data/lib/anystyle/support.rb +2 -2
- data/lib/anystyle/utils.rb +0 -3
- data/lib/anystyle/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe02cd03a8c3aeb0d22eff351153c44215db1430e432075de48784666640472a
|
4
|
+
data.tar.gz: f463c7817ce3d5eafb0c15bce18704dc097b12ddccff152caa26e57e20e82c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b3a05d98dce47bbe89359702f48585251dc34eff829d1c836892dbe2e3b6cc006254d1974efeb106ad38e50a24be67529e435af7ef89466b5468ec8699646e6
|
7
|
+
data.tar.gz: e6621f6e646c23e671bf57c3d38501dc087757e34c3c7a51117bdbe074cb8125b17da1b8cac6cda95477951d3bf070f3253f3123a2e08f12dec228097cd2b7c8
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
1.4.0 / 2023-01-06
|
2
|
+
==================
|
3
|
+
* Removed deprectate string taint checking (@bbonamin).
|
4
|
+
* `AnyStyle::Parser#parse` will no longer automatically open local files.
|
5
|
+
Please call `Wapiti::Dataset.open` explicitly if you relied on this.
|
6
|
+
|
1
7
|
1.3.6 / 2019-12-02
|
2
8
|
==================
|
3
9
|
* Updated parser model.
|
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AnyStyle
|
2
|
-
Copyright 2011-
|
2
|
+
Copyright 2011-2023 Sylvester Keil. All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without
|
5
5
|
modification, are permitted provided that the following conditions are met:
|
data/README.md
CHANGED
@@ -213,7 +213,7 @@ to join us! Over the years our main contributors have been:
|
|
213
213
|
|
214
214
|
License
|
215
215
|
-------
|
216
|
-
Copyright 2011-
|
216
|
+
Copyright 2011-2023 Sylvester Keil. All rights reserved.
|
217
217
|
|
218
218
|
AnyStyle is distributed under a BSD-style license.
|
219
219
|
See LICENSE for details.
|
data/lib/anystyle/document.rb
CHANGED
@@ -10,7 +10,7 @@ module AnyStyle
|
|
10
10
|
current_label = ''
|
11
11
|
new(string.split(delimiter).map { |line|
|
12
12
|
if tagged
|
13
|
-
label, line = line.split(/\s*\| /, 2)
|
13
|
+
label, line = line.split(/\s*\|( |$)/, 2)
|
14
14
|
current_label = label unless label.empty?
|
15
15
|
end
|
16
16
|
Wapiti::Token.new line, label: current_label.to_s
|
@@ -18,8 +18,6 @@ module AnyStyle
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def open(path, format: File.extname(path), tagged: false, **opts)
|
21
|
-
raise ArgumentError,
|
22
|
-
"cannot open tainted path: '#{path}'" if path.tainted?
|
23
21
|
raise ArgumentError,
|
24
22
|
"document not found: '#{path}'" unless File.exist?(path)
|
25
23
|
|
data/lib/anystyle/finder.rb
CHANGED
@@ -8,7 +8,7 @@ module AnyStyle
|
|
8
8
|
compact: true,
|
9
9
|
threads: 4,
|
10
10
|
format: :references,
|
11
|
-
training_data: Dir[File.join(RES, 'finder', '*.ttx')]
|
11
|
+
training_data: Dir[File.join(RES, 'finder', '*.ttx')],
|
12
12
|
layout: true,
|
13
13
|
pdftotext: 'pdftotext',
|
14
14
|
pdfinfo: 'pdfinfo'
|
data/lib/anystyle/parser.rb
CHANGED
@@ -86,12 +86,6 @@ module AnyStyle
|
|
86
86
|
expand input
|
87
87
|
when Wapiti::Sequence
|
88
88
|
expand Wapiti::Dataset.new([input])
|
89
|
-
when String
|
90
|
-
if !input.tainted? && input.length < 1024 && File.exists?(input)
|
91
|
-
expand Wapiti::Dataset.open(input, **opts)
|
92
|
-
else
|
93
|
-
expand Wapiti::Dataset.parse(input, **opts)
|
94
|
-
end
|
95
89
|
else
|
96
90
|
expand Wapiti::Dataset.parse(input, **opts)
|
97
91
|
end
|
data/lib/anystyle/support.rb
CHANGED
data/lib/anystyle/utils.rb
CHANGED
@@ -63,21 +63,18 @@ module AnyStyle
|
|
63
63
|
module_function
|
64
64
|
|
65
65
|
def pdf_to_text(path, pdftotext: 'pdftotext', **opts)
|
66
|
-
raise "pdftotext is tainted" if pdftotext.tainted?
|
67
66
|
text = %x{#{pdftotext} #{pdf_opts(path, **opts).join(' ')} "#{path}" -}
|
68
67
|
raise "pdftotext failed with error code #{$?.exitstatus}" unless $?.success?
|
69
68
|
text.force_encoding(opts[:encoding] || 'UTF-8')
|
70
69
|
end
|
71
70
|
|
72
71
|
def pdf_info(path, pdfinfo: 'pdfinfo', **opts)
|
73
|
-
raise "pdfinfo is tainted" if pdfinfo.tainted?
|
74
72
|
Hash[%x{#{pdfinfo} "#{path}"}.split("\n").map { |ln|
|
75
73
|
ln.split(/:\s+/, 2)
|
76
74
|
}]
|
77
75
|
end
|
78
76
|
|
79
77
|
def pdf_info(path, pdfinfo: 'pdfinfo', **opts)
|
80
|
-
raise "pdfinfo is tainted" if pdfinfo.tainted?
|
81
78
|
%x{#{pdfinfo} -meta "#{path}"}
|
82
79
|
end
|
83
80
|
|
data/lib/anystyle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anystyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvester Keil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bibtex-ruby
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: wapiti
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: namae
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|