kramdown-rfc2629 1.5.9 → 1.5.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27ae2945d8f8d2f4458d2140929d60507bb980a7b925c607a2cdfd32a57c3e37
4
- data.tar.gz: 79cbaf64a1ad74f32a1ddda9b7138254cc13f199a03f05f2cdf9871606f03365
3
+ metadata.gz: 44da042356d9bc536e5c05d3256718ed025a7d83a1678fa66ee86078daeaf440
4
+ data.tar.gz: 5ee1e04e156d30c36c070828f41ed382fb46a13a43310f8c6a2b5a597cb2fe4f
5
5
  SHA512:
6
- metadata.gz: 00550b5de6d254e67f9515592397caff9c70b8401249ea5095249a6fe366d616102ccc8cf49a56cea67923374f50c9d19b3586cdce2887e7ae8586e822c6b889
7
- data.tar.gz: 80b19ec4713317c626286a623b49beed601f4fae698a0d8ecaeaad3087f6e3c9828bb0d1c8d917cc6f944dd9b25f93cad942bb6239c200d680c1b3d89dfa6506
6
+ metadata.gz: 1ce55d74b92191986255d87e27f1891a4f60f7eb68fe4baff5ea0eedd264a76511870b5817bae23d6b76e553143621b9ab570c658cb6b197735c501b470cfc7a
7
+ data.tar.gz: 8f044f904be1ef0f9d56bd430a7104d5e522b630cae07a318ef98c862639393350099148ecdb2dd1a3a027a2da627489aae1b7dcb64c1c9cbd60b7f56ca09541
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.5.9'
3
+ s.version = '1.5.13'
4
4
  s.summary = "Kramdown extension for generating RFC 7749 XML."
5
5
  s.description = %{An RFC7749 (XML2RFC) generating backend for Thomas Leitner's
6
6
  "kramdown" markdown parser. Mostly useful for RFC writers.}
@@ -51,10 +51,6 @@ module KramdownRFC
51
51
  # -- only works for people with exactly one last name and uncomplicated first names
52
52
  if n = aups.rest["name"]
53
53
  n = n.split
54
- if s = aups.rest["surname"]
55
- s = s.split
56
- # XXX remove s from n; use n[0..-2] otherwise.
57
- end
58
54
  aups.rest["initials"] ||= n[0..-2].map(&:chr).join('.') << '.'
59
55
  aups.rest["surname"] ||= n[-1]
60
56
  end
@@ -455,9 +455,28 @@ COLORS
455
455
  dont_clean = false
456
456
  dont_check = false
457
457
  case t
458
+ when "protocol", "protocol-goat", "protocol-aasvg"
459
+ cmdparm = result.lines.map(&:strip).select {|x| x != ''}.join(',')
460
+ result, err, _s = Open3.capture3("protocol #{Shellwords.escape(cmdparm)}", stdin_data: '')
461
+ if t == "protocol-goat"
462
+ file.unlink
463
+ file = Tempfile.new("kramdown-rfc")
464
+ file.write(result)
465
+ file.close
466
+ result1, err, _s = Open3.capture3("goat #{file.path}", stdin_data: result);
467
+ dont_clean = true
468
+ elsif t == "protocol-aasvg"
469
+ result1, err, _s = Open3.capture3("aasvg", stdin_data: result);
470
+ dont_clean = true
471
+ else
472
+ result1 = nil
473
+ end
458
474
  when "goat"
459
475
  result1, err, _s = Open3.capture3("goat #{file.path}", stdin_data: result);
460
476
  dont_clean = true
477
+ when "aasvg"
478
+ result1, err, _s = Open3.capture3("aasvg", stdin_data: result);
479
+ dont_clean = true
461
480
  when "ditaa" # XXX: This needs some form of option-setting
462
481
  result1, err, _s = Open3.capture3("ditaa #{file.path} --svg -o -", stdin_data: result);
463
482
  when "mscgen"
@@ -487,15 +506,17 @@ COLORS
487
506
  # warn ["text:", result.inspect]
488
507
  # warn ["svg:", result1.inspect]
489
508
  file.unlink
490
- result1 = svg_clean(result1) unless dont_clean
491
- unless dont_check
492
- result1, err, _s = Open3.capture3("svgcheck -Xqa", stdin_data: result1);
493
- # warn ["svgcheck:", result1.inspect]
494
- capture_croak("svgcheck", err)
495
- end
496
- if result1 == ''
497
- warn "*** could not create svg for #{result.inspect[0...20]}..."
498
- exit 65 # EX_DATAERR
509
+ if result1
510
+ result1 = svg_clean(result1) unless dont_clean
511
+ unless dont_check
512
+ result1, err, _s = Open3.capture3("svgcheck -Xqa", stdin_data: result1);
513
+ # warn ["svgcheck:", result1.inspect]
514
+ capture_croak("svgcheck", err)
515
+ end
516
+ if result1 == ''
517
+ warn "*** could not create svg for #{result.inspect[0...20]}..."
518
+ exit 65 # EX_DATAERR
519
+ end
499
520
  end
