jekyll-antex 0.6.1 → 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: 7d7e55a185748b2e917234281bb7f2242ddc40a4d36a81da3c82c63e394fa1f5
4
- data.tar.gz: e5f4058b0c13c5a0397fb181a9c1fc6c266b9ea1957d3265a35dbbdb6592cee5
3
+ metadata.gz: 898feb47d4ab647c0cbf5263bf5ca7122c86235e3f5c9006f6cf2067699e52f9
4
+ data.tar.gz: b421d69f63ec5012b4ef84f5f568d6399135ffbab507375d2220cfc295992e3d
5
5
  SHA512:
6
- metadata.gz: f7d87025ca79d0f2bd6aa8e2f0f66d8c7fb1f2d5683bc24f01c5fbace55b6bc069b07e15f93cb78fdd41b9abc8f4809f7b48d4f96f9f404c8eb23d7aa99882ee
7
- data.tar.gz: babab2523a37de3b562008177980c36f37e7c8588c2de46888d9b428683e3c608e8fe012cefc3aba0891b9fc411dc79bac2f6dec4e50fdd9ae4b2de6e0888ad6
6
+ metadata.gz: c9a64cb0a982138da460170ee206898f1bba7ae37679ca258c26190c11f75a9514ed5e6612a01e123daf3b4cc28540bd21d1ea48629d912126e1c1b19796e6a9
7
+ data.tar.gz: d97e5b98db6dde250125e0a6f8b646eda517921b45743f3a1e5fe0ec3360593d7e76ae02d2cf79414ee58c4e91f79a8f393319f63b7cad900555e96ced05ac87
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Antex
5
- VERSION = '0.6.1'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
data/lib/jekyll/antex.rb CHANGED
@@ -8,6 +8,17 @@ require 'jekyll/antex/block'
8
8
 
9
9
  module Jekyll
10
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
+
11
22
  def self.run_jobs
12
23
  jekyll_antex_jobs = Jekyll::Antex.jobs
13
24
  jobs_count = jekyll_antex_jobs.count
@@ -38,20 +49,18 @@ end
38
49
  # NOTE: I'm conflicted, but regexp flags in yaml must be easy to use.
39
50
  SafeYAML::OPTIONS[:whitelisted_tags].push('!ruby/regexp')
40
51
 
41
- Jekyll::Hooks.register :site, :pre_render do
52
+ Jekyll::Hooks.register :site, :pre_render do |site|
42
53
  Jekyll::Antex.jobs = {}
43
- end
44
-
45
- # NOTE: we're not registering :posts since they are included in :documents.
46
- Jekyll::Hooks.register [:documents, :pages], :pre_render do |resource|
54
+ Jekyll::Antex.gather_resources(site).each do |resource|
47
55
  resource.content = Jekyll::Antex::Dealiaser.run(resource)
56
+ end
48
57
  end
49
58
 
50
59
  Liquid::Template.register_tag('antex', Jekyll::Antex::Block)
51
60
 
52
61
  Jekyll::Hooks.register :site, :post_render do |site|
53
62
  Jekyll::Antex.run_jobs
54
- [*site.pages, *site.documents].each do |resource|
63
+ Jekyll::Antex.gather_resources(site).each do |resource|
55
64
  # NOTE: skip unrendered resources e.g. when using --incremental
56
65
  next if resource.output.nil?
57
66
  resource.output = Jekyll::Antex.inject_style_attributes(resource.output)
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.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Brasolin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-11 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
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  requirements: []
210
- rubygems_version: 3.1.4
210
+ rubygems_version: 3.1.6
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Universal TeX integration for Jekyll