kramdown-rfc2629 1.7.17 → 1.7.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52b682df54c2649c4ef7f2d2e08652c3709866207eab40c6fd40d667b4a00693
4
- data.tar.gz: dba5488edbd5881fa69f5bca0b98db2347500fc34aa2fcdb33d71ba881f9596c
3
+ metadata.gz: f9d9adbae37a16a29017726ef2040d260eb1a2cce9d00ff807828c84275d87eb
4
+ data.tar.gz: 6018923d328495fb77b78886e467d9c24267bc563d37c71dd527c11c7ee1e709
5
5
  SHA512:
6
- metadata.gz: 9d4215bd5369fa73c6618101ae5c5e242ad3a1c6b6a586a588a81d8a31441efda575b3e1135be88c5204e7f81b744b744346086ea06dfb8b61b9a7eaf193c427
7
- data.tar.gz: db9621882c176186a9d407c38a0d573e849de7f6eac7483a7a666c788b9a14b3662faedb48a43796caad7a50b9b65c0f48cb4d523dae1e88c1fa940c582fc1d7
6
+ metadata.gz: 5f9e4452395530cd215d5fa3f1c701cd393091424e25e42b564f26c55eb2e6d7601e5da7e87dee2cc6587041b960a76c0aa449277b4ac323b4dc4238a595d3af
7
+ data.tar.gz: d7e408eca15365eb9b8c653dcd3f3dc78a040e6dc599a8e959e7e8ac59e0c630b196d716511ed345547aa5cc1707a1bf2af6a972d83dbeae3fa6ebbebc3ab8b1
data/README.md CHANGED
@@ -667,7 +667,7 @@ made it possible to license kramdown-rfc under the same license.
667
667
  [RFC 2629]: https://www.rfc-editor.org/rfc/rfc2629.html
668
668
  [RFC 7749]: https://www.rfc-editor.org/rfc/rfc7749.html
669
669
  [RFC 7991]: https://www.rfc-editor.org/rfc/rfc7991.html
670
- [v3]: https://xml2rfc.tools.ietf.org/xml2rfc-doc.html
670
+ [v3]: https://authors.ietf.org/rfcxml-vocabulary
671
671
  [markdown]: http://en.wikipedia.org/wiki/Markdown
672
672
  [IETF]: http://www.ietf.org
673
673
  [Miek Gieben]: http://www.miek.nl/
@@ -163,6 +163,7 @@
163
163
  {:/nomarkdown}
164
164
  {:quote: gi="blockquote"}
165
165
  {:aside: gi="aside"}
166
+ {:cref: gi="cref"}
166
167
  {:markers: sourcecode-markers="true"}
167
168
  {:unnumbered: numbered="false"}
168
169
  {:vspace: vspace="0"}
@@ -182,22 +183,34 @@
182
183
  <displayreference target="<%=k%>" to="<%=v%>"/>
183
184
  <% end -%>
184
185
 
185
- <% if sh = sechash.delete("normative") -%>
186
+ <% shn = sechash.delete("normative")
187
+ shi = sechash.delete("informative")
188
+ shc = shn && shi
189
+ if shc
190
+ -%>
191
+ <references title='References' anchor="sec-combined-references">
192
+ <% end -%>
193
+
194
+ <% if shn -%>
186
195
  <references title='Normative References' anchor="sec-normative-references">
187
196
 
188
- <%= sh %>
197
+ <%= shn %>
189
198
 
190
199
  </references>
191
200
  <% end -%>
192
201
 
193
- <% if sh = sechash.delete("informative") -%>
202
+ <% if shi -%>
194
203
  <references title='Informative References' anchor="sec-informative-references">
195
204
 
196
- <%= sh %>
205
+ <%= shi %>
197
206
 
198
207
  </references>
199
208
  <% end -%>
200
209
 
210
+ <% if shc -%>
211
+ </references>
212
+ <% end -%>
213
+
201
214
  <%= sechash.delete("back") %>
202
215
  <% sh = sechash.delete("contributor") -%>
203
216
  <% consec = ps.has("contributor") -%>
@@ -212,6 +225,7 @@
212
225
  <%= sh -%>
213
226
  <% if $options.v3 && consec
214
227
  ps.arr("contributor") do |au|
228
+ if Hash === au
215
229
  aups = KramdownRFC::authorps_from_hash(au)
216
230
  -%>
217
231
  <%= KramdownRFC::person_element_from_aups("contact", aups) -%>
@@ -224,7 +238,17 @@
224
238
  CONTRIBUTION
225
239
  end -%>
226
240
  <% aups.warn_if_leftovers -%>
241
+ <% else -%>
242
+ <%= <<TEXT
243
+ {:/nomarkdown}
244
+
245
+ #{au}
246
+
247
+ {::nomarkdown}
248
+ TEXT
249
+ -%>
227
250
  <% end -%>
251
+ <% end -%>
228
252
  <% end -%>
229
253
  </section>
230
254
  <% end -%>
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.7.17'
3
+ s.version = '1.7.19'
4
4
  s.summary = "Kramdown extension for generating RFCXML (RFC 799x)."
5
5
  s.description = %{An RFCXML (RFC 799x) generating backend for Thomas Leitner's
6
6
  "kramdown" markdown parser. Mostly useful for RFC writers.}
@@ -70,8 +70,8 @@ end
70
70
  def boilerplate(key)
71
71
  ret = ''
72
72
  case key.downcase
73
- when /\Abcp14(info)?(\+)?(-tagged)?(-bcp)?\z/i
74
- # $1 $2 $3 $4
73
+ when /\Abcp14(info)?(\+)?(-tagged)?(-bcp(14)?)?\z/i
74
+ # $1 $2 $3 $4 $5
75
75
  if $1
76
76
  ret << <<RFC8174ise
77
77
  Although this document is not an IETF Standards Track publication, it
@@ -110,11 +110,19 @@ PLUS
110
110
  TAGGED
111
111
  end
112
112
  if $4 # experimental; idnits complains:
113
+ if $5
114
+ # ** The document contains RFC2119-like boilerplate, but doesn't seem to
115
+ # mention RFC 2119. The boilerplate contains a reference [BCP14], but that
116
+ # reference does not seem to mention RFC 2119 either.
117
+ ret.sub!("BCP 14 {{!RFC2119}} {{!RFC8174}}",
118
+ "{{!BCP14}} ({{RFC2119}}) ({{RFC8174}})")
119
+ else
113
120
  # ** The document seems to lack a both a reference to RFC 2119 and the
114
121
  # recommended RFC 2119 boilerplate, even if it appears to use RFC 2119
115
122
  # keywords -- however, there's a paragraph with a matching beginning.
116
123
  # Boilerplate error?
117
- ret.sub!("{{!RFC2119}} {{!RFC8174}}", "{{!BCP14}}")
124
+ ret.sub!("{{!RFC2119}} {{!RFC8174}}", "{{!BCP14}}")
125
+ end
118
126
  end
119
127
  ret
120
128
  when /\Arfc\s*7942(info)?\z/i
@@ -376,6 +384,7 @@ def xml_from_sections(input)
376
384
  v.gsub!(/{{(#{
377
385
  spacify_re(XSR_PREFIX)
378
386
  })?([\w.\/_\-]+@)?(?:([?!])(-)?|(-))([\w._\-]+)(?:=([\w.\/_\-]+))?(#{
387
+ # 2 3 4 5 6 7
379
388
  XREF_TXT_SUFFIX
380
389
  })?(#{
381
390
  spacify_re(XSR_SUFFIX)
@@ -459,6 +468,9 @@ def xml_from_sections(input)
459
468
  sechash[sn.to_s] << %{&#{bts};\n} # ???
460
469
  end
461
470
  else
471
+ if v.nil? && (bri = bibref.to_i) != 0
472
+ v = bri
473
+ end # hack in {{?Err6543=8610}}
462
474
  if v && Integer === v
463
475
  case href
464
476
  when /\AErr(.*)/
@@ -478,7 +490,7 @@ def xml_from_sections(input)
478
490
  end
479
491
  end
480
492
  unless v && Hash === v
481
- warn "*** don't know how to expand ref #{k}"
493
+ warn "*** don't know how to expand ref #{k} #{v.inspect}"
482
494
  next
483
495
  end
484
496
  if bts && !v.delete("override")
@@ -32,6 +32,7 @@ class Object
32
32
  end
33
33
 
34
34
  module Kramdown
35
+ RFCXML_SPAN_ELEMENTS = Set.new(Kramdown::Parser::Html::Constants::HTML_SPAN_ELEMENTS)
35
36
 
36
37
  Kramdown::Options.define(:ol_start_at_first_marker, Kramdown::Options::Boolean, false, <<~EOF)
37
38
  If this option is `true`, an ordered list (<ol) will use the
@@ -620,11 +621,23 @@ COLORS
620
621
  outpath = file.path + ".svg"
621
622
  result1 = File.read(outpath) rescue '' # don't die before providing error message
622
623
  File.unlink(outpath) rescue nil # ditto
623
- when "plantuml", "plantuml-utxt"
624
+ when "plantuml", "plantuml-utxt", "plantuml-ascii-art"
625
+ if t == "plantuml-ascii-art"
626
+ result, ascii_art = result.split(/^~{3,} ascii-art\n/, 2)
627
+ unless ascii_art
628
+ warn "*** Didn't find ascii-art in plantuml-ascii-art #{result.inspect}"
629
+ ascii_art = result.to_s
630
+ end
631
+ end
624
632
  plantuml = "@startuml\n#{result}\n@enduml"
625
633
  result1, err, _s = Open3.capture3("plantuml -pipe -tsvg#{svg_opt}", stdin_data: plantuml);
626
- result, err1, _s = Open3.capture3("plantuml -pipe -tutxt#{txt_opt}", stdin_data: plantuml) if t == "plantuml-utxt"
627
- err << err1.to_s
634
+ case t
635
+ when "plantuml-utxt"
636
+ result, err1, _s = Open3.capture3("plantuml -pipe -tutxt#{txt_opt}", stdin_data: plantuml)
637
+ err << err1.to_s
638
+ when "plantuml-ascii-art"
639
+ result = ascii_art
640
+ end
628
641
  when "railroad", "railroad-utf8"
629
642
  result1, err1, _s = Open3.capture3("kgt -l abnf -e svg#{svg_opt}", stdin_data: result);
630
643
  result1 = svg_clean_kgt(result1); dont_clean = true
@@ -718,7 +731,7 @@ COLORS
718
731
  case t
719
732
  when "aasvg", "ditaa", "goat",
720
733
  "math", "math-asciitex", "mermaid", "mscgen",
721
- "plantuml", "plantuml-utxt",
734
+ "plantuml", "plantuml-utxt", "plantuml-ascii-art",
722
735
  "protocol", "protocol-aasvg", "protocol-goat",
723
736
  "railroad", "railroad-utf8"
724
737
  if gi
@@ -837,7 +850,12 @@ COLORS
837
850
  if $options.v3
838
851
  gi = el.attr.delete('gi')
839
852
  if gi && gi != 'ul'
840
- "#{' '*indent}<#{gi}#{el_html_attributes(el)}>\n#{text}#{' '*indent}</#{gi}>\n"
853
+ if RFCXML_SPAN_ELEMENTS === gi
854
+ text.sub!(/\A\s*<t>(.*)<\/t>\s*\z/) {$1} # XXX unwrap inner text from block
855
+ "#{' '*indent}<t><#{gi}#{el_html_attributes(el)}>#{text}</#{gi}></t>\n"
856
+ else
857
+ "#{' '*indent}<#{gi}#{el_html_attributes(el)}>\n#{text}#{' '*indent}</#{gi}>\n"
858
+ end
841
859
  else
842
860
  "#{' '*indent}<ul#{el_html_attributes_with(el, {"empty" => 'true'})}><li>\n#{text}#{' '*indent}</li></ul>\n"
843
861
  end
@@ -876,6 +894,9 @@ COLORS
876
894
  clean = ''
877
895
  parts.each do |p|
878
896
  next if p.empty?
897
+ if p == "<br />"
898
+ p = "\u2028" # XXX
899
+ end
879
900
  d = REXML::Document.new("<foo>#{p}</foo>")
880
901
  t = REXML::XPath.each(d.root, "//text()").to_a.join
881
902
  if t != p
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-rfc2629
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.17
4
+ version: 1.7.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-17 00:00:00.000000000 Z
11
+ date: 2024-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubygems_version: 3.5.11
225
+ rubygems_version: 3.5.14
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Kramdown extension for generating RFCXML (RFC 799x).