jekyll-antex 0.5.0 → 0.7.0

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: 04f40e277c4a44f0177d6528c0b23cf3fe814d02b0d62bf8b33285649f6ff77a
4
- data.tar.gz: 86af7068b8c90b17ddeed5e17ecb5406868374c8ab2516dd40805c1ef415fd73
3
+ metadata.gz: 898feb47d4ab647c0cbf5263bf5ca7122c86235e3f5c9006f6cf2067699e52f9
4
+ data.tar.gz: b421d69f63ec5012b4ef84f5f568d6399135ffbab507375d2220cfc295992e3d
5
5
  SHA512:
6
- metadata.gz: 8bc58c1233337a4a117b66a6adf30398e166f5b2f87aef95dcac232031c8fd1911e3997a656f3b02d6ee587e5fb76fbe6095ecaba8aafa6527a2ba654c20f348
7
- data.tar.gz: ad91f452823da9f27eb777238ae95cff9fea0803fe5a8dc0dc142d642aa818dd5192dd832a054526040cf6bbe1f79a49ee83cbdd72607ee99945a05ab7e5f6b7
6
+ metadata.gz: c9a64cb0a982138da460170ee206898f1bba7ae37679ca258c26190c11f75a9514ed5e6612a01e123daf3b4cc28540bd21d1ea48629d912126e1c1b19796e6a9
7
+ data.tar.gz: d97e5b98db6dde250125e0a6f8b646eda517921b45743f3a1e5fe0ec3360593d7e76ae02d2cf79414ee58c4e91f79a8f393319f63b7cad900555e96ced05ac87
data/README.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # jekyll-antex
2
2
 
