kramdown-rfc2629 1.5.8 → 1.5.12

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: aae2496e99617a40af73396c192f95468dc6121cf70c5e922f99a6b556845b9b
4
- data.tar.gz: dc169593b56f2f5fe7c8aa4e0856235fbe8d30ee4305b2d9683bf48738602b9e
3
+ metadata.gz: 7bb5b3f39e014d065b0dd2b72bd851804856c97610b1e24f863bd4c7c48a5c71
4
+ data.tar.gz: '09f66a0f2557a18c023d0d991d009a5fe48568a7fd4c20a39540d111d4610c02'
5
5
  SHA512:
6
- metadata.gz: 7700dc39c4cd1d577dce2b3247b8ccd69f162a8c07054fc07ad3c624e40cc1001b3c7d62caf61998ae604262c5a922b755d0982ca9c359c5d0f90e0fc7c93805
7
- data.tar.gz: ad59b578ac48256e82068806ebb1a8fad4f61f4b8849f25a18875378103f0d91e4595877979fce2af76225d3c6c9043cd833de7102782af8c9dd4c7343474f45
6
+ metadata.gz: 8a18e3db3281a30d45d60cf2f7e82f1addece4ff7867c70db1bfa104cbb015d416475659d677525ac50cc99ee83f46c874fddaba1bc04aa5109752bc7de56a6d
7
+ data.tar.gz: f3f0e0da73244c8c78cdf1148b5036e412dbb95bd0e6d743b0d262bb5d52a2e595ef982433f527dd0ecabba2e75a544da0c17990943382fd67c21fda140adacc
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.5.8'
3
+ s.version = '1.5.12'
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"]
@@ -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
@@ -1033,6 +1061,8 @@ COLORS
1033
1061
  %{https://www.ietf.org/archive/id/}) if t == "I-D"
1034
1062
  }
1035
1063
  end
1064
+ elsif t == "IANA"
1065
+ d.root.attributes["target"].sub!(%r{\Ahttp://www.iana.org/assignments/}, 'https://www.iana.org/assignments/')
1036
1066
  end
1037
1067
  to_insert = d.to_s
1038
1068
  rescue Exception => e
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.8
4
+ version: 1.5.12
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-07 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown