asciidoctor-dita-topic 1.1.3 → 1.1.4

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 +13 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26ce0f384369b685c43454ec161ac81cdd99c630c85bef52d16e0cff55423166
4
- data.tar.gz: ba0257aa9f21b1f958e07103ecc9c7bd5476bf02038c0110feeb8c8c0fc36731
3
+ metadata.gz: c8500891ad21dc6be419992bbb3ce0746bfb3c5e96f4cdb5c0faea28cd00fe59
4
+ data.tar.gz: df920f7ae7d468b8e981a05d1a16c932e2fcd31d9e22d22b5e7406cef880ca01
5
5
  SHA512:
6
- metadata.gz: bf9814f61b806557250d29b32cf5ae640cf4345a9e5657a856ce4173de9cbdbc1a2a89a4295a528a82d073f4ccae11a3b321e00902531ed9c18256f8dd6472f9
7
- data.tar.gz: c0693f56fccd42fdc39813a676ca5475670bd7aa5e4a3a5ecb71d45e140d2bfb8861bc093fa6334af3bb4c1f20fafc143237f03557fda52f816a9b055b0b4459
6
+ metadata.gz: d788246489a2ce5c11b1f293401d70efbc373c4561e266a497bee45a7de82fc20cae10a3cf3dcded6635e1054279a51250405d36fb6bd219c7602636d6ed2aa9
7
+ data.tar.gz: 9d4a9e9638f983baf60e401d3d4477c29036d028a12c751acd9e6e88527bcb97238838cccd9234cb750b560b76b23693bfa50726b483c853355eedaee0bf5f52
data/lib/dita-topic.rb CHANGED
@@ -29,6 +29,8 @@ class DitaTopic < Asciidoctor::Converter::Base
29
29
  NAME = 'dita-topic'
30
30
  register_for NAME
31
31
 
32
+ require 'securerandom'
33
+
32
34
  def initialize *args
33
35
  super
34
36
  outfilesuffix '.dita'
@@ -70,7 +72,7 @@ class DitaTopic < Asciidoctor::Converter::Base
70
72
  # Open the document:
71
73
  result = ["<?xml version='1.0' encoding='utf-8' ?>"]
72
74
  result << %(<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">)
73
- result << %(<topic#{compose_id (node.id or node.attributes['docname'])}#{outputclass}>)
75
+ result << %(<topic#{compose_id (node.id or node.attributes['docname'] or 'topic-'+SecureRandom.uuid)}#{outputclass}>)
74
76
  result << %(<title>#{node.doctitle}</title>)
75
77
 
76
78
  # Check if the author line is enabled and defined:
@@ -353,9 +355,17 @@ class DitaTopic < Asciidoctor::Converter::Base
353
355
  compose_circled_number node.text.to_i
354
356
  end
355
357
 
356
- # FIXME: Add support for footnoteref equivalent.
357
358
  def convert_inline_footnote node
358
- %(<fn>#{node.text}</fn>)
359
+ # Check whether the footnote is a definition or a reference:
360
+ if node.type == :xref
361
+ %(<xref href="#./#{node.target}" type="fn" />)
362
+ elsif node.id
363
+ # Define the footnote and immediately reference it to match AsdciiDoc
364
+ # behavior:
365
+ %(<fn#{compose_id node.id}>#{node.text}</fn><xref href="#./#{node.id}" type="fn" />)
366
+ else
367
+ %(<fn>#{node.text}</fn>)
368
+ end
359
369
  end
360
370
 
361
371
  def convert_inline_image node
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.3
4
+ version: 1.1.4
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-03-27 00:00:00.000000000 Z
11
+ date: 2025-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor