metanorma-standoc 1.8.6 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +5 -3
  4. data/Gemfile.devel +0 -0
  5. data/lib/asciidoctor/standoc/base.rb +41 -36
  6. data/lib/asciidoctor/standoc/biblio.rng +4 -6
  7. data/lib/asciidoctor/standoc/blocks.rb +44 -14
  8. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  9. data/lib/asciidoctor/standoc/cleanup.rb +33 -78
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +77 -62
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
  12. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  13. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  14. data/lib/asciidoctor/standoc/cleanup_maths.rb +37 -28
  15. data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -15
  16. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  17. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  18. data/lib/asciidoctor/standoc/cleanup_section.rb +21 -15
  19. data/lib/asciidoctor/standoc/converter.rb +10 -3
  20. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  21. data/lib/asciidoctor/standoc/front.rb +35 -18
  22. data/lib/asciidoctor/standoc/front_contributor.rb +5 -5
  23. data/lib/asciidoctor/standoc/inline.rb +1 -1
  24. data/lib/asciidoctor/standoc/isodoc.rng +304 -1
  25. data/lib/asciidoctor/standoc/lists.rb +4 -2
  26. data/lib/asciidoctor/standoc/macros.rb +50 -23
  27. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  28. data/lib/asciidoctor/standoc/ref.rb +87 -112
  29. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  30. data/lib/asciidoctor/standoc/ref_sect.rb +22 -19
  31. data/lib/asciidoctor/standoc/section.rb +3 -1
  32. data/lib/asciidoctor/standoc/terms.rb +27 -16
  33. data/lib/asciidoctor/standoc/utils.rb +35 -9
  34. data/lib/asciidoctor/standoc/validate.rb +30 -28
  35. data/lib/metanorma-standoc.rb +0 -1
  36. data/lib/metanorma/standoc/version.rb +5 -5
  37. data/metanorma-standoc.gemspec +11 -11
  38. data/spec/asciidoctor/base_spec.rb +78 -8
  39. data/spec/asciidoctor/blocks_spec.rb +832 -727
  40. data/spec/asciidoctor/cleanup_sections_spec.rb +52 -15
  41. data/spec/asciidoctor/cleanup_spec.rb +1860 -1874
  42. data/spec/asciidoctor/inline_spec.rb +272 -273
  43. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  44. data/spec/asciidoctor/macros_spec.rb +539 -437
  45. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  46. data/spec/asciidoctor/refs_spec.rb +135 -7
  47. data/spec/asciidoctor/section_spec.rb +743 -690
  48. data/spec/assets/html-override.css +1 -0
  49. data/spec/assets/word-override.css +1 -0
  50. data/spec/spec_helper.rb +11 -9
  51. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +60 -60
  52. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  53. data/spec/vcr_cassettes/isobib_get_123_1.yml +30 -30
  54. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +42 -42
  55. data/spec/vcr_cassettes/isobib_get_123_2001.yml +15 -15
  56. data/spec/vcr_cassettes/isobib_get_124.yml +15 -15
  57. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  58. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +53 -49
  59. metadata +72 -68
  60. data/.rubocop.ribose.yml +0 -66
  61. data/.rubocop.tb.yml +0 -650
  62. data/spec/asciidoctor/macros_lutaml_spec.rb +0 -80
@@ -21,7 +21,7 @@ module Asciidoctor
21
21
  end
22
22
  end
23
23
 
24
- def organization(org, orgname, node = nil, default_org = nil)
24
+ def organization(org, orgname, is_pub, node = nil, default_org = nil)
25
25
  abbrevs = org_abbrev
26
26
  n = abbrevs.invert[orgname] and orgname = n
27
27
  org.name orgname
@@ -29,7 +29,7 @@ module Asciidoctor
29
29
  abbr = org_abbrev[orgname]
30
30
  default_org && b = node.attr("subdivision-abbr") and abbr = b
31
31
  abbr and org.abbreviation abbr
32
- default_org and org_address(node, org)
32
+ is_pub && node and org_address(node, org)
33
33
  end
34
34
 
35
35
  def org_address(node, p)
@@ -59,7 +59,7 @@ module Asciidoctor
59
59
  xml.contributor do |c|
