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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 29e503466d8b01cef7a726bfa44f9c30380a3c4b
4
- data.tar.gz: 6a2140251c15fa44630b9ea62a41cd51b4152166
2
+ SHA256:
3
+ metadata.gz: 35c1e0a463b933c75ff632e38fae2866ff215548b66d2a6b51f680b7d22deb7f
4
+ data.tar.gz: 04a76f67a969d53a808d36c8189436678e7b38e6a091c5f7aa81c205eaede343
5
5
  SHA512:
6
- metadata.gz: 7e23ed12c41ea7a5fd53ccb4ecac98a827d52029dcc9560bcb834562261070d65780254b4b40b31a060aa11a870a441da2683fa1e478eaecbaef60f9c46ac395
7
- data.tar.gz: '0609b75aae82ac8723f350974e16a64e4d3b4d671ef1000e0d280c61307ede0cd77eb1657db35f63afa2a00de1b879aac6801592a905ceb3abd1db8b2c304a51'
6
+ metadata.gz: 8f602e1001dace9b0f34f14e81ca276ff6ea88a8eefdfa4cc20c0f2fbc0c8edc9b76b37afca2a2ddf9931d925459ace00b431cce10541d251d7223c69b29a72c
7
+ data.tar.gz: 4cfa6e7bc871af1643670dffd0af8190d1f0202214f2160819c6b8efd88a72f54260d491060757e1414e25fd34bc8d7a1c9b7f498220ac9d47060fd5d59495cb
data/README.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # antex
2
2
 
3
- [![Build Status](https://travis-ci.org/paolobrasolin/antex.svg?branch=master)](https://travis-ci.org/paolobrasolin/antex)
4
- [![Gem Version](https://badge.fury.io/rb/antex.svg)](https://badge.fury.io/rb/antex)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
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
- [![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)
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' => @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.4'
5
5
  end
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.2
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: 2017-10-01 00:00:00.000000000 Z
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
- - !ruby/object:Gem::Dependency
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: '4.7'
32
+ version: '6'
69
33
  - !ruby/object:Gem::Dependency
70
- name: simplecov
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: '0.9'
118
- type: :development
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: '0.9'
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.3'
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
- rubyforge_project:
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