500
521
  [result, result1] # text, svg
501
522
  end
@@ -547,13 +568,20 @@ COLORS
547
568
  end
548
569
  end
549
570
  case t
550
- when "goat", "ditaa", "mscgen", "plantuml", "plantuml-utxt",
551
- "railroad", "railroad-utf8", "mermaid", "math"
571
+ when "aasvg", "ditaa", "goat",
572
+ "math", "mermaid", "mscgen",
573
+ "plantuml", "plantuml-utxt",
574
+ "protocol", "protocol-aasvg", "protocol-goat",
575
+ "railroad", "railroad-utf8"
552
576
  if gi
553
577
  warn "*** Can't set GI #{gi} for composite SVG artset"
554
578
  end
555
579
  result, result1 = memoize(:svg_tool_process, t, result)
580
+ if result1 # refactor!
556
581
  "#{' '*indent}<figure#{el_html_attributes(el)}><artset><artwork #{html_attributes(artwork_attr.merge("type"=> "svg"))}>#{result1.sub(/.*?<svg/m, "<svg")}</artwork><artwork #{html_attributes(artwork_attr.merge("type"=> "ascii-art"))}><![CDATA[#{result}#{result =~ /\n\Z/ ? '' : "\n"}]]></artwork></artset></figure>\n"
582
+ else
583
+ "#{' '*indent}<figure#{el_html_attributes(el)}><artwork #{html_attributes(artwork_attr.merge("type"=> "ascii-art"))}><![CDATA[#{result}#{result =~ /\n\Z/ ? '' : "\n"}]]></artwork></figure>\n"
584
+ end
557
585
  else
558
586
  gi ||= (
559
587
  if !$options.v3 || !t || ARTWORK_TYPES.include?(t) || artwork_attr["align"]
@@ -618,7 +646,7 @@ COLORS
618
646
  if sl = el.attr.delete('slugifiedName') # could do general name- play
619
647
  attrstring = html_attributes({'slugifiedName' => sl})
620
648
  end
621
- irefs = "<name#{attrstring}>#{inner(el, indent, opts)}</name>" #
649
+ irefs = "<name#{attrstring}>#{inner(el, indent, opts.merge(noabbrev: true))}</name>" #
622
650
  else
623
651
  clean, irefs = clean_pcdata(inner_a(el, indent, opts))
624
652
  el.attr['title'] = clean
@@ -1000,7 +1028,7 @@ COLORS
1000
1028
  anchor = ::Kramdown::Parser::RFC2629Kramdown.idref_cleanup(anchor)
1001
1029
  anchor.gsub!('/', '_') # should take out all illegals
1002
1030
  to_insert = ""
1003
- src.scan(/(W3C|3GPP|[A-Z-]+)[.]?([A-Za-z_0-9.\/\+-]+)/) do |t, n|
1031
+ src.scan(/(W3C|3GPP|[A-Z-]+)[.]?([A-Za-z_0-9.\(\)\/\+-]+)/) do |t, n|
1004
1032
  fn = "reference.#{t}.#{n}.xml"
1005
1033
  sub, ttl, _can_anchor, altproc = XML_RESOURCE_ORG_MAP[t]
1006
1034
  ttl ||= KRAMDOWN_REFCACHETTL # everything but RFCs might change a lot
@@ -1205,13 +1233,30 @@ COLORS
1205
1233
  end
1206
1234
 
1207
1235
  def convert_abbreviation(el, indent, opts) # XXX: This is wrong
1236
+ if opts[:noabbrev]
1237
+ return el.value
1238
+ end
1239
+
1208
1240
  title = @root.options[:abbrev_defs][el.value]
1209
1241
  title = nil if title.empty?
1210
1242
  value = el.value
1211
- if item = title
1212
- if item == "<bcp14>" && $options.v3
1213
- return "<bcp14>#{el.value}</bcp14>"
1243
+
1244
+ if title == "<bcp14>" && $options.v3
1245
+ return "<bcp14>#{value}</bcp14>"
1246
+ end
1247
+
1248
+ if title && title[0] == "#"
1249
+ target, title = title.split(' ', 2)
1250
+ if target == "#"
1251
+ target = value
1252
+ else
1253
+ target = target[1..]
1214
1254
  end
1255
+ else
1256
+ target = nil
1257
+ end
1258
+
1259
+ if item = title
1215
1260
  m = title.scan(Parser::RFC2629Kramdown::IREF_START)
1216
1261
  if m.empty?
1217
1262
  subitem = value
@@ -1222,7 +1267,11 @@ COLORS
1222
1267
  item = value
1223
1268
  end
1224
1269
  iref ||= "<iref#{html_attributes(item: item, subitem: subitem)}/>"
1225
- "#{el.value}#{iref}"
1270
+ if target
1271
+ "<xref#{html_attributes(target: target, format: "none")}>#{value}</xref>#{iref}"
1272
+ else
1273
+ "#{value}#{iref}"
1274
+ end
1226
1275
  end
1227
1276
 
1228
1277
  def convert_root(el, indent, opts)
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.5.9
4
+ version: 1.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown