antex 0.1.2 → 0.1.3

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
- SHA1:
3
- metadata.gz: 29e503466d8b01cef7a726bfa44f9c30380a3c4b
4
- data.tar.gz: 6a2140251c15fa44630b9ea62a41cd51b4152166
2
+ SHA256:
3
+ metadata.gz: 11ae10a949437986b4951b48ed4fe3a227bc44835a16fc4e7c2318d9faeb2923
4
+ data.tar.gz: 255e9420a941f76d0404dff7c5ab68976a1696b85bb2572e86ef117dc6837d19
5
5
  SHA512:
6
- metadata.gz: 7e23ed12c41ea7a5fd53ccb4ecac98a827d52029dcc9560bcb834562261070d65780254b4b40b31a060aa11a870a441da2683fa1e478eaecbaef60f9c46ac395
7
- data.tar.gz: '0609b75aae82ac8723f350974e16a64e4d3b4d671ef1000e0d280c61307ede0cd77eb1657db35f63afa2a00de1b879aac6801592a905ceb3abd1db8b2c304a51'
6
+ metadata.gz: dcf0e2bfbcc925cb31aa830c428904fa412a0c802f0f968bbc10f42d96e921469a33e66dbedb9c614bb73e2af9826eaca58c58438e25bc62a8e8b68ac5d2e1e0
7
+ data.tar.gz: d2ef3fe82197ab0f50c4a4f42548a62662389c0930e27d96e8bc3ca99ab3b4fa17481d638e43b99c4fdaf96e8a0021829741d1b70c17cdb321d9abf87af67e62
data/README.md CHANGED
@@ -3,8 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/paolobrasolin/antex.svg?branch=master)](https://travis-ci.org/paolobrasolin/antex)
4
4
  [![Gem Version](https://badge.fury.io/rb/antex.svg)](https://badge.fury.io/rb/antex)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
-
7
6
  [![Code Climate](https://codeclimate.com/github/paolobrasolin/antex/badges/gpa.svg)](https://codeclimate.com/github/paolobrasolin/antex)
8
- [![Test Coverage](https://codeclimate.com/github/paolobrasolin/antex/badges/coverage.svg)](https://codeclimate.com/github/paolobrasolin/antex/coverage)
9
- [![Inline docs](http://inch-ci.org/github/paolobrasolin/antex.svg?branch=master)](http://inch-ci.org/github/paolobrasolin/antex)
10
- [![Issue Count](https://codeclimate.com/github/paolobrasolin/antex/badges/issue_count.svg)](https://codeclimate.com/github/paolobrasolin/antex)
7
+ <!-- [![Test Coverage](https://codeclimate.com/github/paolobrasolin/antex/badges/coverage.svg)](https://codeclimate.com/github/paolobrasolin/antex/coverage) -->
8
+ <!-- [![Inline docs](http://inch-ci.org/github/paolobrasolin/antex.svg?branch=master)](http://inch-ci.org/github/paolobrasolin/antex) -->
9
+ <!-- [![Issue Count](https://codeclimate.com/github/paolobrasolin/antex/badges/issue_count.svg)](https://codeclimate.com/github/paolobrasolin/antex) -->
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' => @options['append'],
69
- 'prepend' => @options['prepend'],
70
- 'snippet' => @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
 
@@ -41,9 +41,9 @@ module Antex
41
41
  end
42
42
 
43
43
  def liquid_render_hash(hash, context_hash = {})
44
- hash.map do |key, value|
45
- [key, liquid_render(value, context_hash)]
46
- end.to_h
44
+ hash.transform_values do |value|
45
+ liquid_render(value, context_hash)
46
+ end
47
47
  end
48
48
  end
49
49
  end
@@ -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=(**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(' ').map(&:to_f)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Antex
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,127 +1,133 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Brasolin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-01 00:00:00.000000000 Z
11
+ date: 2021-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: nokogiri
14
+ name: liquid
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: '3'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '1'
29
+ version: '3'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6'
27
33
  - !ruby/object:Gem::Dependency
28
- name: liquid
34
+ name: nokogiri
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '3'
39
+ version: '1'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '3'
46
+ version: '1'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: guard
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '2.14'
53
+ version: 2.18.0
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '2.14'
60
+ version: 2.18.0
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: guard-rspec
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '4.7'
67
+ version: 4.7.3
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '4.7'
74
+ version: 4.7.3
69
75
  - !ruby/object:Gem::Dependency
70
- name: simplecov
76
+ name: rspec
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '0.15'
81
+ version: 3.10.0
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '0.15'
88
+ version: 3.10.0
83
89
  - !ruby/object:Gem::Dependency
84
- name: rspec
90
+ name: rubocop
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '3.6'
95
+ version: 1.22.3
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '3.6'
102
+ version: 1.22.3
97
103
  - !ruby/object:Gem::Dependency
98
- name: rubocop
104
+ name: simplecov
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '0.50'
109
+ version: 0.21.2
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
- version: '0.50'
116
+ version: 0.21.2
111
117
  - !ruby/object:Gem::Dependency
112
118
  name: yard
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
115
121
  - - "~>"
116
122
  - !ruby/object:Gem::Version
117
- version: '0.9'
123
+ version: 0.9.26
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - "~>"
123
129
  - !ruby/object:Gem::Version
124
- version: '0.9'
130
+ version: 0.9.26
125
131
  description: 'anTeX implements a universal TeX integration pipeline to easily embed
126
132
  and render arbitrary code using any engine and dialect. '
127
133
  email: paolo.brasolin@gmail.com
@@ -146,7 +152,7 @@ homepage: https://github.com/paolobrasolin/antex
146
152
  licenses:
147
153
  - MIT
148
154
  metadata: {}
149
- post_install_message:
155
+ post_install_message:
150
156
  rdoc_options: []
151
157
  require_paths:
152
158
  - lib
@@ -154,16 +160,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
160
  requirements:
155
161
  - - ">="
156
162
  - !ruby/object:Gem::Version
157
- version: '2.3'
163
+ version: '2.6'
158
164
  required_rubygems_version: !ruby/object:Gem::Requirement
159
165
  requirements:
160
166
  - - ">="
161
167
  - !ruby/object:Gem::Version
162
168
  version: '0'
163
169
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.6.13
166
- signing_key:
170
+ rubygems_version: 3.1.4
171
+ signing_key:
167
172
  specification_version: 4
168
173
  summary: Universal TeX integrator
169
174
  test_files: []