asciidoctor-dita-topic 1.3.2 → 1.3.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 +37 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf26fdeafc9634faed7fdbfd75e19d8d249f2a80643a11985100debab1cf43de
4
- data.tar.gz: e5ccc018b1894f7ea87bae9bd2839839c49f97b3c0c13c17e0ad51ba11e6dbd2
3
+ metadata.gz: 62056b90729ed2ccfcfad7a3fa3613938cf943c67b535d4f6653b1aa009a79a9
4
+ data.tar.gz: 558a40909a4eea3b5a1bae2327e12c3116d679d5fbbd71cf4f70f990fd23fabf
5
5
  SHA512:
6
- metadata.gz: 245f4881e471dbc9c48e7e6f57206f0289ace1785a320c4edcbbed7f217942eb9f2168f4a992aa909b5e91547ae3dffd409612a7b328b646c4609728c9f1d13c
7
- data.tar.gz: df1afd0adc48153663f6f66186d2afdf4c290cedd2265be499d426b9a467c4e61e21557af0573c8b95ce1ee64b8da27a4dfc4193de3cd566a7dfafec745c011e
6
+ metadata.gz: 84b3e6f51d7712fb8974fce8c4c3f184b90f1853cf442306ec24d8ab3a32e01f49ee9cec24885baeb26eafb6f7837a76117ffce14f4c7187436f153209864013
7
+ data.tar.gz: 2c53bb543c270dcc48597b8cc9c16e914ec62393dec275064ae6e5423ed7b8c4898e3df59ffa83145779ef9f8124555b1f6cae5c2a51e6d539ac39356276ea6a
data/lib/dita-topic.rb CHANGED
@@ -202,8 +202,11 @@ class DitaTopic < Asciidoctor::Converter::Base
202
202
 
203
203
  # Process individual list items:
204
204
  node.items.each do |terms, description|
205
+ # Compose the metadata attributes:
206
+ metadata, terms[0].text = extract_attributes terms[0].text
207
+
205
208
  # Open the definition entry:
206
- result << %(<dlentry>)
209
+ result << %(<dlentry#{metadata}>)
207
210
 
208
211
  # Process individual terms:
209
212
  terms.each do |item|
@@ -530,13 +533,17 @@ class DitaTopic < Asciidoctor::Converter::Base
530
533
 
531
534
  # Process individual list items:
532
535
  node.items.each do |item|
536
+ # Compose the metadata attributes:
537
+ metadata, text = extract_attributes item.text
538
+ metadata = compose_metadata item.role if item.role
539
+
533
540
  # Check if the list item contains multiple block elements:
534
541
  if item.blocks?
535
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{item.text})
542
+ result << %(<li#{compose_id item.id}#{metadata}>#{text})
536
543
  result << item.content
537
544
  result << %(</li>)
538
545
  else
539
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{item.text}</li>)
546
+ result << %(<li#{compose_id item.id}#{metadata}>#{text}</li>)
540
547
  end
541
548
  end
542
549
 
@@ -701,8 +708,11 @@ class DitaTopic < Asciidoctor::Converter::Base
701
708
 
702
709
  # Process each row:
703
710
  rows.each do |row|
711
+ # Compose the metadata attributes:
712
+ metadata, row[0].text = extract_attributes row[0].text
713
+
704
714
  # Open the row:
705
- result << %(<row>)
715
+ result << %(<row#{metadata}>)
706
716
 
707
717
  # Process each cell:
708
718
  row.each do |cell|
@@ -766,6 +776,10 @@ class DitaTopic < Asciidoctor::Converter::Base
766
776
 
767
777
  # Process individual list items:
768
778
  node.items.each do |item|
779
+ # Compose the metadata attributes:
780
+ metadata, text = extract_attributes item.text
781
+ metadata = compose_metadata item.role if item.role
782
+
769
783
  # Check if the list item is part of a checklist:
770
784
  unless item.attr? 'checkbox'
771
785
  check_box = ''
@@ -775,11 +789,11 @@ class DitaTopic < Asciidoctor::Converter::Base
775
789
 
776
790
  # Check if the list item contains multiple block elements:
777
791
  if item.blocks?
778
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{check_box}#{item.text})
792
+ result << %(<li#{compose_id item.id}#{metadata}>#{check_box}#{text})
779
793
  result << item.content
780
794
  result << %(</li>)
781
795
  else
782
- result << %(<li#{compose_id item.id}#{compose_metadata item.role}>#{check_box}#{item.text}</li>)
796
+ result << %(<li#{compose_id item.id}#{metadata}>#{check_box}#{text}</li>)
783
797
  end
784
798
  end
785
799
 
@@ -849,8 +863,11 @@ class DitaTopic < Asciidoctor::Converter::Base
849
863
 
850
864
  # Process individual list items:
851
865
  node.items.each do |terms, description|
866
+ # Compose the metadata attributes:
867
+ metadata, terms[0].text = extract_attributes terms[0].text
868
+
852
869
  # Open the list item:
853
- result << %(<li>)
870
+ result << %(<li#{metadata}>)
854
871
 
855
872
  # Process individual terms:
856
873
  terms.each do |item|
@@ -889,8 +906,11 @@ class DitaTopic < Asciidoctor::Converter::Base
889
906
 
890
907
  # Process individual list items:
891
908
  node.items.each do |terms, description|
909
+ # Compose the metadata attributes:
910
+ metadata, terms[0].text = extract_attributes terms[0].text
911
+
892
912
  # Open the table row:
893
- result << %(<row>)
913
+ result << %(<row#{metadata}>)
894
914
 
895
915
  # Check the number of terms to process:
896
916
  if terms.count == 1
@@ -1053,6 +1073,15 @@ class DitaTopic < Asciidoctor::Converter::Base
1053
1073
  end
1054
1074
  end
1055
1075
 
1076
+ def extract_attributes text
1077
+ # Extract metadata attributes from an empty ph element:
1078
+ if /^\s*<ph(?<attributes> [^>]+)><\/ph>\s*/ =~ text
1079
+ return attributes, text.sub(/^\s*<ph[^>]+><\/ph>\s*/, '')
1080
+ else
1081
+ return '', text
1082
+ end
1083
+ end
1084
+
1056
1085
  def format_message message
1057
1086
  # Compose the warning or error message:
1058
1087
  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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - ">="
98
98
  - !ruby/object:Gem::Version
99
- version: '0'
99
+ version: '3.0'
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="