asciidoctor-dita-topic 1.5.4 → 1.5.6

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: a7db48788b397b2e457ca5240562dcaf64e82e16c3564861b540e73799686a10
4
- data.tar.gz: 4ae2eeb544f034824c3a38ac4e49664be740a6599ee3aa5da7c88a1fbcfceed4
3
+ metadata.gz: c9483eccb7fb179228b0139123e596f83b4839704945e703c501de9aeb424a22
4
+ data.tar.gz: 1d29ee12f77dab2d75e8038c65b37d11d4400d5450c747d9864b6a358921b5e8
5
5
  SHA512:
6
- metadata.gz: 4162bfcb43ca9a51c16635f5283f808c2090b2377ef66d37901f014bac10bb6ed4ea8146bc89543f4bc8873e60dddb82eb3d9aac3228629c7d0508332e09f88e
7
- data.tar.gz: 1cd14f6c72b84872e48e38d0c37f036014efe6661dd200be5d9052102d0143ccedb41b44f91b279ff83d8fd1e7bbe98dd322ce57e207ea341d5dc3b2bb93440e
6
+ metadata.gz: 5cf176f0c0d0d234452d8380240203419fd528f13677fa314756474e28a34138982b0130e880e862a0c3280f9a8dcc8f570b251611fa4c2ba82b131244144b80
7
+ data.tar.gz: 5ce0805a250df4f3b862c2adb8f71be30f6cf580b73bb3672ad8b8be1dbe405004b2ce0bc34b03f88f5bb71ee133ca90104bab60d1d6f20521c31808ae32054e
@@ -73,7 +73,7 @@ module AsciidoctorDitaTopic
73
73
  @opts[:no_includes] = true
74
74
  end
75
75
 
76
- opt.on('-A', '--no-modules', 'disable processing of include directives with assemblies and modules') do
76
+ opt.on('-A', '--no-modules', 'disable processing of include directives with assemblies, modules, and attributes') do
77
77
  @opts[:modules] = false
78
78
  end
79
79
 
@@ -31,7 +31,13 @@ class FilterIncludeDirectives < Asciidoctor::Extensions::IncludeProcessor
31
31
  end
32
32
 
33
33
  def process doc, reader, target, attributes
34
- file_path = Pathname.new(doc.base_dir) + target
34
+ base_dir = Pathname.new(doc.base_dir)
35
+
36
+ if reader.cursor.file
37
+ file_path = base_dir + Pathname.new(reader.cursor.file).dirname + target
38
+ else
39
+ file_path = base_dir + target
40
+ end
35
41
 
36
42
  begin
37
43
  logger = Asciidoctor::LoggerManager.logger
@@ -55,6 +61,6 @@ class FilterIncludeDirectives < Asciidoctor::Extensions::IncludeProcessor
55
61
  type = attributes['_content-type'] ? attributes['_content-type'].downcase : nil unless type
56
62
  type = attributes['_module-type'] ? attributes['_module-type'].downcase : nil unless type
57
63
 
58
- ['attributes', 'snippet'].include? type
64
+ ['snippet'].include? type
59
65
  end
60
66
  end
@@ -24,6 +24,6 @@
24
24
  # frozen_string_literal: true
25
25
 
26
26
  module AsciidoctorDitaTopic
27
- VERSION = '1.5.4'
27
+ VERSION = '1.5.6'
28
28
  NAME = 'dita-topic'
29
29
  end
data/lib/dita-topic.rb CHANGED
@@ -524,11 +524,17 @@ class DitaTopic < Asciidoctor::Converter::Base
524
524
  # Check whether the source language is defined:
525
525
  language = (node.attributes.key? 'language') ? %( outputclass="language-#{node.attributes['language']}") : ''
526
526
 
527
- # Compose the XML output:
528
- result = %(<codeblock#{language}#{compose_id node.id}#{compose_metadata node.role}>#{node.content}</codeblock>)
529
-
530
- # Return the XML output:
531
- add_block_title result, node
527
+ # Check if the listing has a title specified:
528
+ if node.title?
529
+ # Compose the XML output:
530
+ <<~EOF.chomp
531
+ <p#{compose_id node.id}#{compose_metadata node.role}><b>#{node.title}</b></p>
532
+ <codeblock#{language}#{compose_metadata node.role}>#{node.content}</codeblock>
533
+ EOF
534
+ else
535
+ # Compose the XML output:
536
+ %(<codeblock#{language}#{compose_id node.id}#{compose_metadata node.role}>#{node.content}</codeblock>)
537
+ end
532
538
  end
533
539
 
534
540
  def convert_literal node
@@ -537,6 +543,18 @@ class DitaTopic < Asciidoctor::Converter::Base
537
543
 
538
544
  # Return the XML output:
539
545
  add_block_title result, node
546
+
547
+ # Check if the listing has a title specified:
548
+ if node.title?
549
+ # Compose the XML output:
550
+ <<~EOF.chomp
551
+ <p#{compose_id node.id}#{compose_metadata node.role}><b>#{node.title}</b></p>
552
+ <pre#{compose_metadata node.role}>#{node.content}</pre>
553
+ EOF
554
+ else
555
+ # Compose the XML output:
556
+ %(<pre#{compose_id node.id}#{compose_metadata node.role}>#{node.content}</pre>)
557
+ end
540
558
  end
541
559
 
542
560
  def convert_olist node
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-dita-topic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 4.0.21
143
+ rubygems_version: 4.0.22
144
144
  specification_version: 4
145
145
  summary: A custom AsciiDoc converter that generates individual DITA topics
146
146
  test_files: []