metanorma-standoc 1.3.24 → 1.3.25

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +2 -1
  3. data/.github/workflows/ubuntu.yml +5 -3
  4. data/.github/workflows/windows.yml +0 -1
  5. data/lib/asciidoctor/standoc/base.rb +22 -8
  6. data/lib/asciidoctor/standoc/biblio.rng +53 -26
  7. data/lib/asciidoctor/standoc/cleanup.rb +8 -7
  8. data/lib/asciidoctor/standoc/cleanup_inline.rb +3 -0
  9. data/lib/asciidoctor/standoc/cleanup_ref.rb +4 -0
  10. data/lib/asciidoctor/standoc/cleanup_section.rb +21 -6
  11. data/lib/asciidoctor/standoc/front.rb +5 -3
  12. data/lib/asciidoctor/standoc/inline.rb +42 -17
  13. data/lib/asciidoctor/standoc/isodoc.rng +28 -1
  14. data/lib/asciidoctor/standoc/macros.rb +2 -1
  15. data/lib/asciidoctor/standoc/macros_yaml2text.rb +142 -0
  16. data/lib/asciidoctor/standoc/ref.rb +5 -3
  17. data/lib/asciidoctor/standoc/section.rb +5 -0
  18. data/lib/asciidoctor/standoc/utils.rb +2 -11
  19. data/lib/metanorma/standoc/latexml_requirement.rb +14 -12
  20. data/lib/metanorma/standoc/version.rb +1 -1
  21. data/metanorma-standoc.gemspec +2 -2
  22. data/spec/asciidoctor-standoc/base_spec.rb +8 -0
  23. data/spec/asciidoctor-standoc/blocks_spec.rb +56 -1
  24. data/spec/asciidoctor-standoc/cleanup_spec.rb +26 -2
  25. data/spec/asciidoctor-standoc/inline_spec.rb +3 -2
  26. data/spec/asciidoctor-standoc/macros_spec.rb +4 -4
  27. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +564 -0
  28. data/spec/asciidoctor-standoc/refs_spec.rb +234 -146
  29. data/spec/asciidoctor-standoc/section_spec.rb +58 -0
  30. data/spec/asciidoctor-standoc/validate_spec.rb +34 -0
  31. data/spec/assets/codes.yml +695 -0
  32. data/spec/examples/codes_table.html +3174 -0
  33. data/spec/metanorma/processor_spec.rb +2 -2
  34. data/spec/spec_helper.rb +1 -0
  35. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +71 -265
  36. data/spec/vcr_cassettes/isobib_get_123.yml +38 -84
  37. data/spec/vcr_cassettes/isobib_get_123_2001.yml +20 -43
  38. data/spec/vcr_cassettes/isobib_get_124.yml +19 -101
  39. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  40. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +35 -35
  41. metadata +10 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92fc31b8bb1e9754d79b535a4daf3025602e87e0611a5bf6381b9acf5a3d80e6
4
- data.tar.gz: 801345a1e19a5d89df053dbcd969ae508b604f82914e93623bbfebb7f33b55af
3
+ metadata.gz: 500052e6d1bd5c05e37f8bb82ef9a6169e5d172d6a72216436995611d398d3b2
4
+ data.tar.gz: 32bfbcaa5e44d661c9ca28a5b6abf38e2cdc772751cd74b90c959decfd7e6df5
5
5
  SHA512:
6
- metadata.gz: 829deae2c17c445636d4e7ef20e2e34043e1e6dff35c9d3e7c41949119867e8865279a6ed527f60ac5c413bb87058cd4262a6ada7719b36850f099aaa1e39cac
7
- data.tar.gz: 44adac89d280d897bb4fa515f6da866da79bdde608a40bf3ea3ff31e2dd0d3f22c989e671e9ab6b1fe54d534c3476ac82d1acd22ecf87ca98248b4948a87cc50
6
+ metadata.gz: 0d5d15e5456577b3178c875adce471b9e68debea793ce50d347fe16652ebbcc89a346267826846fb979c255ea24d166f8c5c79b0eb42a276dd070328f360e4a0
7
+ data.tar.gz: f496a942f64052abae15c8ea1864f8f977a40dc57c8264140b5d6f9b07626489998f85a1e30fdfcac9cda4049cd9131110f6642451c4e57f53375f5020161f9f
@@ -28,7 +28,8 @@ jobs:
28
28
  - name: Install LaTeXML
29
29
  run: |
30
30
  brew install libxml2 cpanminus
31
- env PATH=$(brew --prefix libxml2)/bin:$PATH cpanm --notest XML::LibXSLT@1.96 git://github.com/brucemiller/LaTeXML.git@9a0e7dc5
31
+ env PATH=$(brew --prefix libxml2)/bin:$PATH \
32
+ cpanm --notest XML::LibXSLT@1.96 git://github.com/brucemiller/LaTeXML.git@9a0e7dc5
32
33
  - name: Install PlantUML
33
34
  run: |
34
35
  brew install plantuml
@@ -31,14 +31,16 @@ jobs:
31
31
  bundle install --jobs 4 --retry 3
32
32
  - name: Install LaTeXML
33
33
  run: |
34
- sudo snap install latexml
35
- sudo snap alias latexml.math latexmlmath
34
+ sudo snap install latexml --edge
35
+ echo "::add-path::/snap/bin"
36
36
  - name: Install PlantUML
37
37
  run: |
38
38
  curl -L https://raw.githubusercontent.com/metanorma/plantuml-install/master/ubuntu.sh | sudo bash
39
39
  - name: Install puppeteer
40
40
  run: |
41
- npm -g i puppeteer
41
+ sudo apt-get update
42
+ sudo apt-get install -y libgbm1
43
+ npm install -g puppeteer@3.0.1
42
44
  - name: Run specs
43
45
  run: |
44
46
  bundle exec rake
@@ -34,7 +34,6 @@ jobs:
34
34
  run: |
35
35
  gem install bundler
36
36
  bundle config --local path vendor/bundle
37
- bundle update
38
37
  bundle install --jobs 4 --retry 3
39
38
  - name: Install LaTeXML
40
39
  shell: cmd
@@ -15,6 +15,7 @@ module Asciidoctor
15
15
  XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
16
16
 
17
17
  Asciidoctor::Extensions.register do
18
+ preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
18
19
  inline_macro Asciidoctor::Standoc::AltTermInlineMacro
19
20
  inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
20
21
  inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
@@ -27,6 +28,14 @@ module Asciidoctor
27
28
  block Asciidoctor::Standoc::PseudocodeBlockMacro
28
29
  end
29
30
 
31
+ def xml_root_tag
32
+ self.class::XML_ROOT_TAG
33
+ end
34
+
35
+ def xml_namespace
36
+ self.class::XML_NAMESPACE
37
+ end
38
+
30
39
  def content(node)
31
40
  node.content
32
41
  end
@@ -54,6 +63,7 @@ module Asciidoctor
54
63
  datauriimage: node.attr("data-uri-image"),
55
64
  htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
56
65
  doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
66
+ break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
57
67
  }
58
68
  end
59
69
 
@@ -78,6 +88,7 @@ module Asciidoctor
78
88
  olstyle: node.attr("olstyle"),
79
89
  htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
80
90
  doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
91
+ break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
81
92
  }
82
93
  end
83
94
 
@@ -165,17 +176,17 @@ module Asciidoctor
165
176
 
166
177
  def makexml1(node)
167
178
  result = ["<?xml version='1.0' encoding='UTF-8'?>",
168
- "<#{self.class::XML_ROOT_TAG}>"]
179
+ "<#{xml_root_tag}>"]
169
180
  result << noko { |ixml| front node, ixml }
170
181
  result << noko { |ixml| middle node, ixml }
171
- result << "</#{self.class::XML_ROOT_TAG}>"
182
+ result << "</#{xml_root_tag}>"
172
183
  textcleanup(result)
173
184
  end
174
185
 
175
186
  def makexml(node)
176
187
  result = makexml1(node)
177
188
  ret1 = cleanup(Nokogiri::XML(result))
178
- ret1.root.add_namespace(nil, self.class::XML_NAMESPACE)
189
+ ret1.root.add_namespace(nil, xml_namespace)
179
190
  validate(ret1) unless @novalid
180
191
  ret1
181
192
  end
@@ -207,15 +218,19 @@ module Asciidoctor
207
218
  end
208
219
 
209
220
  def add_term_source(xml_t, seen_xref, m)
210
- xml_t.origin seen_xref.children[0].content,
211
- **attr_code(term_source_attr(seen_xref))
221
+ if seen_xref.children[0].name == "concept"
222
+ xml_t.origin { |o| o << seen_xref.children[0].to_xml }
223
+ else
224
+ xml_t.origin seen_xref.children[0].content,
225
+ **attr_code(term_source_attr(seen_xref))
226
+ end
212
227
  m[:text] && xml_t.modification do |mod|
213
228
  mod.p { |p| p << m[:text].sub(/^\s+/, "") }
214
229
  end
215
230
  end
216
231
 
217
232
  TERM_REFERENCE_RE_STR = <<~REGEXP.freeze
218
- ^(?<xref><xref[^>]+>([^<]*</xref>)?)
233
+ ^(?<xref><(xref|concept)[^>]+>([^<]*</(xref|concept)>)?)
219
234
  (,\s(?<text>.*))?
220
235
  $
221
236
  REGEXP
@@ -226,8 +241,7 @@ module Asciidoctor
226
241
  def extract_termsource_refs(text, node)
227
242
  matched = TERM_REFERENCE_RE.match text
228
243
  matched.nil? and
229
- #Utils::warning(node, "term reference not in expected format", text)
230
- @log.add("Asciidoctor Input", node, "term reference not in expected format: #{text}")
244
+ @log.add("Asciidoctor Input", node, "term reference not in expected format: #{text}")
231
245
  matched
232
246
  end
233
247
 
@@ -767,6 +767,8 @@
767
767
  <value>unchanged</value>
768
768
  <value>circulated</value>
769
769
  <value>adapted</value>
770
+ <value>vote-started</value>
771
+ <value>vote-ended</value>
770
772
  </choice>
771
773
  </define>
772
774
  <define name="bdate">
@@ -1019,38 +1021,63 @@
1019
1021
  </define>
1020
1022
  <define name="DocRelationType">
1021
1023
  <choice>
1022
- <value>obsoletes</value>
1023
- <value>obsoletedBy</value>
1024
- <value>supersedes</value>
1025
- <value>supersededBy</value>
1026
- <value>updates</value>
1027
- <value>updatedBy</value>
1028
- <value>complements</value>
1029
- <value>derivedFrom</value>
1030
- <value>translatedFrom</value>
1031
- <value>hasTranslation</value>
1032
- <value>adoptedFrom</value>
1033
- <value>equivalent</value>
1034
- <value>identical</value>
1035
- <value>nonequivalent</value>
1036
- <value>includedIn</value>
1037
1024
  <value>includes</value>
1038
- <value>instance</value>
1039
- <value>instanceOf</value>
1040
- <value>partOf</value>
1025
+ <value>includedIn</value>
1041
1026
  <value>hasPart</value>
1042
- <value>hasDraft</value>
1043
- <value>draftOf</value>
1027
+ <value>partOf</value>
1044
1028
  <value>merges</value>
1029
+ <value>mergedInto</value>
1045
1030
  <value>splits</value>
1046
- <value>amends</value>
1047
- <value>amendedBy</value>
1048
- <value>corrects</value>
1049
- <value>correctedBy</value>
1050
- <value>revises</value>
1051
- <value>revisedBy</value>
1031
+ <value>splitInto</value>
1032
+ <value>instance</value>
1033
+ <value>hasInstance</value>
1034
+ <value>exemplarOf</value>
1035
+ <value>hasExemplar</value>
1036
+ <value>manifestationOf</value>
1037
+ <value>hasManifestation</value>
1038
+ <value>reproductionOf</value>
1039
+ <value>hasReproduction</value>
1040
+ <value>reprintOf</value>
1041
+ <value>hasReprint</value>
1042
+ <value>expressionOf</value>
1043
+ <value>hasExpression</value>
1044
+ <value>translatedFrom</value>
1045
+ <value>hasTranslation</value>
1046
+ <value>arrangementOf</value>
1047
+ <value>hasArrangement</value>
1048
+ <value>abridgementOf</value>
1049
+ <value>hasAbridgement</value>
1050
+ <value>annotationOf</value>
1051
+ <value>hasAnnotation</value>
1052
+ <value>draftOf</value>
1053
+ <value>hasDraft</value>
1054
+ <value>editionOf</value>
1055
+ <value>hasEdition</value>
1056
+ <value>updates</value>
1057
+ <value>updatedBy</value>
1058
+ <value>derivedFrom</value>
1059
+ <value>derives</value>
1052
1060
  <value>describes</value>
1053
1061
  <value>describedBy</value>
1062
+ <value>catalogues</value>
1063
+ <value>cataloguedBy</value>
1064
+ <value>hasSuccessor</value>
1065
+ <value>successorOf</value>
1066
+ <value>adaptedFrom</value>
1067
+ <value>hasAdaptation</value>
1068
+ <value>adoptedFrom</value>
1069
+ <value>adoptedAs</value>
1070
+ <value>reviewOf</value>
1071
+ <value>hasReview</value>
1072
+ <value>commentaryOf</value>
1073
+ <value>hasCommentary</value>
1074
+ <value>related</value>
1075
+ <value>complements</value>
1076
+ <value>complementOf</value>
1077
+ <value>obsoletes</value>
1078
+ <value>obsoletedBy</value>
1079
+ <value>cited</value>
1080
+ <value>isCitedIn</value>
1054
1081
  </choice>
1055
1082
  </define>
1056
1083
  <define name="docrelation">
@@ -20,18 +20,18 @@ module Asciidoctor
20
20
  "<amathstem>#{HTMLEntities.new.decode($1)}</amathstem>"
21
21
  end
22
22
  text = Html2Doc.
23
- asciimath_to_mathml(text, ["<amathstem>", "</amathstem>"]).
24
- gsub(%r{<math xmlns='http://www.w3.org/1998/Math/MathML'>},
25
- "<stem type='MathML'>"\
26
- "<math xmlns='http://www.w3.org/1998/Math/MathML'>").
27
- gsub(%r{</math>}, %{</math></stem>})
23
+ asciimath_to_mathml(text, ["<amathstem>", "</amathstem>"])
24
+ x = Nokogiri::XML(text)
25
+ x.xpath("//*[local-name() = 'math'][not(parent::stem)]").each do |y|
26
+ y.wrap("<stem type='MathML'></stem>")
27
+ end
28
+ text = x.to_xml
28
29
  end
29
30
  text.gsub(/\s+<fn /, "<fn ")
30
31
  end
31
32
 
32
33
  def cleanup(xmldoc)
33
34
  element_name_cleanup(xmldoc)
34
- termdef_cleanup(xmldoc)
35
35
  sections_cleanup(xmldoc)
36
36
  obligations_cleanup(xmldoc)
37
37
  table_cleanup(xmldoc)
@@ -45,8 +45,9 @@ module Asciidoctor
45
45
  reference_names(xmldoc)
46
46
  symbols_cleanup(xmldoc)
47
47
  xref_cleanup(xmldoc)
48
- origin_cleanup(xmldoc)
49
48
  concept_cleanup(xmldoc)
49
+ origin_cleanup(xmldoc)
50
+ termdef_cleanup(xmldoc)
50
51
  RelatonIev::iev_cleanup(xmldoc, @bibdb)
51
52
  element_name_cleanup(xmldoc)
52
53
  bpart_cleanup(xmldoc)
@@ -90,6 +90,9 @@ module Asciidoctor
90
90
  end
91
91
 
92
92
  def origin_cleanup(xmldoc)
93
+ xmldoc.xpath("//origin/concept[termref]").each do |x|
94
+ x.replace(x.children)
95
+ end
93
96
  xmldoc.xpath("//origin").each do |x|
94
97
  x["citeas"] = @anchors&.dig(x["bibitemid"], :xref) ||
95
98
  @log.add("Crossreferences", x,
@@ -187,6 +187,10 @@ module Asciidoctor
187
187
  end
188
188
  bib
189
189
  end
190
+
191
+ def fetch_termbase(termbase, id)
192
+ ""
193
+ end
190
194
  end
191
195
  end
192
196
  end
@@ -117,7 +117,7 @@ module Asciidoctor
117
117
  end
118
118
 
119
119
  def obligations_cleanup_inherit(x)
120
- x.xpath("//annex | //clause").each do |r|
120
+ x.xpath("//annex | //clause[not(ancestor::boilerplate)]").each do |r|
121
121
  r["obligation"] = "normative" unless r["obligation"]
122
122
  end
123
123
  x.xpath(Utils::SUBCLAUSE_XPATH).each do |r|
@@ -192,7 +192,16 @@ module Asciidoctor
192
192
  end
193
193
  end
194
194
 
195
+ def termdef_from_termbase(xmldoc)
196
+ xmldoc.xpath("//term").each do |x|
197
+ if c = x.at("./origin/termref") and !x.at("./definition")
198
+ x.at("./origin").previous = fetch_termbase(c["base"], c.text)
199
+ end
200
+ end
201
+ end
202
+
195
203
  def termdef_cleanup(xmldoc)
204
+ termdef_from_termbase(xmldoc)
196
205
  termdef_unnest_cleanup(xmldoc)
197
206
  termdef_stem_cleanup(xmldoc)
198
207
  termdomain_cleanup(xmldoc)
@@ -209,15 +218,21 @@ module Asciidoctor
209
218
  # Numbers sort *after* letters; we use thorn to force that sort order.
210
219
  def symbol_key(x)
211
220
  key = x.dup
212
- key.xpath("//*[local-name() = 'math']").each do |m|
213
- m.replace(MathML2AsciiMath.m2a(m.to_xml))
221
+ key.traverse do |n|
222
+ next unless n.name == "math"
223
+ n.replace(grkletters(MathML2AsciiMath.m2a(n.to_xml)))
214
224
  end
215
- ret = Nokogiri::XML(MathML2AsciiMath.m2a(key.to_xml))
216
- HTMLEntities.new.decode(ret.text).strip.
225
+ ret = Nokogiri::XML(key.to_xml)
226
+ HTMLEntities.new.decode(ret.text).
227
+ gsub(/[\[\]\{\}<>\(\)]/, "").strip.
217
228
  gsub(/[[:punct]]|[_^]/, ":\\0").gsub(/`/, "").
218
229
  gsub(/[0-9]+/, "þ\\0")
219
230
  end
220
231
 
232
+ def grkletters(x)
233
+ x.gsub(/\b(alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\b/i, "&\\1;")
234
+ end
235
+
221
236
  def extract_symbols_list(dl)
222
237
  dl_out = []
223
238
  dl.xpath("./dt | ./dd").each do |dtd|
@@ -233,7 +248,7 @@ module Asciidoctor
233
248
  def symbols_cleanup(docxml)
234
249
  docxml.xpath("//definitions/dl").each do |dl|
235
250
  dl_out = extract_symbols_list(dl)
236
- dl_out.sort! { |a, b| a[:key] <=> b[:key] }
251
+ dl_out.sort! { |a, b| a[:key] <=> b[:key] || a[:dt] <=> b[:dt] }
237
252
  dl.children = dl_out.map { |d| d[:dt].to_s + d[:dd].to_s }.join("\n")
238
253
  end
239
254
  docxml
@@ -78,7 +78,9 @@ module Asciidoctor
78
78
 
79
79
  def datetypes
80
80
  %w{ published accessed created implemented obsoleted
81
- confirmed updated issued circulated unchanged received }
81
+ confirmed updated issued circulated unchanged received
82
+ vote-started vote-ended
83
+ }
82
84
  end
83
85
 
84
86
  def metadata_date(node, xml)
@@ -190,8 +192,8 @@ module Asciidoctor
190
192
  ["en"].each do |lang|
191
193
  at = { language: lang, format: "text/plain" }
192
194
  xml.title **attr_code(at) do |t|
193
- t << Utils::asciidoc_sub(node.attr("title") || node.attr("title-en") ||
194
- node.title)
195
+ t << (Utils::asciidoc_sub(node.attr("title") || node.attr("title-en")) ||
196
+ node.title)
195
197
  end
196
198
  end
197
199
  end
@@ -3,6 +3,7 @@ require "htmlentities"
3
3
  require "unicode2latex"
4
4
  require "mime/types"
5
5
  require "base64"
6
+ require 'English'
6
7
 
7
8
  module Asciidoctor
8
9
  module Standoc
@@ -106,23 +107,47 @@ module Asciidoctor
106
107
  gsub(/&quot;/, '"').gsub(/&#xa;/, "\n")
107
108
  end
108
109
 
110
+ def latex_run1(lxm_input, cmd)
111
+ IO.popen(cmd, "r+", external_encoding: "UTF-8") do |io|
112
+ io.write(lxm_input)
113
+ io.close_write
114
+ io.read
115
+ end
116
+ end
117
+
118
+ def latex_run(lxm_input)
119
+ results = nil
120
+ Metanorma::Standoc::Requirements[:latexml].cmd.each_with_index do |cmd, i|
121
+ warn "Retrying with #{cmd}" if i > 0
122
+ results = latex_run1(lxm_input, cmd)
123
+ if $CHILD_STATUS.to_i.zero?
124
+ warn "Success!" if i > 0
125
+ break
126
+ end
127
+ end
128
+ $CHILD_STATUS.to_i.zero? ? results : nil
129
+ end
130
+
131
+ def latex_parse(text)
132
+ lxm_input = Unicode2LaTeX.unicode2latex(HTMLEntities.new.decode(text))
133
+ results = latex_run(lxm_input)
134
+ results.nil? and
135
+ @log.add('Math', nil,
136
+ "latexmlmath failed to process equation:\n#{lxm_input}")
137
+ results
138
+ end
139
+
109
140
  def stem_parse(text, xml, style)
110
141
  if /&lt;([^:>&]+:)?math(\s+[^>&]+)?&gt; |
111
142
  <([^:>&]+:)?math(\s+[^>&]+)?>/x.match text
112
143
  math = xml_encode(text)
113
144
  xml.stem math, **{ type: "MathML" }
114
145
  elsif style == :latexmath
115
- latex_cmd = Metanorma::Standoc::Requirements[:latexml].cmd
116
- latexmlmath_input =
117
- Unicode2LaTeX::unicode2latex(HTMLEntities.new.decode(text)).
118
- gsub(/'/, '\\').gsub(/\n/, " ")
119
- latex = IO.popen(latex_cmd, "r+", external_encoding: "UTF-8") do |io|
120
- io.write(latexmlmath_input)
121
- io.close_write
122
- io.read
123
- end
146
+ latex = latex_parse(text) or return xml.stem **{ type: "MathML" }
124
147
  xml.stem **{ type: "MathML" } do |s|
125
- s << latex.sub(/<\?[^>]+>/, "")
148
+ math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, "")).elements[0]
149
+ math.delete("alttext")
150
+ s.parent.children = math
126
151
  end
127
152
  else
128
153
  xml.stem text, **{ type: "AsciiMath" }
@@ -173,13 +198,13 @@ module Asciidoctor
173
198
  type = types.first.to_s
174
199
  uri = uri.sub(%r{^data:image/\*;}, "data:#{type};")
175
200
  attr_code(src: @datauriimage ? datauri(uri) : uri,
176
- id: Utils::anchor_or_uuid,
177
- mimetype: type,
178
- height: node.attr("height") || "auto",
179
- width: node.attr("width") || "auto" ,
180
- filename: node.attr("filename"),
181
- title: node.attr("titleattr"),
182
- alt: node.alt == node.attr("default-alt") ? nil : node.alt)
201
+ id: Utils::anchor_or_uuid,
202
+ mimetype: type,
203
+ height: node.attr("height") || "auto",
204
+ width: node.attr("width") || "auto" ,
205
+ filename: node.attr("filename"),
206
+ title: node.attr("titleattr"),
207
+ alt: node.alt == node.attr("default-alt") ? nil : node.alt)
183
208
  end
184
209
 
185
210
  def inline_image(node)
@@ -303,8 +303,23 @@
303
303
  <ref name="paragraph"/>
304
304
  </element>
305
305
  </define>
306
+ <define name="TextElement" combine="choice">
307
+ <ref name="concept"/>
308
+ </define>
306
309
  </include>
307
310
  <!-- end overrides -->
311
+ <define name="concept">
312
+ <element name="concept">
313
+ <optional>
314
+ <attribute name="term"/>
315
+ </optional>
316
+ <choice>
317
+ <ref name="eref"/>
318
+ <ref name="xref"/>
319
+ <ref name="termref"/>
320
+ </choice>
321
+ </element>
322
+ </define>
308
323
  <define name="BasicBlock" combine="choice">
309
324
  <choice>
310
325
  <ref name="requirement"/>
@@ -911,7 +926,10 @@
911
926
  </define>
912
927
  <define name="origin">
913
928
  <element name="origin">
914
- <ref name="erefType"/>
929
+ <choice>
930
+ <ref name="erefType"/>
931
+ <ref name="termref"/>
932
+ </choice>
915
933
  </element>
916
934
  </define>
917
935
  <define name="modification">
@@ -919,6 +937,15 @@
919
937
  <ref name="paragraph"/>
920
938
  </element>
921
939
  </define>
940
+ <define name="termref">
941
+ <element name="termref">
942
+ <attribute name="base"/>
943
+ <attribute name="target"/>
944
+ <optional>
945
+ <text/>
946
+ </optional>
947
+ </element>
948
+ </define>
922
949
  <define name="structuredidentifier">
923
950
  <element name="structuredidentifier">
924
951
  <optional>
@@ -2,6 +2,7 @@ require "asciidoctor/extensions"
2
2
  require "fileutils"
3
3
  require "uuidtools"
4
4
  require_relative "./macros_plantuml.rb"
5
+ require_relative "./macros_yaml2text.rb"
5
6
 
6
7
  module Asciidoctor
7
8
  module Standoc
@@ -58,7 +59,7 @@ module Asciidoctor
58
59
  named :concept
59
60
  name_positional_attributes "id", "word", "term"
60
61
  #match %r{concept:(?<target>[^\[]*)\[(?<content>|.*?[^\\])\]$}
61
- match /\{\{(?<content>|.*?[^\\])\}\}$/
62
+ match /\{\{(?<content>|.*?[^\\])\}\}/
62
63
  using_format :short
63
64
 
64
65
  # deal with locality attrs and their disruption of positional attrs