asciidoctor-dita-topic 1.1.0 → 1.1.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dita-topic.rb +12 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 134df897545adafba05f060ea22079c3fa927204b47fff2eec8ffbc8ae5ef84a
4
- data.tar.gz: 354b8abadd320b9a4c63b3c170a85974a2231836da07851e1cde58da06aafff3
3
+ metadata.gz: 687ae8806b7e15e26af816a9c422c4eb9f6d641952d3322ecec1a548e3818b27
4
+ data.tar.gz: 1831689de933e1fb931b156f4a9d7333e4200597ac352caf8a83345b819b120e
5
5
  SHA512:
6
- metadata.gz: 4b7e9fcd688f450a2e05effca4c30d5969db15d7056cd23b6c1829d6f65de79cc95e0208f5dc543b5bd2f87117aa972f49dcff76963ef8b67879f5a40a97af6f
7
- data.tar.gz: 05122aac651d614082cc4cb350197bdbb897d2b7436189eb225a230ffc3f8ad2f3ee5d66f1b882f78bab39d4fd38d18caaeba0d1b5dd965c98ccd7f52a530f97
6
+ metadata.gz: c41f5028246471fd6f82eced7c21d15bcef16dadf480a29dc51a5089b60d0c1b8987198ae5d7bf615f377e230b736563f576fad179897bc7e0e3b95324880a1d
7
+ data.tar.gz: 4ab12c7fbeeb054aa08200b9c1a16163459d9a0c9bd3852a7fc348ae8943e73a4872ff1e26a634b171aaa46e2cb916d11d9b65f9c53f5f4df2b5e4a781345198
data/lib/dita-topic.rb CHANGED
@@ -278,20 +278,26 @@ class DitaTopic < Asciidoctor::Converter::Base
278
278
  # I do not want to process them from this script, I choose to issue a
279
279
  # warning so that the user can resolve the problem.
280
280
 
281
- # Determine whether the cross reference links to a file path or an ID:
281
+ # Determine whether the cross reference links to a file path:
282
282
  if (path = node.attributes['path'])
283
283
  # Issue a warning if the cross reference includes an ID:
284
284
  logger.warn "#{NAME}: Possible invalid reference: #{node.target}" if node.target.include? '#'
285
285
 
286
286
  # Compose a cross reference:
287
- %(<xref href="#{node.target}">#{node.text || path}</xref>)
288
- else
289
- # Issue a warning as the cross reference is unlikely to work:
290
- logger.warn "#{NAME}: Possible invalid reference: #{node.target}"
287
+ return %(<xref href="#{node.target}">#{node.text || path}</xref>)
288
+ end
291
289
 
290
+ # Determine whether the ID reference target is in this document:
291
+ if node.document.catalog[:refs].key? (target = node.target.delete_prefix '#')
292
292
  # Compose the cross reference:
293
- node.text ? %(<xref href="#{node.target}">#{node.text}</xref>) : %(<xref href="#{node.target}" />)
293
+ return node.text ? %(<xref href="#./#{target}">#{node.text}</xref>) : %(<xref href="#./#{target}" />)
294
294
  end
295
+
296
+ # Issue a warning as the cross reference is unlikely to work:
297
+ logger.warn "#{NAME}: Possible invalid reference: #{node.target}"
298
+
299
+ # Compose the cross reference:
300
+ node.text ? %(<xref href="#{node.target}">#{node.text}</xref>) : %(<xref href="#{node.target}" />)
295
301
  when :ref
296
302
  # NOTE: DITA does not have a dedicated element for inline anchors or
297
303
  # a direct equivalent of the <span> element from HTML. The solution
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-dita-topic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-24 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor