jekyll-antex 0.8.0 → 0.8.1

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: 38cc80b080df5998a00550b7046fa6518e8842d4b225abe15ff21c39ced1290b
4
- data.tar.gz: 064c607a0b8d825356b22fb6f6837526fd536ca64b13bfa0dc9cb054e9f945bb
3
+ metadata.gz: 2b5addd8c7dd7101a0e9c741f1841a84c7073c742c7b4f2edbb0817b5a38d76b
4
+ data.tar.gz: bc9649c9722b99f7785a69ca95555be020876ab488c71778b33d15469c2fb3f2
5
5
  SHA512:
6
- metadata.gz: '082e533cae85f3ec1ac9f8db5a1d80cf0f1574b876e6e37cf5e874a1ab7787e1aa606af2979e170818743391d4e06e8c05486947d0426b70970da43c48463dc1'
7
- data.tar.gz: '08e6bdd8202cf293cfe4b93cdcdfc8103464559196b1362d1b76f9f5e5f073194effa619085f9913ca366bad1eff24573dd5b9be4ea43c20aaa54fc44eaaca48'
6
+ metadata.gz: e9c47f9570936bffe9f87f6fb26c6944b84f9c8edacecc8e8a43b431fc4f42620f318c188c279cb5eace24d71a65a34f302b54bc2ae14d508ce737b2112570ac
7
+ data.tar.gz: 4718eae474054f548305faa64f60f47b7df9e7b5bff3eaa3097a5f666df6680ee512b5e3acf690a4104cbc75009279e3fd468be3d99344dfc1e475b909a5bb81
@@ -67,6 +67,7 @@ module Jekyll
67
67
  style = render_style_attribute_value(job.set_box)
68
68
  path = File.read(job.files['svg'])
69
69
  svg = Nokogiri::XML(path).at_css('svg')
70
+ prefix_svg_symbols_ids(svg, placeholder[HASH_ATTR_NAME])
70
71
  svg.remove_attribute('width')
71
72
  svg.remove_attribute('height')
72
73
  svg.set_attribute('style', style)
@@ -74,6 +75,16 @@ module Jekyll
74
75
  placeholder.remove()
75
76
  end
76
77
 
78
+ def self.prefix_svg_symbols_ids(doc, pfx)
79
+ # NOTE: in theory String#insert is destructive but node attribute getter/setters must be doing something weird...
80
+ doc.css("defs > [id]").each do |node|
81
+ node[:id] = node[:id].insert(0, pfx + "-")
82
+ end
83
+ doc.css("use").each do |node|
84
+ node[:"xlink:href"] = node[:"xlink:href"].insert(1, pfx + "-")
85
+ end
86
+ end
87
+
77
88
  def self.render_placeholder_tag(job)
78
89
  "<object #{HASH_ATTR_NAME}='#{job.hash}'></object>"
79
90
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Antex
5
- VERSION = '0.8.0'
5
+ VERSION = '0.8.1'
6
6
  end
7
7
  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.8.0
4
+ version: 0.8.1
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-08-25 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: antex