60
60
  c.role **{ type: "author" }
61
61
  c.organization do |a|
62
- organization(a, p, node, !node.attr("publisher"))
62
+ organization(a, p, false, node, !node.attr("publisher"))
63
63
  end
64
64
  end
65
65
  end
@@ -144,7 +144,7 @@ module Asciidoctor
144
144
  xml.contributor do |c|
145
145
  c.role **{ type: "publisher" }
146
146
  c.organization do |a|
147
- organization(a, p, node, !node.attr("publisher"))
147
+ organization(a, p, true, node, !node.attr("publisher"))
148
148
  end
149
149
  end
150
150
  end
@@ -157,7 +157,7 @@ module Asciidoctor
157
157
  c.from (node.attr("copyright-year") || Date.today.year)
158
158
  p.match(/[A-Za-z]/).nil? or c.owner do |owner|
159
159
  owner.organization do |a|
160
- organization(a, p, node, !pub)
160
+ organization(a, p, true, node, !pub)
161
161
  end
162
162
  end
163
163
  end
@@ -45,7 +45,7 @@ module Asciidoctor
45
45
 
46
46
  def inline_anchor_xref_attrs(node)
47
47
  m = /^(?<drop>droploc%)?(?<case>capital%|lowercase%)?(?<drop2>droploc%)?
48
- (?<fn>fn(:\s*(?<text>.*))?)?$/x.match node.text
48
+ (?<fn>fn:?\s*)?(?<text>.*)$/x.match node.text
49
49
  casing = m.nil? ? nil : m[:case]&.sub(/%$/, "")
50
50
  droploc = m.nil? ? nil : ((m[:drop].nil? && m[:drop2].nil?) ? nil: true)
51
51
  f = (m.nil? || m[:fn].nil?) ? "inline" : "footnote"
@@ -86,6 +86,35 @@
86
86
  <text/>
87
87
  </element>
88
88
  </define>
89
+ <define name="erefType">
90
+ <optional>
91
+ <attribute name="normative">
92
+ <data type="boolean"/>
93
+ </attribute>
94
+ </optional>
95
+ <attribute name="citeas"/>
96
+ <attribute name="type">
97
+ <ref name="ReferenceFormat"/>
98
+ </attribute>
99
+ <optional>
100
+ <attribute name="alt"/>
101
+ </optional>
102
+ <optional>
103
+ <attribute name="case">
104
+ <choice>
105
+ <value>capital</value>
106
+ <value>lowercase</value>
107
+ </choice>
108
+ </attribute>
109
+ </optional>
110
+ <optional>
111
+ <attribute name="droploc">
112
+ <data type="boolean"/>
113
+ </attribute>
114
+ </optional>
115
+ <ref name="CitationType"/>
116
+ <text/>
117
+ </define>
89
118
  <define name="ul">
90
119
  <element name="ul">
91
120
  <attribute name="id">
@@ -775,6 +804,90 @@
775
804
  <ref name="paragraph"/>
776
805
  </element>
777
806
  </define>
