kramdown-rfc2629 1.3.7 → 1.3.8
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 +23 -3
- 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: 0bf90a7fd57ee1492ceaf533983659336ca24c1334b79cd9be55661c4622d10f
|
4
|
+
data.tar.gz: 940584f0bea9de4fb1e2e9b91a79bd8b4eb0192543f625d7c0cbfa9858402275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f444f161ab0611bc92bbdb2f790c13f1676b9e035368fbcd7869317e5f30b28dd3e59789e55c0c6e3f67f5f8d4d5fa3d2368b26e307ab44f2e846604670754ab
|
7
|
+
data.tar.gz: dfcae66926b4a96424d0be1144d7ccf5c00a28b5153d2adf5897484b9f51826989bf14314909e7a3327ad9ac75b9b57f63270626890b7de3648ddbf2d63e2c5d
|
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.8'
|
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
@@ -150,13 +150,28 @@ module Kramdown
|
|
150
150
|
generate_id(value).gsub(/-+/, '-')
|
151
151
|
end
|
152
152
|
|
153
|
+
def svg_munch_color(c, fill)
|
154
|
+
case c
|
155
|
+
when /\A#(..)(..)(..)\z/
|
156
|
+
if [$1, $2, $3].map {|x| x.to_i(16)}.sum >= 300 # arbitrary
|
157
|
+
'white'
|
158
|
+
else
|
159
|
+
'black'
|
160
|
+
end
|
161
|
+
when 'none'
|
162
|
+
'none' if fill # delete for stroke
|
163
|
+
else
|
164
|
+
c
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
153
168
|
def svg_clean(s) # expensive, risky
|
154
169
|
require "rexml/document"
|
155
170
|
d = REXML::Document.new(s)
|
156
171
|
REXML::XPath.each(d.root, "//*[@shape-rendering]") { |x| x.attributes["shape-rendering"] = nil } #; warn x.inspect }
|
157
172
|
REXML::XPath.each(d.root, "//*[@text-rendering]") { |x| x.attributes["text-rendering"] = nil } #; warn x.inspect }
|
158
|
-
REXML::XPath.each(d.root, "//*[@stroke
|
159
|
-
REXML::XPath.each(d.root, "//*[@
|
173
|
+
REXML::XPath.each(d.root, "//*[@stroke]") { |x| x.attributes["stroke"] = svg_munch_color(x.attributes["stroke"], false) }
|
174
|
+
REXML::XPath.each(d.root, "//*[@fill]") { |x| x.attributes["fill"] = svg_munch_color(x.attributes["fill"], true) }
|
160
175
|
d.to_s
|
161
176
|
end
|
162
177
|
|
@@ -204,7 +219,7 @@ module Kramdown
|
|
204
219
|
end
|
205
220
|
end
|
206
221
|
case t
|
207
|
-
when "goat", "ditaa", "mscgen"
|
222
|
+
when "goat", "ditaa", "mscgen", "plantuml", "plantuml-utxt"
|
208
223
|
require 'tempfile'
|
209
224
|
file = Tempfile.new("kramdown-rfc")
|
210
225
|
file.write(result)
|
@@ -218,6 +233,11 @@ module Kramdown
|
|
218
233
|
when "mscgen"
|
219
234
|
result1, _s = Open3.capture2("mscgen -T svg -i #{file.path} -o -", stdin_data: result);
|
220
235
|
result1 = svg_clean(result1)
|
236
|
+
when "plantuml", "plantuml-utxt"
|
237
|
+
plantuml = "@startuml\n#{result}\n@enduml"
|
238
|
+
result1, _s = Open3.capture2("plantuml -pipe -tsvg", stdin_data: plantuml);
|
239
|
+
result1 = svg_clean(result1)
|
240
|
+
result, _s = Open3.capture2("plantuml -pipe -tutxt", stdin_data: plantuml) if t == "plantuml-utxt"
|
221
241
|
end
|
222
242
|
# warn ["goat:", result1.inspect]
|
223
243
|
file.unlink
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|