kramdown-rfc2629 1.6.19 → 1.6.21

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: c9420854e2a94d90920b07235fa94c0e49d57eb166e126cd3802fc6fce135271
4
- data.tar.gz: 0b36ade9a83c4e48e2aa2a95b935001e8cf4d5afb226ffd19104c67c43e243df
3
+ metadata.gz: 8c26f93c43853de6883440e6a3214201def29879da0945a42681749ffe545c1e
4
+ data.tar.gz: fce8091ebcdfe69d9d96e12bca694ef8e1f66fab43ccbb6f7aeabf4f5be298f1
5
5
  SHA512:
6
- metadata.gz: 4be21e41f1eac8424d118c00f40c4ab1b10988b48cbe618a9347961f5e9dfc20b4af544235d8cac60059c4b713b9ed36480dba987aee3eafdcf02800467a488d
7
- data.tar.gz: 50576e9002911cde89a4b1cae411e9f589481430ff0c58157fbcd0b2553cef365db6cab32a4dd9dd79ba88c256e7862b647a1bbe9c407b85607318aa72f6595b
6
+ metadata.gz: b1536eaeae7bcbd548fea24c97e5a49c5482531c0ec929f410af5dda419fa4f13ed8d92cc71e2132dd931351cde97faf36d9a3ec5a57539d3c334ed4df7228d3
7
+ data.tar.gz: 5370b01327233a3f027673939f2e7e15f166bc27a81c48d3f8d82976af85b3c9c2cd219fe1c3281d364f21faf33b50f467efc18136b0cdc697739f7b82baa8c3
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.6.19'
3
+ s.version = '1.6.21'
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.}
@@ -5,7 +5,9 @@ require 'yaml'
5
5
  ACCEPT_CITE_JSON = {"Accept" => "application/citeproc+json"}
6
6
 
7
7
  def doi_fetch_and_convert(doi, fuzzy: false, verbose: false)
8
- cite = JSON.parse(URI("https://dx.doi.org/#{doi}").open(ACCEPT_CITE_JSON).read)
8
+ doipath = doi.sub(/^([0-9.]+)_/) {"#$1/"} # convert initial _ back to /
9
+ # warn "** SUB #{doi} #{doipath}" if doi != doipath
10
+ cite = JSON.parse(URI("https://dx.doi.org/#{doipath}").open(ACCEPT_CITE_JSON).read)
9
11
  puts cite.to_yaml if verbose
10
12
  lit = {}
11
13
  ser = lit["seriesinfo"] = {}
@@ -714,6 +714,20 @@ COLORS
714
714
  [clean, irefs]
715
715
  end
716
716
 
717
+ def clean_pcdatav3(parts) # hack, will become unnecessary with v3 tables
718
+ clean = ''
719
+ parts.each do |p|
720
+ next if p.empty?
721
+ d = REXML::Document.new("<foo>#{p}</foo>")
722
+ t = REXML::XPath.each(d.root, "//text()").to_a.join
723
+ if t != p
724
+ warn "** simplified markup #{p.inspect} into #{t.inspect} in table heading"
725
+ end
726
+ clean << t
727
+ end
728
+ clean
729
+ end
730
+
717
731
  def convert_header(el, indent, opts)
718
732
  # todo: handle appendix tags
719
733
  el = el.deep_clone
@@ -892,8 +906,13 @@ COLORS
892
906
  end
893
907
  end
894
908
  if alignment
895
- res, irefs = clean_pcdata(inner_a(el, indent, opts))
896
- warn "*** lost markup #{irefs} in table heading" unless irefs.empty?
909
+ xmlres = inner_a(el, indent, opts)
910
+ if $options.v3
911
+ res = clean_pcdatav3(xmlres)
912
+ else
913
+ res, irefs = clean_pcdata(xmlres)
914
+ warn "*** lost markup #{irefs} in table heading" unless irefs.empty?
915
+ end
897
916
  "#{' '*indent}<ttcol #{widthopt}align='#{alignment}'#{el_html_attributes(el)}>#{res.empty? ? "&#160;" : res}</ttcol>\n" # XXX need clean_pcdata
898
917
  else
899
918
  res = inner(el, indent, opts)
@@ -1124,6 +1143,7 @@ COLORS
1124
1143
  KRAMDOWN_REFCACHETTL = (e = ENV["KRAMDOWN_REFCACHETTL"]) ? e.to_i : 3600
1125
1144
 
1126
1145
  KRAMDOWN_NO_TARGETS = ENV['KRAMDOWN_NO_TARGETS']
1146
+ KRAMDOWN_KEEP_TARGETS = ENV['KRAMDOWN_KEEP_TARGETS']
1127
1147
 
1128
1148
  def convert_img(el, indent, opts) # misuse the tag!
1129
1149
  if a = el.attr
@@ -1167,7 +1187,7 @@ COLORS
1167
1187
  d.delete d.doctype
1168
1188
  d.root.attributes["anchor"] = anchor
1169
1189
  if t == "RFC" or t == "I-D"
1170
- if KRAMDOWN_NO_TARGETS
1190
+ if KRAMDOWN_NO_TARGETS || !KRAMDOWN_KEEP_TARGETS
1171
1191
  d.root.attributes["target"] = nil
1172
1192
  REXML::XPath.each(d.root, "/reference/format") { |x|
1173
1193
  d.root.delete_element(x)
@@ -1390,9 +1410,9 @@ COLORS
1390
1410
  end
1391
1411
  iref ||= "<iref#{html_attributes(item: item, subitem: subitem)}/>"
1392
1412
  if target
1393
- "<xref#{html_attributes(target: target, format: "none")}>#{value}</xref>#{iref}"
1413
+ "#{iref}<xref#{html_attributes(target: target, format: "none")}>#{value}</xref>"
1394
1414
  else
1395
- "#{value}#{iref}"
1415
+ "#{iref}#{value}"
1396
1416
  end
1397
1417
  end
1398
1418
 
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.6.19
4
+ version: 1.6.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-10 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown