asciidoctor-dita-topic 1.3.2 → 1.3.3

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 +21 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf26fdeafc9634faed7fdbfd75e19d8d249f2a80643a11985100debab1cf43de
4
- data.tar.gz: e5ccc018b1894f7ea87bae9bd2839839c49f97b3c0c13c17e0ad51ba11e6dbd2
3
+ metadata.gz: 4fc29eafdbe1a2cdf7ef447e252ecdcabc80af754902559bcf228e38e3b2fe04
4
+ data.tar.gz: 3ebd2721f248a9ad8dc20d428bfeb0fe6b0f1f74e8b9a24b2e62860b2bfc140f
5
5
  SHA512:
6
- metadata.gz: 245f4881e471dbc9c48e7e6f57206f0289ace1785a320c4edcbbed7f217942eb9f2168f4a992aa909b5e91547ae3dffd409612a7b328b646c4609728c9f1d13c
7
- data.tar.gz: df1afd0adc48153663f6f66186d2afdf4c290cedd2265be499d426b9a467c4e61e21557af0573c8b95ce1ee64b8da27a4dfc4193de3cd566a7dfafec745c011e
6
+ metadata.gz: f5da5464ce466a101f87d0a047f87debb40bbb4a5ac185a5702a422e68cc9e6c4ba6bb5d5599acd38393e0e7f29824296a3a09391de91f503eecc7740f721801
7
+ data.tar.gz: cb90250840fa7fa9d8ac808dc1bbdec7b85f8f2a2378cad970c95e6705f3456331478571fc5616b365dc0dda552f800d68628f507bebb92857761b3d560866d9
data/lib/dita-topic.rb CHANGED
@@ -530,13 +530,17 @@ class DitaTopic < Asciidoctor::Converter::Base
530
530
 
531
531
  # Process individual list items:
532
532
  node.items.each do |item|
533
+ # Compose the metadata attributes:
534
+ metadata, text = extract_attributes item.text
535
+ metadata = compose_metadata item.role if item.role
536
+
533
537
  # Check if the list item contains multiple block elements:
534
538
  if item.blocks?
535
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{item.text})
539
+ result << %(<li#{compose_id item.id}#{metadata}>#{text})
536
540
  result << item.content
537
541
  result << %(</li>)
538
542
  else
539
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{item.text}</li>)
543
+ result << %(<li#{compose_id item.id}#{metadata}>#{text}</li>)
540
544
  end
541
545
  end
542
546
 
@@ -766,6 +770,10 @@ class DitaTopic < Asciidoctor::Converter::Base
766
770
 
767
771
  # Process individual list items:
768
772
  node.items.each do |item|
773
+ # Compose the metadata attributes:
774
+ metadata, text = extract_attributes item.text
775
+ metadata = compose_metadata item.role if item.role
776
+
769
777
  # Check if the list item is part of a checklist:
770
778
  unless item.attr? 'checkbox'
771
779
  check_box = ''
@@ -775,11 +783,11 @@ class DitaTopic < Asciidoctor::Converter::Base
775
783
 
776
784
  # Check if the list item contains multiple block elements:
777
785
  if item.blocks?
778
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{check_box}#{item.text})
786
+ result << %(<li#{compose_id item.id}#{metadata}>#{check_box}#{text})
779
787
  result << item.content
780
788
  result << %(</li>)
781
789
  else
782
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{check_box}#{item.text}</li>)
790
+ result << %(<li#{compose_id item.id}#{metadata}>#{check_box}#{text}</li>)
783
791
  end
784
792
  end
785
793
 
@@ -1053,6 +1061,15 @@ class DitaTopic < Asciidoctor::Converter::Base
1053
1061
  end
1054
1062
  end
1055
1063
 
1064
+ def extract_attributes text
1065
+ # Extract metadata attributes from an empty ph element:
1066
+ if /^\s*<ph(?<attributes> [^>]+)><\/ph>\s*/ =~ text
1067
+ return attributes, text.sub(/^\s*<ph[^>]+><\/ph>\s*/, '')
1068
+ else
1069
+ return '', text
1070
+ end
1071
+ end
1072
+
1056
1073
  def format_message message
1057
1074
  # Compose the warning or error message:
1058
1075
  file_name = (defined? @file_name) ? %( #{@file_name}:) : ''
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.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek