asciidoctor-dita-topic 1.1.1 → 1.1.2

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +13 -1
  3. data/lib/dita-topic.rb +17 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 687ae8806b7e15e26af816a9c422c4eb9f6d641952d3322ecec1a548e3818b27
4
- data.tar.gz: 1831689de933e1fb931b156f4a9d7333e4200597ac352caf8a83345b819b120e
3
+ metadata.gz: 172e330842b5b5f390c287fd0adfe4e51a055c669145c09a0a4b07d7a85057ba
4
+ data.tar.gz: 3e76bd3a36ed2954827156500d393ac982506862395fbceb30b84c075db95e72
5
5
  SHA512:
6
- metadata.gz: c41f5028246471fd6f82eced7c21d15bcef16dadf480a29dc51a5089b60d0c1b8987198ae5d7bf615f377e230b736563f576fad179897bc7e0e3b95324880a1d
7
- data.tar.gz: 4ab12c7fbeeb054aa08200b9c1a16163459d9a0c9bd3852a7fc348ae8943e73a4872ff1e26a634b171aaa46e2cb916d11d9b65f9c53f5f4df2b5e4a781345198
6
+ metadata.gz: 4f5cc15df1b03d9198a87d9996859b067a957928375a6469c8901c3850d76dc0f06f5f3e9e3ff9eb86a8f369c55bf9d7c9a9074e2937ff5798b7b9157bb4a428
7
+ data.tar.gz: 2986bb1e278b253df0d1d0768d695e8799191253f3527c58f8ef027159ce237e7a09e517dfa78d6cc1043d0c437ff09866848c6ddbe8db7cbb7781806c342252
data/README.adoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = dita-topic
2
2
 
3
- `dita-topic` is a custom converter for Asciidoctor that converts a single AsciiDoc file to a corresponding DITA topic. To convert the produced DITA topic to a specialized DITA concept, reference, or task, use the link:https://github.com/jhradilek/dita-custom-xslt[dita_convert Python package].
3
+ `dita-topic` is a custom converter for Asciidoctor that converts a single AsciiDoc file to a corresponding DITA topic. To convert the produced DITA topic to a specialized DITA concept, reference, or task, use the link:https://github.com/jhradilek/dita-custom-xslt#installation[dita-convert Python package].
4
4
 
5
5
  [#install]
6
6
  == Installation
@@ -121,6 +121,18 @@ To disable this behavior, set the value of the `dita-topic-callouts` to `off`:
121
121
  $ **asciidoctor -r dita-topic -b dita-topic -a dita-topic-callouts=off _your_file_.adoc**
122
122
  ....
123
123
 
124
+ [#abstracts]
125
+ === Disable abstracts
126
+
127
+ By default, the `dita-topic` converter recognizes a paragraph preceded by the `[role="_abstract"]` attribute list and preserves this information by adding the `outputclass="abstract"` attribute to it in DITA. The link:https://github.com/jhradilek/dita-custom-xslt#installation[dita-convert Python package] uses this attribute to populate the `<shortdesc>` element during conversion to a specialized DITA concept, reference, or task.
128
+
129
+ To disable this behavior, set the value of the `dita-topic-abstracts` to `off`:
130
+
131
+ [literal,subs="+quotes"]
132
+ ....
133
+ $ **asciidoctor -r dita-topic -b dita-topic -a dita-topic-abstracts=off _your_file_.adoc**
134
+ ....
135
+
124
136
  [#includes]
125
137
  === Disabling include directives
126
138
 
data/lib/dita-topic.rb CHANGED
@@ -36,6 +36,9 @@ class DitaTopic < Asciidoctor::Converter::Base
36
36
  # Disable the author line by default:
37
37
  @authors_allowed = false
38
38
 
39
+ # Enable abstract paragraphs by default:
40
+ @abstracts_allowed = true
41
+
39
42
  # Enable callouts by default:
40
43
  @callouts_allowed = true
41
44
 
@@ -47,14 +50,20 @@ class DitaTopic < Asciidoctor::Converter::Base
47
50
  # Check if the author line is enabled:
48
51
  @authors_allowed = true if (node.attr 'dita-topic-authors') == 'on'
49
52
 
53
+ # Check if abstract paragraphs are enabled:
54
+ @abstracts_allowed = false if (node.attr 'dita-topic-abstracts') == 'off'
55
+
50
56
  # Check if callouts are enabled:
51
57
  @callouts_allowed = false if (node.attr 'dita-topic-callouts') == 'off'
52
58
 
53
59
  # Check if floating and block titles are enabled:
54
60
  @titles_allowed = false if (node.attr 'dita-topic-titles') == 'off'
55
61
 
56
- # Check if the modular documentation content type is specified:
62
+ # Check if the modular documentation content type is specified; both
63
+ # _module-type and _content-type are deprecated, but still present in
64
+ # some modules:
57
65
  outputclass = ''
66
+ outputclass = %( outputclass="#{(node.attr '_module-type').downcase}") if node.attr? '_module-type'
58
67
  outputclass = %( outputclass="#{(node.attr '_content-type').downcase}") if node.attr? '_content-type'
59
68
  outputclass = %( outputclass="#{(node.attr '_mod-docs-content-type').downcase}") if node.attr? '_mod-docs-content-type'
60
69
 
@@ -460,8 +469,7 @@ class DitaTopic < Asciidoctor::Converter::Base
460
469
  node.items.each do |item|
461
470
  # Check if the list item contains multiple block elements:
462
471
  if item.blocks?
463
- result << %(<li>)
464
- result << %(<p>#{item.text}</p>)
472
+ result << %(<li>#{item.text})
465
473
  result << item.content
466
474
  result << %(</li>)
467
475
  else
@@ -507,7 +515,11 @@ class DitaTopic < Asciidoctor::Converter::Base
507
515
  end
508
516
 
509
517
  def convert_paragraph node
510
- add_block_title %(<p>#{node.content}</p>), node.title
518
+ if @abstracts_allowed and (node.attr 'role') == '_abstract'
519
+ add_block_title %(<p outputclass="abstract">#{node.content}</p>), node.title
520
+ else
521
+ add_block_title %(<p>#{node.content}</p>), node.title
522
+ end
511
523
  end
512
524
 
513
525
  def convert_preamble node
@@ -691,8 +703,7 @@ class DitaTopic < Asciidoctor::Converter::Base
691
703
 
692
704
  # Check if the list item contains multiple block elements:
693
705
  if item.blocks?
694
- result << %(<li>)
695
- result << %(<p>#{check_box}#{item.text}</p>)
706
+ result << %(<li>#{check_box}#{item.text})
696
707
  result << item.content
697
708
  result << %(</li>)
698
709
  else
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.1
4
+ version: 1.1.2
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-17 00:00:00.000000000 Z
11
+ date: 2025-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor