kramdown-rfc2629 1.3.32 → 1.3.33
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 +4 -4
- data/kramdown-rfc2629.gemspec +1 -1
- data/lib/kramdown-rfc2629.rb +31 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b532912e56847cec71ed5c419ea08af4d19d3f6c7a4d91edffbfaa3005dd37f
|
4
|
+
data.tar.gz: 6dbf519c9eadbddb50a07f6b1cef88cdcc9d877a5f66614ececf6bf5bc2d3353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f7f9faf79c570a7bcca633aef94a6f27d997d861eca1ecad0855795eef44728d925cc1d1b7751454b6c122168d12ef4f341b4ed350d8aeb9247b53e13d523ba
|
7
|
+
data.tar.gz: 2dcdb7cf588bd99e8e983b71eefbbb0a2aec8785f466abe8e83f6b7ea40061aecea69abe6466d94d2dc69c019dd798a0569e5ed66b65efc42bf76d448ef45778
|
data/kramdown-rfc2629.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'kramdown-rfc2629'
|
3
|
-
s.version = '1.3.
|
3
|
+
s.version = '1.3.33'
|
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.}
|
data/lib/kramdown-rfc2629.rb
CHANGED
@@ -20,6 +20,7 @@ Kramdown::Parser::Html::Constants::HTML_SPAN_ELEMENTS.concat my_span_elements
|
|
20
20
|
require 'rexml/parsers/baseparser'
|
21
21
|
require 'open3' # for math
|
22
22
|
require 'json' # for math
|
23
|
+
require 'rexml/document' # for SVG and bibxml acrobatics
|
23
24
|
|
24
25
|
class Object
|
25
26
|
def deep_clone
|
@@ -179,6 +180,7 @@ module Kramdown
|
|
179
180
|
# :stopdoc:
|
180
181
|
|
181
182
|
KRAMDOWN_PERSISTENT = ENV["KRAMDOWN_PERSISTENT"]
|
183
|
+
KRAMDOWN_PERSISTENT_VERBOSE = /v/ === KRAMDOWN_PERSISTENT
|
182
184
|
|
183
185
|
if KRAMDOWN_PERSISTENT
|
184
186
|
begin
|
@@ -292,7 +294,6 @@ COLORS
|
|
292
294
|
end
|
293
295
|
|
294
296
|
def svg_clean(s) # expensive, risky
|
295
|
-
require "rexml/document"
|
296
297
|
d = REXML::Document.new(s)
|
297
298
|
REXML::XPath.each(d.root, "//*[@shape-rendering]") { |x| x.attributes["shape-rendering"] = nil } #; warn x.inspect }
|
298
299
|
REXML::XPath.each(d.root, "//*[@text-rendering]") { |x| x.attributes["text-rendering"] = nil } #; warn x.inspect }
|
@@ -718,7 +719,7 @@ COLORS
|
|
718
719
|
File.write(fn, response.body)
|
719
720
|
end
|
720
721
|
t2 = Time.now
|
721
|
-
warn "(#{"%.3f" % (t2 - t1)} s)"
|
722
|
+
warn "(#{"%.3f" % (t2 - t1)} s)" if KRAMDOWN_PERSISTENT_VERBOSE
|
722
723
|
end
|
723
724
|
|
724
725
|
# this is now slightly dangerous as multiple urls could map to the same cachefile
|
@@ -805,6 +806,8 @@ COLORS
|
|
805
806
|
|
806
807
|
KRAMDOWN_REFCACHETTL = (e = ENV["KRAMDOWN_REFCACHETTL"]) ? e.to_i : 3600
|
807
808
|
|
809
|
+
KRAMDOWN_NO_TARGETS = ENV['KRAMDOWN_NO_TARGETS']
|
810
|
+
|
808
811
|
def convert_img(el, indent, opts) # misuse the tag!
|
809
812
|
if a = el.attr
|
810
813
|
alt = a.delete('alt').strip
|
@@ -838,10 +841,32 @@ COLORS
|
|
838
841
|
# end
|
839
842
|
to_insert = get_and_cache_resource(url, fn.gsub('/', '_'), ttl)
|
840
843
|
to_insert.scrub! rescue nil # only do this for Ruby >= 2.1
|
841
|
-
|
842
|
-
|
844
|
+
|
845
|
+
begin
|
846
|
+
d = REXML::Document.new(to_insert)
|
847
|
+
d.xml_decl.nowrite
|
848
|
+
d.root.attributes["anchor"] = anchor
|
849
|
+
if t == "RFC" or t == "I-D"
|
850
|
+
if KRAMDOWN_NO_TARGETS
|
851
|
+
d.root.attributes["target"] = nil
|
852
|
+
REXML::XPath.each(d.root, "/reference/format") { |x|
|
853
|
+
d.root.delete_element(x)
|
854
|
+
}
|
855
|
+
else
|
856
|
+
REXML::XPath.each(d.root, "/reference/format") { |x|
|
857
|
+
x.attributes["target"].sub!(%r{https?://www.ietf.org/internet-drafts/},
|
858
|
+
%{https://www.ietf.org/archive/id/}) if t == "I-D"
|
859
|
+
}
|
860
|
+
end
|
861
|
+
end
|
862
|
+
to_insert = d.to_s
|
863
|
+
rescue Exception => e
|
864
|
+
warn "** Can't manipulate reference XML: #{e}"
|
865
|
+
broken = true
|
866
|
+
to_insert = nil
|
867
|
+
end
|
843
868
|
# this may be a bit controversial: Don't break the build if reference is broken
|
844
|
-
if KRAMDOWN_OFFLINE
|
869
|
+
if KRAMDOWN_OFFLINE || broken
|
845
870
|
unless to_insert
|
846
871
|
to_insert = "<reference anchor='#{anchor}'> <front> <title>*** BROKEN REFERENCE ***</title> <author> <organization/> </author> <date/> </front> </reference>"
|
847
872
|
warn "*** KRAMDOWN_OFFLINE: Inserting broken reference for #{fn}"
|
@@ -850,8 +875,7 @@ COLORS
|
|
850
875
|
exit 66 unless to_insert # EX_NOINPUT
|
851
876
|
end
|
852
877
|
end
|
853
|
-
to_insert
|
854
|
-
.sub(/\banchor=(?:"[^"]+"|'[^']+')/, "anchor=\"#{anchor}\"")
|
878
|
+
to_insert
|
855
879
|
else
|
856
880
|
"<xref#{el_html_attributes(el)}>#{alt}</xref>"
|
857
881
|
end
|
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.3.
|
4
|
+
version: 1.3.33
|
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-02-
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|