kramdown-rfc2629 1.0.22 → 1.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -4
- data/kramdown-rfc2629.gemspec +2 -2
- data/lib/kramdown-rfc2629.rb +20 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 698548620d4e748036b15cd0e162b8678014def9
|
4
|
+
data.tar.gz: 8bcc1949c2e8c8b5fee322813f831733bd0453fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a5dda70d77db73ad469c68f4937fa8cd9e1c671b03e42823c41b3c921fd68850c31dd672e9af41602832bd306a796327f9b1472c1646e4c2b32bd1ce0dae22
|
7
|
+
data.tar.gz: 1b13002f217a086b7cebf14e1a46a679ac83952e4121cb2035c33b074202bad70258504b74d459829d02bd12ff886c42ceed0a8847012c76e3c2f26e190593b8
|
data/README.md
CHANGED
@@ -14,9 +14,12 @@ their work in markdown.
|
|
14
14
|
# Usage
|
15
15
|
|
16
16
|
Start by installing the kramdown-rfc2629 gem (this automatically
|
17
|
-
installs kramdown version 1.
|
17
|
+
installs kramdown version 1.6.x as well):
|
18
18
|
|
19
|
-
|
19
|
+
gem install kramdown-rfc2629
|
20
|
+
|
21
|
+
(Add a `sudo` and a space in front of that command if you don't have
|
22
|
+
all the permissions needed.)
|
20
23
|
|
21
24
|
The guts of kramdown-rfc2629 are in one Ruby file,
|
22
25
|
`lib/kramdown-rfc2629.rb` --- this melds nicely into the extension
|
@@ -215,6 +218,39 @@ special support in XML2RFC), and HTML syntax of course.
|
|
215
218
|
A number of more esoteric features have recently been added.
|
216
219
|
(The minimum required version for each full feature is indicated.)
|
217
220
|
|
221
|
+
(1.0.23:)
|
222
|
+
Move up to kramdown 1.6.0. This inherits a number of fixes and one
|
223
|
+
nice feature:
|
224
|
+
Markdown footnote definitions that turn into `cref`s can have their
|
225
|
+
attributes in the footnote definition:
|
226
|
+
|
227
|
+
```markdown
|
228
|
+
{:cabo: source="cabo"}
|
229
|
+
|
230
|
+
(This section to be removed by the RFC editor.)[^1]
|
231
|
+
|
232
|
+
[^1]: here is my editorial comment: warble warble.
|
233
|
+
{:cabo}
|
234
|
+
|
235
|
+
Another questionable paragraph.[^2]
|
236
|
+
|
237
|
+
[^2]: so why not delete it?
|
238
|
+
{: source="observer"}
|
239
|
+
```
|
240
|
+
|
241
|
+
(1.0.23:)
|
242
|
+
As before, IAL attributes on a codeblock go to the figure element.
|
243
|
+
Language attributes on the code block now become the artwork type, and any
|
244
|
+
attribute with a name that starts "artwork-" is moved over to the artwork.
|
245
|
+
So this snippet now does the obvious things:
|
246
|
+
|
247
|
+
```markdown
|
248
|
+
~~~ abnf
|
249
|
+
a = b / %s"foo" / %x0D.0A
|
250
|
+
~~~
|
251
|
+
{: artwork-align="center" artwork-name="syntax"}
|
252
|
+
```
|
253
|
+
|
218
254
|
(1.0.22:)
|
219
255
|
Index entries can be created with `(((item)))` or
|
220
256
|
`(((item, subitem)))`; use quotes for weird entries: `(((",", comma)))`.
|
@@ -239,7 +275,8 @@ index entries instead (third example).
|
|
239
275
|
(1.0.20:)
|
240
276
|
As an alternative referencing syntax for references with text,
|
241
277
|
`{{ref}}` can be expressed as `[text](#ref)`. As a special case, a
|
242
|
-
simple `[ref]` is interpreted as `[](#ref)
|
278
|
+
simple `[ref]` is interpreted as `[](#ref)` (except that the latter
|
279
|
+
syntax is not actually allowed by kramdown). This syntax does not
|
243
280
|
allow for automatic entry of items as normative/informative.
|
244
281
|
|
245
282
|
(1.0.16:) Markdown footnotes are converted into `cref`s (XML2RFC formal
|
@@ -321,11 +358,13 @@ note that this creates ugly blank space in some HTML converters).
|
|
321
358
|
|
322
359
|
The code is not very polished, but now quite stable; it has been successfully used for a
|
323
360
|
number of non-trivial Internet-Drafts and RFCs. You probably still need to
|
324
|
-
skim [RFC 2629][] if you want to write an Internet-Draft, but you
|
361
|
+
skim [RFC 2629][] (or the more current [Internet-Draft][IAB-RFCXMLv2]) if you want to write an Internet-Draft, but you
|
325
362
|
don't really need to understand XML very much. Knowing the basics of
|
326
363
|
YAML helps with the metadata (but you'll understand it from the
|
327
364
|
examples).
|
328
365
|
|
366
|
+
[IAB-RFCXMLv2]: https://tools.ietf.org/html/draft-iab-xml2rfcv2-00
|
367
|
+
|
329
368
|
# Upconversion
|
330
369
|
|
331
370
|
If you have an old RFC and want to convert it to markdown, try just
|
data/kramdown-rfc2629.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'kramdown-rfc2629'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.23'
|
4
4
|
s.summary = "Kramdown extension for generating RFC 2629 XML."
|
5
5
|
s.description = %{An RFC2629 (XML2RFC) generating backend for Thomas Leitner's
|
6
6
|
"kramdown" markdown parser. Mostly useful for RFC writers.}
|
7
|
-
s.add_dependency('kramdown', '~> 1.
|
7
|
+
s.add_dependency('kramdown', '~> 1.6.0')
|
8
8
|
s.files = Dir['lib/**/*.rb'] + %w(README.md LICENSE kramdown-rfc2629.gemspec bin/kramdown-rfc2629 data/kramdown-rfc2629.erb)
|
9
9
|
s.require_path = 'lib'
|
10
10
|
s.executables = ['kramdown-rfc2629']
|
data/lib/kramdown-rfc2629.rb
CHANGED
@@ -11,8 +11,10 @@
|
|
11
11
|
|
12
12
|
raise "sorry, 1.8 was last decade" unless RUBY_VERSION >= '1.9'
|
13
13
|
|
14
|
-
gem 'kramdown', '~> 1.
|
14
|
+
gem 'kramdown', '~> 1.6.0'
|
15
15
|
require 'kramdown'
|
16
|
+
my_span_elements = %w{list figure xref eref iref cref spanx vspace}
|
17
|
+
Kramdown::Parser::Html::Constants::HTML_SPAN_ELEMENTS.concat my_span_elements
|
16
18
|
|
17
19
|
require 'rexml/parsers/baseparser'
|
18
20
|
|
@@ -25,6 +27,7 @@ end
|
|
25
27
|
module Kramdown
|
26
28
|
|
27
29
|
module Parser
|
30
|
+
|
28
31
|
class RFC2629Kramdown < Kramdown
|
29
32
|
|
30
33
|
def initialize(*doc)
|
@@ -166,14 +169,28 @@ module Kramdown
|
|
166
169
|
}.compact.join("\n")
|
167
170
|
"#{' '*indent}<t>#{result}</t>\n"
|
168
171
|
else
|
172
|
+
artwork_attr = {}
|
169
173
|
if blockclass
|
170
|
-
|
174
|
+
classes = blockclass.split(' ')
|
175
|
+
classes.each do |cl|
|
176
|
+
if md = cl.match(/\Alanguage-(.*)/)
|
177
|
+
artwork_attr["type"] = md[1] # XXX overwrite
|
178
|
+
else
|
179
|
+
$stderr.puts "*** Unimplemented block class: #{cl}"
|
180
|
+
end
|
181
|
+
end
|
171
182
|
end
|
172
183
|
# compensate for XML2RFC idiosyncracy by insisting on a blank line
|
173
184
|
unless el.attr.delete('tight')
|
174
185
|
result[0,0] = "\n" unless result[0,1] == "\n"
|
175
186
|
end
|
176
|
-
|
187
|
+
el.attr.each do |k, v|
|
188
|
+
if md = k.match(/\Aartwork-(.*)/)
|
189
|
+
el.attr.delete(k)
|
190
|
+
artwork_attr[md[1]] = v
|
191
|
+
end
|
192
|
+
end
|
193
|
+
"#{' '*indent}<figure#{el_html_attributes(el)}><artwork#{html_attributes(artwork_attr)}><![CDATA[#{result}#{result =~ /\n\Z/ ? '' : "\n"}]]></artwork></figure>\n"
|
177
194
|
end
|
178
195
|
end
|
179
196
|
|
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.0.
|
4
|
+
version: 1.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-02 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: 1.
|
19
|
+
version: 1.6.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: 1.
|
26
|
+
version: 1.6.0
|
27
27
|
description: |-
|
28
28
|
An RFC2629 (XML2RFC) generating backend for Thomas Leitner's
|
29
29
|
"kramdown" markdown parser. Mostly useful for RFC writers.
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
61
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.
|
62
|
+
rubygems_version: 2.4.5
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: Kramdown extension for generating RFC 2629 XML.
|