isodoc 3.7.22 → 3.7.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbf70f2270108a9954659cb9a101a731e81c333e9d7b8b2206888bb3a6d7cd99
4
- data.tar.gz: c33ceb407707efcc89acbb01d913bc68d0aed61c5722d2afe7e76927b67226a8
3
+ metadata.gz: 2b1e48dc9ed79bc03c0ad1a12af68a42bb5578647c8860a574df9c8636911fb8
4
+ data.tar.gz: 4a1fcaf6f8dae75fc2d15bc69a691efa537fdde1f56a8b84be8df32e0a1e826b
5
5
  SHA512:
6
- metadata.gz: 647e985063f6a163df57c24e278eab3b5b57c4755bd3f9423b0aecf1a42d510bb3d808ee35a5427cdcfadc5263b20ba8740989a539448591e9a828ba8f501b6d
7
- data.tar.gz: 82e7df3303fad27057a4104b271fea4ee42696e86811e972bacf03d2670beea904abfa253637dd893217a868b3d8322083e56240a34501b5f03fe1849bff6a9d
6
+ metadata.gz: 8e9b23211a5322bbb620a1cb7b3a74d173dab99a50ad1ae434fd363d1470ab0a61cdb6e41ebbd472dec57fe3548e290df647c4f3fab59ce2a68d3814fa6d3348
7
+ data.tar.gz: 97260e3c8b3aa1f48604772956ee32aca6429caa4265d4837f7818ae0c7e0887554541eda411193bd8c2edb965b8a05b3c3bde05a9c8213e3d726d37c9fcc189
@@ -137,10 +137,22 @@ module IsoDoc
137
137
  dest = docxml.at("//div[@id = 'toc']") or return
138
138
  if source = docxml.at("//div[@class = 'TOC']")
139
139
  dest << to_xml(source.remove.children)
140
+ toc_retarget_source_anchors(dest, source["id"])
140
141
  end
141
142
  dest
142
143
  end
143
144
 
145
+ # The ToC clause headings moved into the destination carry anchor
146
+ # permalinks minted by heading_anchors, pointing at the id of the
147
+ # ToC clause div that has just been removed. Retarget them at the
148
+ # destination the headings now live in, so they do not dangle.
149
+ def toc_retarget_source_anchors(dest, source_id)
150
+ dest.xpath(".//a[@class = 'anchor' or @class = 'header']" \
151
+ "[@href = '##{source_id}']").each do |a|
152
+ a["href"] = "##{dest['id']}"
153
+ end
154
+ end
155
+
144
156
  def html_toc_entries(docxml, path)
145
157
  headers = html_toc_entries_prep(docxml, path)
146
158
  path.each_with_index.with_object([]) do |(p, i), m|
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.7.22".freeze
2
+ VERSION = "3.7.23".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.22
4
+ version: 3.7.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.