3
- [![Build Status](https://travis-ci.org/paolobrasolin/jekyll-antex.svg?branch=master)](https://travis-ci.org/paolobrasolin/jekyll-antex)
4
- [![Gem Version](https://badge.fury.io/rb/jekyll-antex.svg)](https://badge.fury.io/rb/jekyll-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/jekyll-antex/badges/gpa.svg)](https://codeclimate.com/github/paolobrasolin/jekyll-antex)
8
- [![Test Coverage](https://codeclimate.com/github/paolobrasolin/jekyll-antex/badges/coverage.svg)](https://codeclimate.com/github/paolobrasolin/jekyll-antex/coverage)
9
- [![Inline docs](http://inch-ci.org/github/paolobrasolin/jekyll-antex.svg?branch=master)](http://inch-ci.org/github/paolobrasolin/jekyll-antex)
10
- [![Issue Count](https://codeclimate.com/github/paolobrasolin/jekyll-antex/badges/issue_count.svg)](https://codeclimate.com/github/paolobrasolin/jekyll-antex)
9
+ [build-shield]: https://img.shields.io/github/workflow/status/paolobrasolin/jekyll-antex/CI/main?label=tests&logo=github
10
+ [build-url]: https://github.com/paolobrasolin/jekyll-antex/actions/workflows/main.yml "CI tests status"
11
+ [rubygems-shield]: https://img.shields.io/gem/v/jekyll-antex?logo=ruby
12
+ [rubygems-url]: https://rubygems.org/gems/jekyll-antex "Latest release"
13
+ [license-shield]: https://img.shields.io/github/license/paolobrasolin/jekyll-antex
14
+ [license-url]: https://github.com/paolobrasolin/jekyll-antex/blob/main/LICENSE "License"
15
+ [cc-maintainability-shield]: https://img.shields.io/codeclimate/maintainability/paolobrasolin/jekyll-antex?logo=codeclimate
16
+ [cc-maintainability-url]: https://codeclimate.com/github/paolobrasolin/jekyll-antex "Maintainability"
17
+ [cc-coverage-shield]: https://img.shields.io/codeclimate/coverage/paolobrasolin/jekyll-antex?logo=codeclimate&label=test%20coverage
18
+ [cc-coverage-url]: https://codeclimate.com/github/paolobrasolin/jekyll-antex/coverage "Test coverage"
@@ -16,6 +16,7 @@ module Jekyll
16
16
 
17
17
  def validate_regexp!
18
18
  return if regexp.names.include? 'code'
19
+
19
20
  raise InvalidRegexp, <<~MESSAGE
20
21
  The regexp #{regexp.inspect} is missing the required named matching group "code".
21
22
  MESSAGE
@@ -27,8 +27,6 @@ module Jekyll
27
27
  self.class.render_html(job)
28
28
  end
29
29
 
30
- private
31
-
32
30
  def self.render_html(job)
33
31
  img_tag = render_img_tag job
34
32
  classes = job.options['classes'].join(' ')
@@ -50,12 +48,6 @@ module Jekyll
50
48
  IMG_TAG
51
49
  end
52
50
 
53
- def add_static_file(site, job)
54
- site.static_files << Jekyll::StaticFile.new(
55
- site, *self.class.static_file_paths(job)
56
- )
57
- end
58
-
59
51
  def self.img_url(job)
60
52
  _, dest_dir, filename = static_file_paths job
61
53
  url_path_prefix = job.options['url_path_prefix'] || '/'
@@ -63,15 +55,23 @@ module Jekyll
63
55
  end
64
56
 
65
57
  def self.static_file_paths(job)
66
- work_dir_prefix = %r{^#{Regexp.escape job.dirs['work']}(?=\/|$)}
58
+ work_dir_prefix = %r{^#{Regexp.escape job.dirs['work']}(?=/|$)}
67
59
  # base, dir, name
68
60
  [
69
61
  job.dirs['work'],
70
- job.dirs['dest'].sub(work_dir_prefix, '').sub(%r{^\/}, ''),
62
+ job.dirs['dest'].sub(work_dir_prefix, '').sub(%r{^/}, ''),
71
63
  File.basename(job.files['svg'])
72
64
  ]
73
65
  end
74
66
 
67
+ private
68
+
69
+ def add_static_file(site, job)
70
+ site.static_files << Jekyll::StaticFile.new(
71
+ site, *self.class.static_file_paths(job)
72
+ )
73
+ end
74
+
75
75
  def build_options(registers:, markup:)
76
76
  Jekyll::Antex::Options.build Jekyll::Antex::Options::DEFAULTS,
77
77
  registers[:site].config['antex'] || {},
@@ -27,13 +27,13 @@ module Jekyll
27
27
 
28
28
  def self.build_guarder(options)
29
29
  Jekyll::Antex::Stasher.new(
30
- options['guards'].values.map(&Guard.method(:new))
30
+ options['guards'].values.reject { |value| value == false }.map(&Guard.method(:new))
31
31
  )
32
32
  end
33
33
 
34
34
  def self.build_aliaser(options)
35
35
  Jekyll::Antex::Stasher.new(
36
- options['aliases'].values.map(&Alias.method(:new))
36
+ options['aliases'].values.reject { |value| value == false }.map(&Alias.method(:new))
37
37
  )
38
38
  end
39
39
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
- require 'jekyll/utils'
4
+ require 'jekyll'
5
5
 
6
6
  module Jekyll
7
7
  module Antex
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Antex
5
- VERSION = '0.5.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
data/lib/jekyll/antex.rb CHANGED
@@ -6,20 +6,35 @@ require 'jekyll/antex/version'
6
6
  require 'jekyll/antex/dealiaser'
7
7
  require 'jekyll/antex/block'
8
8
 
9
- require 'byebug'
10
-
11
9
  module Jekyll
12
10
  module Antex
11
+ def self.gather_resources(site)
12
+ pages = site.pages
13
+ documents = site.collections.values.flat_map(&:docs)
14
+ [*pages, *documents].filter(&method(:allowed_resource?))
15
+ end
16
+
17
+ def self.allowed_resource?(resource)
18
+ # TODO: perhaps this should be configurable
19
+ File.fnmatch('*.{html,md}', resource.relative_path, File::FNM_EXTGLOB)
20
+ end
21
+
13
22
  def self.run_jobs
14
- jobs_count = Jekyll::Antex.jobs.count
15
- Jekyll.logger.writer << "Compiling TeX: ".rjust(20)
16
- Jekyll::Antex.jobs.values.each_with_index do |job, i|
17
- progress = "job " + i.next.to_s.rjust(jobs_count.to_s.length) + " of #{jobs_count} "
18
- Jekyll.logger.writer << progress
19
- job.run!
20
- Jekyll.logger.writer << "\b" * progress.length
23
+ jekyll_antex_jobs = Jekyll::Antex.jobs
24
+ jobs_count = jekyll_antex_jobs.count
25
+ jekyll_logger_writer = Jekyll.logger.writer
26
+ jekyll_logger_writer << 'Compiling TeX: '.rjust(20)
27
+ jekyll_antex_jobs.values.each_with_index do |job, index|
28
+ run_job(job, index, jobs_count, jekyll_logger_writer)
21
29
  end
22
- Jekyll.logger.writer << "#{jobs_count} jobs completed.\n"
30
+ jekyll_logger_writer << "#{jobs_count} jobs completed.\n"
31
+ end
32
+
33
+ def self.run_job(job, index, jobs_count, jekyll_logger_writer)
34
+ progress = "job #{index.next.to_s.rjust(jobs_count.to_s.length)} of #{jobs_count} "
35
+ jekyll_logger_writer << progress
36
+ job.run!
37
+ jekyll_logger_writer << ("\b" * progress.length)
23
38
  end
24
39
 
25
40
  def self.inject_style_attributes(output)
@@ -34,20 +49,20 @@ end
34
49
  # NOTE: I'm conflicted, but regexp flags in yaml must be easy to use.
35
50
  SafeYAML::OPTIONS[:whitelisted_tags].push('!ruby/regexp')
36
51
 
37
- Jekyll::Hooks.register :site, :pre_render do
52
+ Jekyll::Hooks.register :site, :pre_render do |site|
38
53
  Jekyll::Antex.jobs = {}
39
- end
40
-
41
- # NOTE: we're not registering :posts since they are included in :documents.
42
- Jekyll::Hooks.register [:documents, :pages], :pre_render do |resource|
54
+ Jekyll::Antex.gather_resources(site).each do |resource|
43
55
  resource.content = Jekyll::Antex::Dealiaser.run(resource)
56
+ end
44
57
  end
45
58
 
46
59
  Liquid::Template.register_tag('antex', Jekyll::Antex::Block)
47
60
 
48
61
  Jekyll::Hooks.register :site, :post_render do |site|
49
62
  Jekyll::Antex.run_jobs
50
- [*site.pages, *site.documents].each do |resource|
63
+ Jekyll::Antex.gather_resources(site).each do |resource|
64
+ # NOTE: skip unrendered resources e.g. when using --incremental
65
+ next if resource.output.nil?
51
66
  resource.output = Jekyll::Antex.inject_style_attributes(resource.output)
52
67
  end
53
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-antex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
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: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2022-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: antex
@@ -16,140 +16,160 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: 0.1.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: 0.1.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '5'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '3'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '5'
47
+ - !ruby/object:Gem::Dependency
48
+ name: kramdown-parser-gfm
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
51
  - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: '3.8'
53
+ version: 1.1.0
34
54
  type: :runtime
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
58
  - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: '3.8'
60
+ version: 1.1.0
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: byebug
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
65
  - - "~>"
46
66
  - !ruby/object:Gem::Version
47
- version: '10'
67
+ version: 11.1.3
48
68
  type: :development
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
- version: '10'
74
+ version: 11.1.3
55
75
  - !ruby/object:Gem::Dependency
56
76
  name: guard
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
79
  - - "~>"
60
80
  - !ruby/object:Gem::Version
61
- version: '2'
81
+ version: 2.18.0
62
82
  type: :development
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
86
  - - "~>"
67
87
  - !ruby/object:Gem::Version
68
- version: '2'
88
+ version: 2.18.0
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: guard-rspec
71
91
  requirement: !ruby/object:Gem::Requirement
72
92
  requirements:
73
93
  - - "~>"
74
94
  - !ruby/object:Gem::Version
75
- version: '4'
95
+ version: 4.7.3
76
96
  type: :development
77
97
  prerelease: false
78
98
  version_requirements: !ruby/object:Gem::Requirement
79
99
  requirements:
80
100
  - - "~>"
81
101
  - !ruby/object:Gem::Version
82
- version: '4'
102
+ version: 4.7.3
83
103
  - !ruby/object:Gem::Dependency
84
104
  name: reek
85
105
  requirement: !ruby/object:Gem::Requirement
86
106
  requirements:
87
107
  - - "~>"
88
108
  - !ruby/object:Gem::Version
89
- version: '4'
109
+ version: 6.0.6
90
110
  type: :development
91
111
  prerelease: false
92
112
  version_requirements: !ruby/object:Gem::Requirement
93
113
  requirements:
94
114
  - - "~>"
95
115
  - !ruby/object:Gem::Version
96
- version: '4'
116
+ version: 6.0.6
97
117
  - !ruby/object:Gem::Dependency
98
118
  name: rspec
99
119
  requirement: !ruby/object:Gem::Requirement
100
120
  requirements:
101
121
  - - "~>"
102
122
  - !ruby/object:Gem::Version
103
- version: '3'
123
+ version: 3.10.0
104
124
  type: :development
105
125
  prerelease: false
106
126
  version_requirements: !ruby/object:Gem::Requirement
107
127
  requirements:
108
128
  - - "~>"
109
129
  - !ruby/object:Gem::Version
110
- version: '3'
130
+ version: 3.10.0
111
131
  - !ruby/object:Gem::Dependency
112
132
  name: rubocop
113
133
  requirement: !ruby/object:Gem::Requirement
114
134
  requirements:
115
135
  - - "~>"
116
136
  - !ruby/object:Gem::Version
117
- version: '0.52'
137
+ version: 1.22.3
118
138
  type: :development
119
139
  prerelease: false
120
140
  version_requirements: !ruby/object:Gem::Requirement
121
141
  requirements:
122
142
  - - "~>"
123
143
  - !ruby/object:Gem::Version
124
- version: '0.52'
144
+ version: 1.22.3
125
145
  - !ruby/object:Gem::Dependency
126
146
  name: simplecov
127
147
  requirement: !ruby/object:Gem::Requirement
128
148
  requirements:
129
149
  - - "~>"
130
150
  - !ruby/object:Gem::Version
131
- version: '0.16'
151
+ version: 0.21.2
132
152
  type: :development
133
153
  prerelease: false
134
154
  version_requirements: !ruby/object:Gem::Requirement
135
155
  requirements:
136
156
  - - "~>"
137
157
  - !ruby/object:Gem::Version
138
- version: '0.16'
158
+ version: 0.21.2
139
159
  - !ruby/object:Gem::Dependency
140
160
  name: yard
141
161
  requirement: !ruby/object:Gem::Requirement
142
162
  requirements:
143
163
  - - "~>"
144
164
  - !ruby/object:Gem::Version
145
- version: '0.9'
165
+ version: 0.9.26
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
149
169
  requirements:
150
170
  - - "~>"
151
171
  - !ruby/object:Gem::Version
152
- version: '0.9'
172
+ version: 0.9.26
153
173
  description: 'Jekyll-anTeX implements universal TeX support in Jekyll to embed and
154
174
  render arbitrary code using any engine and dialect. '
155
175
  email: paolo.brasolin@gmail.com
@@ -157,7 +177,6 @@ executables: []
157
177
  extensions: []
158
178
  extra_rdoc_files: []
159
179
  files:
160
- - LICENSE.txt
161
180
  - README.md
162
181
  - lib/jekyll/antex.rb
163
182
  - lib/jekyll/antex/alias.rb
@@ -173,7 +192,7 @@ homepage: https://github.com/paolobrasolin/antex
173
192
  licenses:
174
193
  - MIT
175
194
  metadata: {}
176
- post_install_message:
195
+ post_install_message:
177
196
  rdoc_options: []
178
197
  require_paths:
179
198
  - lib
@@ -181,16 +200,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
200
  requirements:
182
201
  - - ">="
183
202
  - !ruby/object:Gem::Version
184
- version: '2.5'
203
+ version: '2.6'
185
204
  required_rubygems_version: !ruby/object:Gem::Requirement
186
205
  requirements:
187
206
  - - ">="
188
207
  - !ruby/object:Gem::Version
189
208
  version: '0'
190
209
  requirements: []
191
- rubyforge_project:
192
- rubygems_version: 2.7.6
193
- signing_key:
210
+ rubygems_version: 3.1.6
211
+ signing_key:
194
212
  specification_version: 4
195
213
  summary: Universal TeX integration for Jekyll
196
214
  test_files: []
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Paolo Brasolin
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.