807
+ <define name="em">
808
+ <element name="em">
809
+ <zeroOrMore>
810
+ <choice>
811
+ <ref name="PureTextElement"/>
812
+ <ref name="stem"/>
813
+ <ref name="index"/>
814
+ </choice>
815
+ </zeroOrMore>
816
+ </element>
817
+ </define>
818
+ <define name="strong">
819
+ <element name="strong">
820
+ <zeroOrMore>
821
+ <choice>
822
+ <ref name="PureTextElement"/>
823
+ <ref name="stem"/>
824
+ <ref name="index"/>
825
+ </choice>
826
+ </zeroOrMore>
827
+ </element>
828
+ </define>
829
+ <define name="tt">
830
+ <element name="tt">
831
+ <zeroOrMore>
832
+ <choice>
833
+ <ref name="PureTextElement"/>
834
+ <ref name="index"/>
835
+ </choice>
836
+ </zeroOrMore>
837
+ </element>
838
+ </define>
839
+ <define name="keyword">
840
+ <element name="keyword">
841
+ <zeroOrMore>
842
+ <choice>
843
+ <ref name="PureTextElement"/>
844
+ <ref name="index"/>
845
+ </choice>
846
+ </zeroOrMore>
847
+ </element>
848
+ </define>
849
+ <define name="strike">
850
+ <element name="strike">
851
+ <zeroOrMore>
852
+ <choice>
853
+ <ref name="PureTextElement"/>
854
+ <ref name="index"/>
855
+ </choice>
856
+ </zeroOrMore>
857
+ </element>
858
+ </define>
859
+ <define name="underline">
860
+ <element name="underline">
861
+ <zeroOrMore>
862
+ <choice>
863
+ <ref name="PureTextElement"/>
864
+ <ref name="index"/>
865
+ </choice>
866
+ </zeroOrMore>
867
+ </element>
868
+ </define>
869
+ <define name="smallcap">
870
+ <element name="smallcap">
871
+ <zeroOrMore>
872
+ <choice>
873
+ <ref name="PureTextElement"/>
874
+ <ref name="index"/>
875
+ </choice>
876
+ </zeroOrMore>
877
+ </element>
878
+ </define>
879
+ <define name="pagebreak">
880
+ <element name="pagebreak">
881
+ <optional>
882
+ <attribute name="orientation">
883
+ <choice>
884
+ <value>landscape</value>
885
+ <value>portrait</value>
886
+ </choice>
887
+ </attribute>
888
+ </optional>
889
+ </element>
890
+ </define>
778
891
  </include>
779
892
  <!-- end overrides -->
780
893
  <define name="colgroup">
@@ -793,7 +906,35 @@
793
906
  <value>internal</value>
794
907
  </define>
795
908
  <define name="TextElement" combine="choice">
796
- <ref name="concept"/>
909
+ <choice>
910
+ <ref name="concept"/>
911
+ <ref name="add"/>
912
+ <ref name="del"/>
913
+ </choice>
914
+ </define>
915
+ <define name="add">
916
+ <element name="add">
917
+ <choice>
918
+ <ref name="PureTextElement"/>
919
+ <ref name="eref"/>
920
+ <ref name="stem"/>
921
+ <ref name="keyword"/>
922
+ <ref name="xref"/>
923
+ <ref name="hyperlink"/>
924
+ </choice>
925
+ </element>
926
+ </define>
927
+ <define name="del">
928
+ <element name="del">
929
+ <choice>
930
+ <ref name="PureTextElement"/>
931
+ <ref name="eref"/>
932
+ <ref name="stem"/>
933
+ <ref name="keyword"/>
934
+ <ref name="xref"/>
935
+ <ref name="hyperlink"/>
936
+ </choice>
937
+ </element>
797
938
  </define>
798
939
  <define name="concept">
799
940
  <element name="concept">
@@ -814,8 +955,170 @@
814
955
  <ref name="permission"/>
815
956
  <ref name="imagemap"/>
816
957
  <ref name="svgmap"/>
958
+ <ref name="inputform"/>
959
+ </choice>
960
+ </define>
961
+ <define name="inputform">
962
+ <element name="form">
963
+ <attribute name="id">
964
+ <data type="ID"/>
965
+ </attribute>
966
+ <attribute name="name"/>
967
+ <attribute name="action"/>
968
+ <zeroOrMore>
969
+ <choice>
970
+ <ref name="TextElement"/>
971
+ <ref name="FormInput"/>
972
+ </choice>
973
+ </zeroOrMore>
974
+ </element>
975
+ </define>
976
+ <define name="FormInput">
977
+ <choice>
978
+ <ref name="input"/>
979
+ <ref name="formlabel"/>
980
+ <ref name="select"/>
981
+ <ref name="textarea"/>
982
+ </choice>
983
+ </define>
984
+ <define name="InputType">
985
+ <choice>
986
+ <value>button</value>
987
+ <value>checkbox</value>
988
+ <value>date</value>
989
+ <value>file</value>
990
+ <value>password</value>
991
+ <value>radio</value>
992
+ <value>submit</value>
993
+ <value>text</value>
817
994
  </choice>
818
995
  </define>
