kramdown-rfc2629 1.6.5 → 1.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/de-gfm +15 -7
- data/bin/kramdown-rfc-autolink-iref-cleanup.rb +31 -0
- data/data/kramdown-rfc2629.erb +1 -1
- data/kramdown-rfc2629.gemspec +4 -4
- data/lib/kramdown-rfc/command.rb +2 -2
- data/lib/kramdown-rfc/gzip-clone.rb +3 -2
- data/lib/kramdown-rfc2629.rb +4 -4
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d59387d706ba44ac2ac591f8d2dbddeae8d1a4b451fa8252b6231f655fbce56
|
4
|
+
data.tar.gz: f059d6c8a0006257317423d23c5a8478b722e00bf33d441e7f892d67248fa2bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93865dc7e09b2a905a58873beb724d9d7a8c7b66b2d012c88bd562fa0ecc667558b44765c304a174d339c8ea89b4cb6e72b47aa35463e0ba6dba6e0d3909dc16
|
7
|
+
data.tar.gz: c85e67c72649fd7fd702713572118300e10d24146c04008ba681b892ed985fc1c4918f9bf3a7f61b040096fe4bc29ded9b3c1632fd89cabb47a54cb6571589a3
|
data/bin/de-gfm
CHANGED
@@ -5,19 +5,22 @@ Encoding.default_external = "UTF-8" # wake up, smell the coffee
|
|
5
5
|
require 'kramdown'
|
6
6
|
require 'kramdown-parser-gfm'
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
options = ''
|
9
|
+
while /\A-([4bck]+)\z/ === ARGV[0]
|
10
10
|
ARGV.shift
|
11
|
+
options << $1
|
12
|
+
end
|
13
|
+
|
14
|
+
if /k/ === options # kramdown
|
15
|
+
MARKDOWN_BR = "\\\\\n"
|
11
16
|
end
|
12
17
|
|
13
|
-
if
|
18
|
+
if /c/ === options # commonmark
|
14
19
|
MARKDOWN_BR = "\\\n"
|
15
|
-
ARGV.shift
|
16
20
|
end
|
17
21
|
|
18
|
-
if
|
22
|
+
if /b/ === options # universal HTML
|
19
23
|
MARKDOWN_BR = "<br/>\n"
|
20
|
-
ARGV.shift
|
21
24
|
end
|
22
25
|
|
23
26
|
MARKDOWN_BR ||= " \n" # original Gruber
|
@@ -37,4 +40,9 @@ module Kramdown
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
|
-
|
43
|
+
list_indent = 2
|
44
|
+
list_indent = 4 if /4/ === options
|
45
|
+
|
46
|
+
doc = Kramdown::Document.new(ARGF.read, input: 'GFM', gfm_quirks: 'paragraph_end',
|
47
|
+
list_indent: list_indent)
|
48
|
+
puts doc.to_kramdown
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
require 'rexml/document'
|
4
|
+
|
5
|
+
d = REXML::Document.new(ARGF.read)
|
6
|
+
|
7
|
+
d.root.get_elements("//section[@anchor]").each do |sec|
|
8
|
+
anchor = sec['anchor']
|
9
|
+
irefs = {}
|
10
|
+
sec.get_elements(".//xref[@target='#{anchor}'][@format='none']").each do |xr|
|
11
|
+
ne = xr.next_element
|
12
|
+
if ne && ne.name == "iref" && (item = ne['item'])
|
13
|
+
irefs[item] = ne['subitem'] # XXX one subitem only
|
14
|
+
ne.remove
|
15
|
+
chi = xr.children
|
16
|
+
chi[1..-1].reverse.each do |ch|
|
17
|
+
xr.parent.insert_after(xr, ch)
|
18
|
+
end
|
19
|
+
xr.replace_with(chi[0])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
irefs.each do |k, v|
|
23
|
+
sec.insert_after(sec.get_elements("name").first,
|
24
|
+
e = REXML::Element.new("iref", sec))
|
25
|
+
e.attributes["item"] = k
|
26
|
+
e.attributes["subitem"] = v
|
27
|
+
e.attributes["primary"] = 'true'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
puts d.to_s
|
data/data/kramdown-rfc2629.erb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="<%=ps[:coding]||"UTF-8"%>"?>
|
2
2
|
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
|
3
|
-
<!-- generated by https://github.com/cabo/kramdown-
|
3
|
+
<!-- generated by https://github.com/cabo/kramdown-rfc version <%=
|
4
4
|
Gem.loaded_specs["kramdown-rfc2629"].version rescue nil
|
5
5
|
%> (Ruby <%= RUBY_VERSION %>) -->
|
6
6
|
|
data/kramdown-rfc2629.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'kramdown-rfc2629'
|
3
|
-
s.version = '1.6.
|
3
|
+
s.version = '1.6.8'
|
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.}
|
7
|
-
s.add_dependency('kramdown', '~> 2.
|
7
|
+
s.add_dependency('kramdown', '~> 2.4.0')
|
8
8
|
s.add_dependency('kramdown-parser-gfm', '~> 1.1')
|
9
9
|
s.add_dependency('certified', '~> 1.0')
|
10
10
|
s.add_dependency('json_pure', '~> 2.0')
|
11
|
-
s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kdrfc bin/kramdown-rfc bin/kramdown-rfc2629 bin/doilit bin/kramdown-rfc-extract-markdown data/kramdown-rfc2629.erb data/encoding-fallbacks.txt data/math.json bin/kramdown-rfc-cache-subseries-bibxml bin/de-gfm)
|
11
|
+
s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kdrfc bin/kramdown-rfc bin/kramdown-rfc2629 bin/doilit bin/kramdown-rfc-extract-markdown data/kramdown-rfc2629.erb data/encoding-fallbacks.txt data/math.json bin/kramdown-rfc-cache-subseries-bibxml bin/kramdown-rfc-autolink-iref-cleanup.rb bin/de-gfm)
|
12
12
|
s.require_path = 'lib'
|
13
13
|
s.executables = ['kramdown-rfc', 'kramdown-rfc2629', 'doilit', 'kramdown-rfc-extract-markdown',
|
14
14
|
'kdrfc', 'kramdown-rfc-cache-i-d-bibxml',
|
@@ -18,6 +18,6 @@ spec = Gem::Specification.new do |s|
|
|
18
18
|
# s.has_rdoc = true
|
19
19
|
s.author = "Carsten Bormann"
|
20
20
|
s.email = "cabo@tzi.org"
|
21
|
-
s.homepage = "http://github.com/cabo/kramdown-
|
21
|
+
s.homepage = "http://github.com/cabo/kramdown-rfc"
|
22
22
|
s.license = 'MIT'
|
23
23
|
end
|
data/lib/kramdown-rfc/command.rb
CHANGED
@@ -229,7 +229,7 @@ def xml_from_sections(input)
|
|
229
229
|
unless ENV["KRAMDOWN_NO_SOURCE"]
|
230
230
|
require 'kramdown-rfc/gzip-clone'
|
231
231
|
require 'base64'
|
232
|
-
compressed_input = Gzip.
|
232
|
+
compressed_input = Gzip.compress_m0(input)
|
233
233
|
$source = Base64.encode64(compressed_input)
|
234
234
|
end
|
235
235
|
|
@@ -485,7 +485,7 @@ Usage: kramdown-rfc2629 [options] file.md|file.mkd > file.xml
|
|
485
485
|
Version: #{KDRFC_VERSION}
|
486
486
|
BANNER
|
487
487
|
opts.on("-V", "--version", "Show version and exit") do |v|
|
488
|
-
puts "kramdown-
|
488
|
+
puts "kramdown-rfc #{KDRFC_VERSION}"
|
489
489
|
exit
|
490
490
|
end
|
491
491
|
opts.on("-H", "--help", "Show option summary and exit") do |v|
|
@@ -24,10 +24,11 @@ require 'stringio'
|
|
24
24
|
Zlib::GzipReader.new(StringIO.new(source)).read
|
25
25
|
end
|
26
26
|
|
27
|
-
# Compresses a string using gzip
|
28
|
-
def self.
|
27
|
+
# Compresses a string using gzip, setting mtime to 0
|
28
|
+
def self.compress_m0(source, level=Zlib::DEFAULT_COMPRESSION, strategy=Zlib::DEFAULT_STRATEGY)
|
29
29
|
output = Stream.new
|
30
30
|
gz = Zlib::GzipWriter.new(output, level, strategy)
|
31
|
+
gz.mtime = 0
|
31
32
|
gz.write(source)
|
32
33
|
gz.close
|
33
34
|
output.string
|
data/lib/kramdown-rfc2629.rb
CHANGED
@@ -12,7 +12,7 @@ require 'shellwords'
|
|
12
12
|
|
13
13
|
raise "sorry, 1.8 was last decade" unless RUBY_VERSION >= '1.9'
|
14
14
|
|
15
|
-
gem 'kramdown', '~> 2.
|
15
|
+
gem 'kramdown', '~> 2.4.0'
|
16
16
|
require 'kramdown'
|
17
17
|
my_span_elements = %w{list figure xref eref iref cref spanx vspace}
|
18
18
|
Kramdown::Parser::Html::Constants::HTML_SPAN_ELEMENTS.concat my_span_elements
|
@@ -113,7 +113,7 @@ module Kramdown
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
XREF_START = /\{\{(?:(?:\{(
|
116
|
+
XREF_START = /\{\{(?:(?:\{(.*?\n??.*?)\}(?:\{(.*?\n??.*?)\})?)|(\X*?))((?:\}\})|\})/u
|
117
117
|
|
118
118
|
# Introduce new {{target}} syntax for empty xrefs, which would
|
119
119
|
# otherwise be an ugly ![!](target) or ![ ](target)
|
@@ -124,9 +124,9 @@ module Kramdown
|
|
124
124
|
warn "*** #{@src[0]}: unmatched braces #{@src[4].inspect}"
|
125
125
|
end
|
126
126
|
if contact_name = @src[1]
|
127
|
-
attr = {'fullname' => contact_name}
|
127
|
+
attr = {'fullname' => contact_name.gsub("\n", " ")}
|
128
128
|
if ascii_name = @src[2]
|
129
|
-
attr["asciiFullname"] = ascii_name
|
129
|
+
attr["asciiFullname"] = ascii_name.gsub("\n", " ")
|
130
130
|
end
|
131
131
|
el = Element.new(:contact, nil, attr)
|
132
132
|
else
|
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.
|
4
|
+
version: 1.6.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: 2022-
|
11
|
+
date: 2022-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: kramdown-parser-gfm
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- bin/doilit
|
89
89
|
- bin/kdrfc
|
90
90
|
- bin/kramdown-rfc
|
91
|
+
- bin/kramdown-rfc-autolink-iref-cleanup.rb
|
91
92
|
- bin/kramdown-rfc-cache-i-d-bibxml
|
92
93
|
- bin/kramdown-rfc-cache-subseries-bibxml
|
93
94
|
- bin/kramdown-rfc-extract-markdown
|
@@ -104,7 +105,7 @@ files:
|
|
104
105
|
- lib/kramdown-rfc/refxml.rb
|
105
106
|
- lib/kramdown-rfc/rfc8792.rb
|
106
107
|
- lib/kramdown-rfc2629.rb
|
107
|
-
homepage: http://github.com/cabo/kramdown-
|
108
|
+
homepage: http://github.com/cabo/kramdown-rfc
|
108
109
|
licenses:
|
109
110
|
- MIT
|
110
111
|
metadata: {}
|
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '0'
|
125
126
|
requirements: []
|
126
|
-
rubygems_version: 3.3.
|
127
|
+
rubygems_version: 3.3.11
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: Kramdown extension for generating RFCXML (RFC 799x).
|