kramdown-rfc2629 1.5.26 → 1.6.3
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/README.md +48 -30
- data/bin/kdrfc +17 -0
- data/bin/kramdown-rfc +9 -0
- data/bin/kramdown-rfc2629 +1 -536
- data/data/kramdown-rfc2629.erb +4 -0
- data/kramdown-rfc2629.gemspec +5 -5
- data/lib/kramdown-rfc/command.rb +577 -0
- data/lib/kramdown-rfc/kdrfc-processor.rb +3 -1
- data/lib/kramdown-rfc/parameterset.rb +9 -1
- data/lib/kramdown-rfc2629.rb +12 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b003da925c1e39427d87c4fcd7d7c88b8856487e30d97852fcec7fbbe6d1af2b
|
4
|
+
data.tar.gz: c60938799b0743c815ea5fa4164ad6c612ed844a079f612dbf89a639cec84008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85ceb08f58a4f61b8469c5931fef8557c0a7c7c022ca7010e91c3308e021eba60c8177a044f328bbbed89116a2f46196687b5f2bf7b549b01b54d9fff7d562ce
|
7
|
+
data.tar.gz: 3c82a83334f373e27fc50e8397efbc9244ae2bbabb8b5e2663f167cace9f3341e6983e068ed9f0ee2dd924f68377b377a48341bf6c91f8c89cb9ac41382e2e82
|
data/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
# kramdown-
|
1
|
+
# kramdown-rfc
|
2
2
|
|
3
3
|
[kramdown][] is a [markdown][] parser by Thomas Leitner, which has a
|
4
4
|
number of backends for generating HTML, Latex, and markdown again.
|
5
5
|
|
6
|
-
**kramdown-
|
6
|
+
**kramdown-rfc** is an additional backend to that: It allows the
|
7
7
|
generation of [XML2RFC][] XML markup (originally known as [RFC 2629][]
|
8
|
-
compliant markup,
|
8
|
+
compliant markup, with a newer version documented in [RFC 7749][];
|
9
|
+
version 3 now documented in [RFC 7991][] etc. and [v3][]).
|
9
10
|
|
10
11
|
Who would care? Anybody who is writing Internet-Drafts and RFCs in
|
11
12
|
the [IETF][] and prefers (or has co-authors who prefer) to do part of
|
@@ -13,33 +14,33 @@ their work in markdown.
|
|
13
14
|
|
14
15
|
# Usage
|
15
16
|
|
16
|
-
Start by installing the kramdown-
|
17
|
+
Start by installing the kramdown-rfc gem (this automatically
|
17
18
|
installs appropriate versions of referenced gems such as kramdown as
|
18
19
|
well):
|
19
20
|
|
20
|
-
gem install kramdown-
|
21
|
+
gem install kramdown-rfc
|
21
22
|
|
22
23
|
(Add a `sudo` and a space in front of that command if you don't have
|
23
24
|
all the permissions needed.)
|
24
25
|
|
25
|
-
The guts of kramdown-
|
26
|
+
The guts of kramdown-rfc are in one Ruby file,
|
26
27
|
`lib/kramdown-rfc2629.rb` --- this melds nicely into the extension
|
27
|
-
structure provided by kramdown. `bin/kramdown-
|
28
|
+
structure provided by kramdown. `bin/kramdown-rfc` started out as
|
28
29
|
a simple command-line program showing how to use this, but can now do
|
29
30
|
much more (see below).
|
30
31
|
|
31
|
-
To use kramdown-
|
32
|
+
To use kramdown-rfc, you'll need Ruby (at least version 2.3, but
|
32
33
|
preferably a current version), and maybe
|
33
34
|
[XML2RFC][] if you want to see the fruits of your work.
|
34
35
|
|
35
|
-
kramdown-
|
36
|
+
kramdown-rfc mydraft.mkd >mydraft.xml
|
36
37
|
xml2rfc mydraft.xml
|
37
38
|
|
38
39
|
(The most popular file name extension that IETF people have for
|
39
40
|
markdown is .md -- for those who tend to think about GNU machine
|
40
41
|
descriptions here, any extension such as .mkd will do, too.)
|
41
42
|
|
42
|
-
A more brief interface for both calling kramdown-
|
43
|
+
A more brief interface for both calling kramdown-rfc and XML2RFC
|
43
44
|
is provided by `kdrfc`:
|
44
45
|
|
45
46
|
kdrfc mydraft.mkd
|
@@ -48,20 +49,35 @@ is provided by `kdrfc`:
|
|
48
49
|
|
49
50
|
kdrfc -r mydraft.mkd
|
50
51
|
|
52
|
+
# Versions of RFCXML
|
53
|
+
|
54
|
+
Since RFC 8650, RFCs are using an updated grammar as defined in RFC
|
55
|
+
7991 to 7998 and further updated informally since, colloquially called "[v3][]".
|
56
|
+
As RFC 2629 is no longer the governing standard, what was called kramdown-rfc2629 is
|
57
|
+
now called kramdown-rfc. The latter command defaults to v3 processing
|
58
|
+
rules; from 2022-02-22T22:02:22 on, the old kramdown-rfc2629 driver program does as well (1.6.1).
|
59
|
+
(-3/--v3 and -2/--v2 select v3 and v2 explicitly; the latter should
|
60
|
+
only be needed if there is a reason to to make a document look
|
61
|
+
like it's 2016.)
|
62
|
+
|
63
|
+
See also [v3 announcement mail][].
|
64
|
+
|
65
|
+
[v3 announcement mail]: https://mailarchive.ietf.org/arch/msg/rfc-markdown/JC__LDDGuUbSFqyaEntF9r4kwKw
|
66
|
+
|
51
67
|
# Examples
|
52
68
|
|
53
69
|
For historical interest
|
54
70
|
`stupid.mkd` was an early markdown version of an actual Internet-Draft
|
55
71
|
(for a protocol called [STuPiD][] \[sic!]). This demonstrated some,
|
56
|
-
but not all features of kramdown-
|
57
|
-
does not cater for all the structure of an RFC
|
72
|
+
but not all features of kramdown-rfc. Since markdown/kramdown
|
73
|
+
does not cater for all the structure of an RFC 7991 style document,
|
58
74
|
some of the markup is in XML, and the example switches between XML and
|
59
75
|
markdown using kramdown's `{::nomarkdown}` and `{:/nomarkdown}` (this
|
60
76
|
is ugly, but works well enough). `stupid.xml` and `stupid.txt` show
|
61
|
-
what kramdown-
|
77
|
+
what kramdown-rfc and xml2rfc make out of this.
|
62
78
|
|
63
79
|
`stupid-s.mkd` is the same document in the new sectionized format
|
64
|
-
supported by kramdown-
|
80
|
+
supported by kramdown-rfc. The document metadata are in a short
|
65
81
|
piece of YAML at the start, and from there, `abstract`, `middle`,
|
66
82
|
references (`normative` and `informative`) and `back` are sections
|
67
83
|
delimited in the markdown file. See the example for how this works.
|
@@ -69,7 +85,7 @@ The sections `normative` and `informative` can be populated right from
|
|
69
85
|
the metadata, so there is never a need to write XML any more.
|
70
86
|
Much less scary, and no `{:/nomarkdown}` etc. is needed any more.
|
71
87
|
Similarly, `stupid-s.xml` and `stupid-s.txt` show what
|
72
|
-
kramdown-
|
88
|
+
kramdown-rfc and xml2rfc make out of this.
|
73
89
|
|
74
90
|
`draft-ietf-core-block-xx.mkd` is a real-world example of a current
|
75
91
|
Internet-Draft done this way. For RFC and Internet-Draft references,
|
@@ -134,7 +150,7 @@ or
|
|
134
150
|
email: pthubert@cisco.com
|
135
151
|
|
136
152
|
(the hash keys are the XML GIs from RFC 7749, with a flattened
|
137
|
-
structure. As RFC 7749
|
153
|
+
structure. As RFC 7749 requiresd giving both the full name and
|
138
154
|
surname/initials, we use `ins` as an abbreviation for
|
139
155
|
"initials/surname". Yes, the toolchain is Unicode-capable, even if
|
140
156
|
the final RFC output is still in ASCII.)
|
@@ -148,7 +164,7 @@ might otherwise be interpreted as a number, losing the + sign).
|
|
148
164
|
|
149
165
|
The references section is built from the references listed in the YAML
|
150
166
|
header and from references made inline to RFCs and I-Ds in the
|
151
|
-
markdown text. Since kramdown-
|
167
|
+
markdown text. Since kramdown-rfc cannot know whether a reference
|
152
168
|
is normative or informative, no entry is generated by default in the
|
153
169
|
references section. By indicating a normative reference as in
|
154
170
|
`{{!RFC2119}}` or an informative one as in `{{?RFC1925}}`, you can
|
@@ -320,7 +336,7 @@ not have the tools installed in its docker instance.
|
|
320
336
|
|
321
337
|
More details have been collected on the [wiki][svg].
|
322
338
|
|
323
|
-
[svg]: https://github.com/cabo/kramdown-
|
339
|
+
[svg]: https://github.com/cabo/kramdown-rfc/wiki/SVG
|
324
340
|
|
325
341
|
(1.2.9:)
|
326
342
|
The YAML header now allows specifying [kramdown_options][].
|
@@ -536,7 +552,7 @@ note that this creates ugly blank space in some HTML converters).
|
|
536
552
|
|
537
553
|
The code is not very polished, but now quite stable; it has been successfully used for a
|
538
554
|
number of non-trivial Internet-Drafts and RFCs. You probably still need to
|
539
|
-
skim [
|
555
|
+
skim [v3][] if you want to write an Internet-Draft, but you
|
540
556
|
don't really need to understand XML very much. Knowing the basics of
|
541
557
|
YAML helps with the metadata (but you'll understand it from the
|
542
558
|
examples).
|
@@ -566,7 +582,7 @@ of the work. Please [contact the
|
|
566
582
|
author](mailto:cabo@tzi.org?subject=Markdown%20for%20RFCXML) if you want
|
567
583
|
to try it.
|
568
584
|
|
569
|
-
Actually, if the XML was generated by kramdown-
|
585
|
+
Actually, if the XML was generated by kramdown-rfc, you can simply
|
570
586
|
extract the input markdown from that XML file (but will of course lose
|
571
587
|
any edits that have been made to the XML file after generation):
|
572
588
|
|
@@ -576,21 +592,21 @@ any edits that have been made to the XML file after generation):
|
|
576
592
|
# Tools
|
577
593
|
|
578
594
|
Joe Hildebrand has a
|
579
|
-
[grunt][] plugin for kramdown-
|
595
|
+
[grunt][] plugin for kramdown-rfc at:
|
580
596
|
https://github.com/hildjj/grunt-kramdown-rfc2629
|
581
597
|
.
|
582
598
|
Get started with it at:
|
583
599
|
https://github.com/hildjj/grunt-init-rfc
|
584
600
|
.
|
585
601
|
This provides a self-refreshing web page with the
|
586
|
-
kramdown-
|
602
|
+
kramdown-rfc/xml2rfc rendition of the draft you are editing.
|
587
603
|
|
588
604
|
[grunt]: http://gruntjs.com
|
589
605
|
|
590
606
|
Martin Thomson has an [I-D Template][] for github repositories that enable
|
591
607
|
collaboration on draft development.
|
592
|
-
This supports kramdown-
|
593
|
-
box. Just name your draft like `draft-ietf-unicorn-protocol
|
608
|
+
This supports kramdown-rfc out of the
|
609
|
+
box. Just name your draft like `draft-ietf-unicorn-protocol.md` and
|
594
610
|
follow the installation instructions.
|
595
611
|
|
596
612
|
[I-D Template]: https://github.com/martinthomson/i-d-template
|
@@ -602,12 +618,12 @@ no-brainer, so I'm not the only one who has written code for this.
|
|
602
618
|
|
603
619
|
[Miek Gieben][] has done a [similar thing][pandoc2rfc] employing
|
604
620
|
pandoc, now documented in [RFC 7328][]. He uses multiple input files instead of
|
605
|
-
kramdown-
|
621
|
+
kramdown-rfc's sectionized input format. He keeps the metadata in
|
606
622
|
a separate XML file, similar to the way the previous version of
|
607
|
-
kramdown-
|
623
|
+
kramdown-rfc stored (and still can store) the metadata in XML in
|
608
624
|
the markdown document. He also uses a slightly different referencing
|
609
625
|
syntax, which is closer to what markdown does elsewhere but more
|
610
|
-
verbose (this syntax is now also supported in kramdown-
|
626
|
+
verbose (this syntax is now also supported in kramdown-rfc).
|
611
627
|
(Miek now also has a new thing going on with mostly different syntax,
|
612
628
|
see [mmark][] and its [github repository][mmark-git].)
|
613
629
|
|
@@ -619,14 +635,16 @@ Other human-oriented markup input languages that are being used for authoring RF
|
|
619
635
|
# License
|
620
636
|
|
621
637
|
Since kramdown version 1.0, kramdown itself is MIT licensed, which
|
622
|
-
made it possible to license kramdown-
|
638
|
+
made it possible to license kramdown-rfc under the same license.
|
623
639
|
|
624
640
|
[kramdown]: https://kramdown.gettalong.org
|
625
641
|
[kdsyntax]: http://kramdown.gettalong.org/syntax.html
|
626
642
|
[kdsyntax-ial]: http://kramdown.gettalong.org/syntax.html#inline-attribute-lists
|
627
643
|
[stupid]: http://tools.ietf.org/id/draft-hartke-xmpp-stupid-00
|
628
|
-
[RFC 2629]:
|
629
|
-
[RFC 7749]:
|
644
|
+
[RFC 2629]: https://www.rfc-editor.org/rfc/rfc2629.html
|
645
|
+
[RFC 7749]: https://www.rfc-editor.org/rfc/rfc7749.html
|
646
|
+
[RFC 7991]: https://www.rfc-editor.org/rfc/rfc7991.html
|
647
|
+
[v3]: https://xml2rfc.tools.ietf.org/xml2rfc-doc.html
|
630
648
|
[markdown]: http://en.wikipedia.org/wiki/Markdown
|
631
649
|
[IETF]: http://www.ietf.org
|
632
650
|
[Miek Gieben]: http://www.miek.nl/
|
data/bin/kdrfc
CHANGED
@@ -51,9 +51,26 @@ BANNER
|
|
51
51
|
opts.on("-3", "--[no-]v3", "Use RFCXML v3 processing rules") do |v|
|
52
52
|
kdrfc.options.v3 = v
|
53
53
|
end
|
54
|
+
opts.on("-2", "--[no-]v2", "Use RFCXML v2 processing rules") do |v|
|
55
|
+
kdrfc.options.v2 = v
|
56
|
+
end
|
54
57
|
end
|
55
58
|
op.parse!
|
56
59
|
|
60
|
+
|
61
|
+
if kdrfc.options.v2 && kdrfc.options.v3
|
62
|
+
warn "*** can't have v2 and eat v3 cake"
|
63
|
+
kdrfc.options.v2 = false
|
64
|
+
end
|
65
|
+
|
66
|
+
if kdrfc.options.v3.nil? && !kdrfc.options.v2
|
67
|
+
if Time.now.to_i >= 1645567342 # Time.parse("2022-02-22T22:02:22Z").to_i
|
68
|
+
kdrfc.options.v3 = true # new default from the above date
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
warn "*** v2 #{kdrfc.options.v2.inspect} v3 #{kdrfc.options.v3.inspect}" if kdrfc.options.verbose
|
73
|
+
|
57
74
|
case ARGV.size
|
58
75
|
when 1
|
59
76
|
fn = ARGV[0]
|