996
+ <define name="input">
997
+ <element name="input">
998
+ <attribute name="type">
999
+ <ref name="InputType"/>
1000
+ </attribute>
1001
+ <optional>
1002
+ <attribute name="checked">
1003
+ <data type="boolean"/>
1004
+ </attribute>
1005
+ </optional>
1006
+ <optional>
1007
+ <attribute name="disabled">
1008
+ <data type="boolean"/>
1009
+ </attribute>
1010
+ </optional>
1011
+ <optional>
1012
+ <attribute name="readonly">
1013
+ <data type="boolean"/>
1014
+ </attribute>
1015
+ </optional>
1016
+ <optional>
1017
+ <attribute name="maxlength">
1018
+ <data type="int"/>
1019
+ </attribute>
1020
+ </optional>
1021
+ <optional>
1022
+ <attribute name="minlength">
1023
+ <data type="int"/>
1024
+ </attribute>
1025
+ </optional>
1026
+ <optional>
1027
+ <attribute name="name"/>
1028
+ </optional>
1029
+ <optional>
1030
+ <attribute name="value"/>
1031
+ </optional>
1032
+ <optional>
1033
+ <attribute name="id">
1034
+ <data type="ID"/>
1035
+ </attribute>
1036
+ </optional>
1037
+ </element>
1038
+ </define>
1039
+ <define name="formlabel">
1040
+ <element name="label">
1041
+ <attribute name="for">
1042
+ <data type="IDREF"/>
1043
+ </attribute>
1044
+ <zeroOrMore>
1045
+ <ref name="PureTextElement"/>
1046
+ </zeroOrMore>
1047
+ </element>
1048
+ </define>
1049
+ <define name="select">
1050
+ <element name="select">
1051
+ <optional>
1052
+ <attribute name="name"/>
1053
+ </optional>
1054
+ <optional>
1055
+ <attribute name="value"/>
1056
+ </optional>
1057
+ <optional>
1058
+ <attribute name="id">
1059
+ <data type="ID"/>
1060
+ </attribute>
1061
+ </optional>
1062
+ <optional>
1063
+ <attribute name="disabled">
1064
+ <data type="boolean"/>
1065
+ </attribute>
1066
+ </optional>
1067
+ <optional>
1068
+ <attribute name="multiple">
1069
+ <data type="boolean"/>
1070
+ </attribute>
1071
+ </optional>
1072
+ <optional>
1073
+ <attribute name="size">
1074
+ <data type="int"/>
1075
+ </attribute>
1076
+ </optional>
1077
+ <oneOrMore>
1078
+ <ref name="option"/>
1079
+ </oneOrMore>
1080
+ </element>
1081
+ </define>
1082
+ <define name="option">
1083
+ <element name="option">
1084
+ <optional>
1085
+ <attribute name="disabled">
1086
+ <data type="boolean"/>
1087
+ </attribute>
1088
+ </optional>
1089
+ <optional>
1090
+ <attribute name="value"/>
1091
+ </optional>
1092
+ <zeroOrMore>
1093
+ <ref name="PureTextElement"/>
1094
+ </zeroOrMore>
1095
+ </element>
1096
+ </define>
1097
+ <define name="textarea">
1098
+ <element name="textarea">
1099
+ <optional>
1100
+ <attribute name="name"/>
1101
+ </optional>
1102
+ <optional>
1103
+ <attribute name="value"/>
1104
+ </optional>
1105
+ <optional>
1106
+ <attribute name="id">
1107
+ <data type="ID"/>
1108
+ </attribute>
1109
+ </optional>
1110
+ <optional>
1111
+ <attribute name="rows">
1112
+ <data type="int"/>
1113
+ </attribute>
1114
+ </optional>
1115
+ <optional>
1116
+ <attribute name="cols">
1117
+ <data type="int"/>
1118
+ </attribute>
1119
+ </optional>
1120
+ </element>
1121
+ </define>
819
1122
  <define name="bibliography">
820
1123
  <element name="bibliography">
821
1124
  <oneOrMore>
@@ -28,14 +28,16 @@ module Asciidoctor
28
28
  end
29
29
 
30
30
  def ul_li_attrs(node)
31
+ c = node.attr?("checked")
31
32
  attr_code(
32
- uncheckedcheckbox: node.attr?("checkbox") ? !node.attr?("checked") : nil,
33
- checkedcheckbox: node.attr?("checkbox") ? node.attr?("checked") : nil,
33
+ uncheckedcheckbox: node.attr?("checkbox") ? !c : nil,
34
+ checkedcheckbox: node.attr?("checkbox") ? c : nil
34
35
  )
35
36
  end
36
37
 
37
38
  def ulist(node)
38
39
  return reference(node) if in_norm_ref? || in_biblio?
40
+
39
41
  noko do |xml|
40
42
  xml.ul **ul_attrs(node) do |xml_ul|
41
43
  node.items.each do |item|
@@ -2,10 +2,11 @@ require "asciidoctor/extensions"
2
2
  require "fileutils"
3
3
  require "uuidtools"
4
4
  require "yaml"
5
- require_relative "./macros_plantuml.rb"
6
- require_relative "./macros_terms.rb"
7
- require_relative "./datamodel/attributes_table_preprocessor.rb"
8
- require_relative "./datamodel/diagram_preprocessor.rb"
5
+ require_relative "./macros_plantuml"
6
+ require_relative "./macros_terms"
7
+ require_relative "./macros_form"
8
+ require_relative "./datamodel/attributes_table_preprocessor"
9
+ require_relative "./datamodel/diagram_preprocessor"
9
10
  require "metanorma-plugin-datastruct"
10
11
  require "metanorma-plugin-lutaml"
11
12
 
@@ -29,6 +30,7 @@ module Asciidoctor
29
30
 
30
31
  def preprocess_attrs(attrs)
31
32
  return unless attrs.size > 1 && attrs.size < 5
33
+
32
34
  ret = { primary: attrs[1], target: attrs[attrs.size] }
33
35
  ret[:secondary] = attrs[2] if attrs.size > 2
34
36
  ret[:tertiary] = attrs[3] if attrs.size > 3
@@ -37,7 +39,8 @@ module Asciidoctor
37
39
 
38
40
  def process(_parent, target, attr)
39
41
  args = preprocess_attrs(attr) or return
40
- ret = "<index-xref also='#{target == 'also'}'><primary>#{args[:primary]}</primary>"
42
+ ret = "<index-xref also='#{target == 'also'}'>"\
43
+ "<primary>#{args[:primary]}</primary>"
41
44
  ret += "<secondary>#{args[:secondary]}</secondary>" if args[:secondary]
42
45
  ret += "<tertiary>#{args[:tertiary]}</tertiary>" if args[:tertiary]
43
46
  ret + "<target>#{args[:target]}</target></index-xref>"
@@ -51,7 +54,7 @@ module Asciidoctor
51
54
 
52
55
  def process(parent, target, attr)
53
56
  text = attr["text"]
54
- text = "((#{text}))" unless /^\(\(.+\)\)$/.match(text)
57
+ text = "((#{text}))" unless /^\(\(.+\)\)$/.match?(text)
55
58
  out = parent.sub_macros(text)
56
59
  out.sub(/<index>/, "<index to='#{target}'>")
57
60
  end
@@ -62,8 +65,8 @@ module Asciidoctor
62
65
  named :pseudocode
63
66
  on_context :example, :sourcecode
64
67
 
65
- def init_indent(s)
66
- /^(?<prefix>[ \t]*)(?<suffix>.*)$/ =~ s
68
+ def init_indent(line)
69
+ /^(?<prefix>[ \t]*)(?<suffix>.*)$/ =~ line
67
70
  prefix = prefix.gsub(/\t/, "\u00a0\u00a0\u00a0\u00a0")
68
71
  .gsub(/ /, "\u00a0")
69
72
  prefix + suffix
@@ -72,12 +75,12 @@ module Asciidoctor
72
75
  def supply_br(lines)
73
76
  ignore = false
74
77
  lines.each_with_index do |l, i|
75
- /^(--+|====+|\|===|\.\.\.\.+|\*\*\*\*+|\+\+\+\++|\`\`\`\`+|____\+)$/.match(l) &&
76
- (ignore = !ignore)
77
- next if l.empty? || l.match(/ \+$/)
78
- next if /^\[.*\]$/.match(l)
79
- next if ignore
80
- next if i == lines.size - 1 || i < lines.size - 1 && lines[i + 1].empty?
78
+ /^(--+|====+|\|===|\.\.\.\.+|\*\*\*\*+|\+\+\+\++|\`\`\`\`+|____\+)$/
79
+ .match(l) && (ignore = !ignore)
80
+ next if l.empty? || l.match(/ \+$/) || /^\[.*\]$/.match?(l) || ignore
81
+ next if i == lines.size - 1 ||
82
+ i < lines.size - 1 && lines[i + 1].empty?
83
+
81
84
  lines[i] += " +"
82
85
  end
83
86
  lines
@@ -86,9 +89,8 @@ module Asciidoctor
86
89
  def process(parent, reader, attrs)
87
90
  attrs["role"] = "pseudocode"
88
91
  lines = reader.lines.map { |m| init_indent(m) }
89
- ret = create_block(parent, :example, supply_br(lines),
90
- attrs, content_model: :compound)
91
- ret
92
+ create_block(parent, :example, supply_br(lines),
93
+ attrs, content_model: :compound)
92
94
  end
93
95
  end
94
96
 
@@ -98,6 +100,7 @@ module Asciidoctor
98
100
  parse_content_as :text
99
101
  option :pos_attrs, %w(rpbegin rt rpend)
100
102
 
103
+ # for example, html5ruby:楽聖少女[がくせいしょうじょ]
101
104
  def process(_parent, target, attributes)
102
105
  rpbegin = "("
103
106
  rpend = ")"
@@ -105,7 +108,6 @@ module Asciidoctor
105
108
  rt = attributes["text"]
106
109
  elsif (attributes.size == 2) && attributes.key?(1) &&
107
110
  attributes.key?("rpbegin")
108
- # for example, html5ruby:楽聖少女[がくせいしょうじょ]
109
111
  rt = attributes[1] || ""
110
112
  else
111
113
  rpbegin = attributes["rpbegin"]
@@ -126,21 +128,22 @@ module Asciidoctor
126
128
  def process(parent, reader, attrs)
127
129
  attrs["name"] = "todo"
128
130
  attrs["caption"] = "TODO"
129
- create_block parent, :admonition, reader.lines, attrs,
130
- content_model: :compound
131
+ create_block(parent, :admonition, reader.lines, attrs,
132
+ content_model: :compound)
131
133
  end
132
134
  end
133
135
 
134
136
  class ToDoInlineAdmonitionBlock < Extensions::Treeprocessor
135
137
  def process(document)
136
138
  (document.find_by context: :paragraph).each do |para|
137
- next unless /^TODO: /.match para.lines[0]
139
+ next unless /^TODO: /.match? para.lines[0]
140
+
138
141
  parent = para.parent
139
142
  para.set_attr("name", "todo")
140
143
  para.set_attr("caption", "TODO")
141
144
  para.lines[0].sub!(/^TODO: /, "")
142
- todo = Block.new parent, :admonition, attributes: para.attributes,
143
- source: para.lines, content_model: :compound
145
+ todo = Block.new(parent, :admonition, attributes: para.attributes,
146
+ source: para.lines, content_model: :compound)
144
147
  parent.blocks[parent.blocks.index(para)] = todo
145
148
  end
146
149
  end
@@ -182,5 +185,29 @@ module Asciidoctor
182
185
  %{<footnoteblock>#{out}</footnoteblock>}
183
186
  end
184
187
  end
188
+
189
+ class AddMacro < Asciidoctor::Extensions::InlineMacroProcessor
190
+ use_dsl
191
+ named :add
192
+ parse_content_as :text
193
+ using_format :short
194
+
195
+ def process(parent, _target, attrs)
196
+ out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
197
+ %{<add>#{out}</add>}
198
+ end
199
+ end
200
+
201
+ class DelMacro < Asciidoctor::Extensions::InlineMacroProcessor
202
+ use_dsl
203
+ named :del
204
+ parse_content_as :text
205
+ using_format :short
206
+
207
+ def process(parent, _target, attrs)
208
+ out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
209
+ %{<del>#{out}</del>}
210
+ end
211
+ end
185
212
  end
186
213
  end