antex 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +15 -7
- data/lib/antex/command.rb +3 -0
- data/lib/antex/job.rb +5 -4
- data/lib/antex/liquid_helpers.rb +3 -3
- data/lib/antex/measurable.rb +4 -1
- data/lib/antex/set_box.rb +1 -1
- data/lib/antex/svg_box.rb +1 -1
- data/lib/antex/version.rb +1 -1
- metadata +18 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 35c1e0a463b933c75ff632e38fae2866ff215548b66d2a6b51f680b7d22deb7f
|
4
|
+
data.tar.gz: 04a76f67a969d53a808d36c8189436678e7b38e6a091c5f7aa81c205eaede343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f602e1001dace9b0f34f14e81ca276ff6ea88a8eefdfa4cc20c0f2fbc0c8edc9b76b37afca2a2ddf9931d925459ace00b431cce10541d251d7223c69b29a72c
|
7
|
+
data.tar.gz: 4cfa6e7bc871af1643670dffd0af8190d1f0202214f2160819c6b8efd88a72f54260d491060757e1414e25fd34bc8d7a1c9b7f498220ac9d47060fd5d59495cb
|
data/README.md
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
# antex
|
2
2
|
|
3
|
-
[![
|
4
|
-
[![
|
5
|
-
[![License
|
3
|
+
[![CI tests status badge][build-shield]][build-url]
|
4
|
+
[![Latest release badge][rubygems-shield]][rubygems-url]
|
5
|
+
[![License badge][license-shield]][license-url]
|
6
|
+
[![Maintainability badge][cc-maintainability-shield]][cc-maintainability-url]
|
7
|
+
[![Test coverage badge][cc-coverage-shield]][cc-coverage-url]
|
6
8
|
|
7
|
-
[
|
8
|
-
[
|
9
|
-
[
|
10
|
-
[
|
9
|
+
[build-shield]: https://img.shields.io/github/workflow/status/paolobrasolin/antex/CI/main?label=tests&logo=github
|
10
|
+
[build-url]: https://github.com/paolobrasolin/antex/actions/workflows/main.yml "CI tests status"
|
11
|
+
[rubygems-shield]: https://img.shields.io/gem/v/antex?logo=ruby
|
12
|
+
[rubygems-url]: https://rubygems.org/gems/antex "Latest release"
|
13
|
+
[license-shield]: https://img.shields.io/github/license/paolobrasolin/antex
|
14
|
+
[license-url]: https://github.com/paolobrasolin/antex/blob/main/LICENSE "License"
|
15
|
+
[cc-maintainability-shield]: https://img.shields.io/codeclimate/maintainability/paolobrasolin/antex?logo=codeclimate
|
16
|
+
[cc-maintainability-url]: https://codeclimate.com/github/paolobrasolin/antex "Maintainability"
|
17
|
+
[cc-coverage-shield]: https://img.shields.io/codeclimate/coverage/paolobrasolin/antex?logo=codeclimate&label=test%20coverage
|
18
|
+
[cc-coverage-url]: https://codeclimate.com/github/paolobrasolin/antex/coverage "Test coverage"
|
data/lib/antex/command.rb
CHANGED
@@ -15,7 +15,9 @@ module Antex
|
|
15
15
|
# the attributes {#stdout}, {#stderr} and {#status}.
|
16
16
|
class Command
|
17
17
|
class MissingSourceFiles < Error; end
|
18
|
+
|
18
19
|
class MissingTargetFiles < Error; end
|
20
|
+
|
19
21
|
class ExecutionFailed < Error; end
|
20
22
|
|
21
23
|
# @return [String, nil] the +stdout+ returned by the command line
|
@@ -50,6 +52,7 @@ module Antex
|
|
50
52
|
# @raise [MissingTargetFiles] when command does not create target files
|
51
53
|
def run!
|
52
54
|
return if all_exist? @targets
|
55
|
+
|
53
56
|
check_source_files!
|
54
57
|
@stdout, @stderr, @status = Open3.capture3 @command_line
|
55
58
|
check_status!
|
data/lib/antex/job.rb
CHANGED
@@ -65,9 +65,9 @@ module Antex
|
|
65
65
|
def prepare_code
|
66
66
|
@code = liquid_render @options['template'],
|
67
67
|
'preamble' => @options['preamble'],
|
68
|
-
'append'
|
69
|
-
'prepend'
|
70
|
-
'snippet'
|
68
|
+
'append' => @options['append'],
|
69
|
+
'prepend' => @options['prepend'],
|
70
|
+
'snippet' => @snippet
|
71
71
|
end
|
72
72
|
|
73
73
|
def prepare_hash
|
@@ -91,6 +91,7 @@ module Antex
|
|
91
91
|
|
92
92
|
def write_code
|
93
93
|
return if File.exist? @files['tex']
|
94
|
+
|
94
95
|
File.open(@files['tex'], 'w') { |io| io.write @code }
|
95
96
|
end
|
96
97
|
|
@@ -104,7 +105,7 @@ module Antex
|
|
104
105
|
sources: commands[command_name]['sources'],
|
105
106
|
targets: commands[command_name]['targets'],
|
106
107
|
command_line: commands[command_name]['command'].join(' ') }
|
107
|
-
Command.new(options).run!
|
108
|
+
Command.new(**options).run!
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
data/lib/antex/liquid_helpers.rb
CHANGED
@@ -41,9 +41,9 @@ module Antex
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def liquid_render_hash(hash, context_hash = {})
|
44
|
-
hash.
|
45
|
-
|
46
|
-
end
|
44
|
+
hash.transform_values do |value|
|
45
|
+
liquid_render(value, context_hash)
|
46
|
+
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
data/lib/antex/measurable.rb
CHANGED
@@ -22,6 +22,7 @@ module Antex
|
|
22
22
|
def default_unit=(unit)
|
23
23
|
raise InvalidUnit, "Unit #{unit} is undefined." unless @measures.key? unit
|
24
24
|
raise InvalidUnit, "Unit #{unit} is zero." if @measures[unit].zero?
|
25
|
+
|
25
26
|
@default_unit = unit
|
26
27
|
end
|
27
28
|
|
@@ -29,7 +30,7 @@ module Antex
|
|
29
30
|
# @note When setting, the default unit will be set to +nil+.
|
30
31
|
attr_reader :measures
|
31
32
|
|
32
|
-
def measures=(
|
33
|
+
def measures=(measures)
|
33
34
|
@default_unit = nil
|
34
35
|
@measures = measures
|
35
36
|
end
|
@@ -40,6 +41,7 @@ module Antex
|
|
40
41
|
raise InvalidUnit, 'Default unit is not set.' if unit.nil?
|
41
42
|
raise InvalidUnit, "Unit #{unit} is undefined." unless @measures.key? unit
|
42
43
|
raise InvalidUnit, "Unit #{unit} is zero." if @measures[unit].zero?
|
44
|
+
|
43
45
|
@measures[metric].fdiv @measures[unit]
|
44
46
|
end
|
45
47
|
|
@@ -59,6 +61,7 @@ module Antex
|
|
59
61
|
# mea.mi # => 1.0
|
60
62
|
def method_missing(method_name, *arguments, &block)
|
61
63
|
return super unless @measures.include? method_name
|
64
|
+
|
62
65
|
send :calculate, method_name, *arguments, &block
|
63
66
|
end
|
64
67
|
end
|
data/lib/antex/set_box.rb
CHANGED
@@ -68,7 +68,7 @@ module Antex
|
|
68
68
|
ml: ex_px * (- @tfm.ox + @fit.ox),
|
69
69
|
mt: ex_px * (- @tfm.oy + @fit.oy),
|
70
70
|
mr: ex_px * (+ @tfm.ox - @fit.ox + @tfm.dx - @fit.dx),
|
71
|
-
mb: ex_px * (+ @tfm.oy - @fit.oy + @tfm.dy - @fit.dy) - @tex.dp
|
71
|
+
mb: (ex_px * (+ @tfm.oy - @fit.oy + @tfm.dy - @fit.dy)) - @tex.dp
|
72
72
|
}
|
73
73
|
end
|
74
74
|
|
data/lib/antex/svg_box.rb
CHANGED
@@ -12,7 +12,7 @@ module Antex
|
|
12
12
|
def load(filepath)
|
13
13
|
svg_ast = Nokogiri::XML.parse File.read(filepath)
|
14
14
|
view_box = svg_ast.css('svg').attribute('viewBox')
|
15
|
-
magnitudes = view_box.to_s.split
|
15
|
+
magnitudes = view_box.to_s.split.map(&:to_f)
|
16
16
|
@measures = %i[ox oy dx dy].zip(magnitudes).to_h
|
17
17
|
@measures[:px] ||= 1.0
|
18
18
|
@default_unit = :px
|
data/lib/antex/version.rb
CHANGED
metadata
CHANGED
@@ -1,127 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: antex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Brasolin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: nokogiri
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: liquid
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - "
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: '3'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '6'
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
|
-
- - "
|
27
|
+
- - ">="
|
39
28
|
- !ruby/object:Gem::Version
|
40
29
|
version: '3'
|
41
|
-
-
|
42
|
-
name: guard
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.14'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.14'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: guard-rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '4.7'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
30
|
+
- - "<"
|
67
31
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
32
|
+
version: '6'
|
69
33
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.15'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.15'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.6'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.6'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.50'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.50'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: yard
|
34
|
+
name: nokogiri
|
113
35
|
requirement: !ruby/object:Gem::Requirement
|
114
36
|
requirements:
|
115
37
|
- - "~>"
|
116
38
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
118
|
-
type: :
|
39
|
+
version: '1'
|
40
|
+
type: :runtime
|
119
41
|
prerelease: false
|
120
42
|
version_requirements: !ruby/object:Gem::Requirement
|
121
43
|
requirements:
|
122
44
|
- - "~>"
|
123
45
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
46
|
+
version: '1'
|
125
47
|
description: 'anTeX implements a universal TeX integration pipeline to easily embed
|
126
48
|
and render arbitrary code using any engine and dialect. '
|
127
49
|
email: paolo.brasolin@gmail.com
|
@@ -154,15 +76,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
76
|
requirements:
|
155
77
|
- - ">="
|
156
78
|
- !ruby/object:Gem::Version
|
157
|
-
version: '2.
|
79
|
+
version: '2.6'
|
80
|
+
- - "<"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
158
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
84
|
requirements:
|
160
85
|
- - ">="
|
161
86
|
- !ruby/object:Gem::Version
|
162
87
|
version: '0'
|
163
88
|
requirements: []
|
164
|
-
|
165
|
-
rubygems_version: 2.6.13
|
89
|
+
rubygems_version: 3.4.5
|
166
90
|
signing_key:
|
167
91
|
specification_version: 4
|
168
92
|
summary: Universal TeX integrator
|