kramdown-rfc2629 1.6.1 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e14f146c7079e4611aa6ddf79f706ef0fddb168e1bb510c278ead6c93595b99a
4
- data.tar.gz: efa3c83941f0eaa68e82d9d2bbe554826f70bee1469498e870506f006806bcf8
3
+ metadata.gz: 3216df18368295dd7cd569731da214ec39f57132880c8d12d51f9dc02dce30fb
4
+ data.tar.gz: e2f0bfaf8d5b96bc2451d93c6c08a636b0b013420201821bff611918a87e7922
5
5
  SHA512:
6
- metadata.gz: 54b21302c63267ecf9eaf845d67927c8f7f7dc78b4608c545fb6487274a507980695512d21397fa54c7700c3659600229c6dc0cab4964e2c8e9a471da9b51e00
7
- data.tar.gz: '093aaa4efee63f5a103fba961072413884170bbcf13bb402b3ea40f36d1af1843d0b170be57d257dbf94f7b05bb6dc1e38df6a76abee06a5c475517fdd843d62'
6
+ metadata.gz: acfa4b9493d9cd4eb39ea67665a86a249915aa5f537ddbff53e6add625a0576223dc93bc9cb6ffb192f61c1805f892940c667153a9a316b5a7195820135e5365
7
+ data.tar.gz: 56de1bff6b8db68224ea994c8604dc75dd1ef99f01705ea04a704be0b1d635bdfa229296f9ad5a9c6a5263812da6dfa4b9d955035dd5f20a64d11b657afd7fca
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
- # kramdown-rfc2629
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-rfc2629** is an additional backend to that: It allows the
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, now documented in [RFC 7749][]).
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-rfc2629 gem (this automatically
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-rfc2629
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-rfc2629 are in one Ruby file,
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-rfc2629` started out as
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-rfc2629, you'll need Ruby (at least version 2.3, but
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-rfc2629 mydraft.mkd >mydraft.xml
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-rfc2629 and XML2RFC
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
@@ -52,29 +53,31 @@ is provided by `kdrfc`:
52
53
 
53
54
  Since RFC 8650, RFCs are using an updated grammar as defined in RFC
54
55
  7991 to 7998 and further updated informally since, colloquially called "[v3][]".
55
- As RFC 2629 is no longer the governing standard, kramdown-rfc2629 is
56
+ As RFC 2629 is no longer the governing standard, what was called kramdown-rfc2629 is
56
57
  now called kramdown-rfc. The latter command defaults to v3 processing
57
- rules; from 2022-02-22T22:02:22 on, kramdown-rfc2629 does as well (1.6.1).
58
+ rules; from 2022-02-22T22:02:22 on, the old kramdown-rfc2629 driver program does as well (1.6.1).
58
59
  (-3/--v3 and -2/--v2 select v3 and v2 explicitly; the latter should
59
60
  only be needed if there is a reason to to make a document look
60
61
  like it's 2016.)
61
62
 
62
- [v3]: https://xml2rfc.tools.ietf.org/xml2rfc-doc.html
63
+ See also [v3 announcement mail][].
64
+
65
+ [v3 announcement mail]: https://mailarchive.ietf.org/arch/msg/rfc-markdown/JC__LDDGuUbSFqyaEntF9r4kwKw
63
66
 
64
67
  # Examples
65
68
 
66
69
  For historical interest
67
70
  `stupid.mkd` was an early markdown version of an actual Internet-Draft
68
71
  (for a protocol called [STuPiD][] \[sic!]). This demonstrated some,
69
- but not all features of kramdown-rfc2629. Since markdown/kramdown
70
- does not cater for all the structure of an RFC 7749 style document,
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,
71
74
  some of the markup is in XML, and the example switches between XML and
72
75
  markdown using kramdown's `{::nomarkdown}` and `{:/nomarkdown}` (this
73
76
  is ugly, but works well enough). `stupid.xml` and `stupid.txt` show
74
- what kramdown-rfc2629 and xml2rfc make out of this.
77
+ what kramdown-rfc and xml2rfc make out of this.
75
78
 
76
79
  `stupid-s.mkd` is the same document in the new sectionized format
77
- supported by kramdown-rfc2629. The document metadata are in a short
80
+ supported by kramdown-rfc. The document metadata are in a short
78
81
  piece of YAML at the start, and from there, `abstract`, `middle`,
79
82
  references (`normative` and `informative`) and `back` are sections
80
83
  delimited in the markdown file. See the example for how this works.
@@ -82,7 +85,7 @@ The sections `normative` and `informative` can be populated right from
82
85
  the metadata, so there is never a need to write XML any more.
83
86
  Much less scary, and no `{:/nomarkdown}` etc. is needed any more.
84
87
  Similarly, `stupid-s.xml` and `stupid-s.txt` show what
85
- kramdown-rfc2629 and xml2rfc make out of this.
88
+ kramdown-rfc and xml2rfc make out of this.
86
89
 
87
90
  `draft-ietf-core-block-xx.mkd` is a real-world example of a current
88
91
  Internet-Draft done this way. For RFC and Internet-Draft references,
@@ -147,7 +150,7 @@ or
147
150
  email: pthubert@cisco.com
148
151
 
149
152
  (the hash keys are the XML GIs from RFC 7749, with a flattened
150
- structure. As RFC 7749 requires giving both the full name and
153
+ structure. As RFC 7749 requiresd giving both the full name and
151
154
  surname/initials, we use `ins` as an abbreviation for
152
155
  "initials/surname". Yes, the toolchain is Unicode-capable, even if
153
156
  the final RFC output is still in ASCII.)
@@ -161,7 +164,7 @@ might otherwise be interpreted as a number, losing the + sign).
161
164
 
162
165
  The references section is built from the references listed in the YAML
163
166
  header and from references made inline to RFCs and I-Ds in the
164
- markdown text. Since kramdown-rfc2629 cannot know whether a reference
167
+ markdown text. Since kramdown-rfc cannot know whether a reference
165
168
  is normative or informative, no entry is generated by default in the
166
169
  references section. By indicating a normative reference as in
167
170
  `{{!RFC2119}}` or an informative one as in `{{?RFC1925}}`, you can
@@ -333,7 +336,7 @@ not have the tools installed in its docker instance.
333
336
 
334
337
  More details have been collected on the [wiki][svg].
335
338
 
336
- [svg]: https://github.com/cabo/kramdown-rfc2629/wiki/SVG
339
+ [svg]: https://github.com/cabo/kramdown-rfc/wiki/SVG
337
340
 
338
341
  (1.2.9:)
339
342
  The YAML header now allows specifying [kramdown_options][].
@@ -549,7 +552,7 @@ note that this creates ugly blank space in some HTML converters).
549
552
 
550
553
  The code is not very polished, but now quite stable; it has been successfully used for a
551
554
  number of non-trivial Internet-Drafts and RFCs. You probably still need to
552
- skim [RFC 7749][] if you want to write an Internet-Draft, but you
555
+ skim [v3][] if you want to write an Internet-Draft, but you
553
556
  don't really need to understand XML very much. Knowing the basics of
554
557
  YAML helps with the metadata (but you'll understand it from the
555
558
  examples).
@@ -579,7 +582,7 @@ of the work. Please [contact the
579
582
  author](mailto:cabo@tzi.org?subject=Markdown%20for%20RFCXML) if you want
580
583
  to try it.
581
584
 
582
- Actually, if the XML was generated by kramdown-rfc2629, you can simply
585
+ Actually, if the XML was generated by kramdown-rfc, you can simply
583
586
  extract the input markdown from that XML file (but will of course lose
584
587
  any edits that have been made to the XML file after generation):
585
588
 
@@ -589,21 +592,21 @@ any edits that have been made to the XML file after generation):
589
592
  # Tools
590
593
 
591
594
  Joe Hildebrand has a
592
- [grunt][] plugin for kramdown-rfc2629 at:
595
+ [grunt][] plugin for kramdown-rfc at:
593
596
  https://github.com/hildjj/grunt-kramdown-rfc2629
594
597
  .
595
598
  Get started with it at:
596
599
  https://github.com/hildjj/grunt-init-rfc
597
600
  .
598
601
  This provides a self-refreshing web page with the
599
- kramdown-rfc2629/xml2rfc rendition of the draft you are editing.
602
+ kramdown-rfc/xml2rfc rendition of the draft you are editing.
600
603
 
601
604
  [grunt]: http://gruntjs.com
602
605
 
603
606
  Martin Thomson has an [I-D Template][] for github repositories that enable
604
607
  collaboration on draft development.
605
- This supports kramdown-rfc2629 out of the
606
- box. Just name your draft like `draft-ietf-unicorn-protocol-latest.md` and
608
+ This supports kramdown-rfc out of the
609
+ box. Just name your draft like `draft-ietf-unicorn-protocol.md` and
607
610
  follow the installation instructions.
608
611
 
609
612
  [I-D Template]: https://github.com/martinthomson/i-d-template
@@ -615,12 +618,12 @@ no-brainer, so I'm not the only one who has written code for this.
615
618
 
616
619
  [Miek Gieben][] has done a [similar thing][pandoc2rfc] employing
617
620
  pandoc, now documented in [RFC 7328][]. He uses multiple input files instead of
618
- kramdown-rfc2629's sectionized input format. He keeps the metadata in
621
+ kramdown-rfc's sectionized input format. He keeps the metadata in
619
622
  a separate XML file, similar to the way the previous version of
620
- kramdown-rfc2629 stored (and still can store) the metadata in XML in
623
+ kramdown-rfc stored (and still can store) the metadata in XML in
621
624
  the markdown document. He also uses a slightly different referencing
622
625
  syntax, which is closer to what markdown does elsewhere but more
623
- verbose (this syntax is now also supported in kramdown-rfc2629).
626
+ verbose (this syntax is now also supported in kramdown-rfc).
624
627
  (Miek now also has a new thing going on with mostly different syntax,
625
628
  see [mmark][] and its [github repository][mmark-git].)
626
629
 
@@ -632,14 +635,16 @@ Other human-oriented markup input languages that are being used for authoring RF
632
635
  # License
633
636
 
634
637
  Since kramdown version 1.0, kramdown itself is MIT licensed, which
635
- made it possible to license kramdown-rfc2629 under the same license.
638
+ made it possible to license kramdown-rfc under the same license.
636
639
 
637
640
  [kramdown]: https://kramdown.gettalong.org
638
641
  [kdsyntax]: http://kramdown.gettalong.org/syntax.html
639
642
  [kdsyntax-ial]: http://kramdown.gettalong.org/syntax.html#inline-attribute-lists
640
643
  [stupid]: http://tools.ietf.org/id/draft-hartke-xmpp-stupid-00
641
- [RFC 2629]: http://xml.resource.org/public/rfc/html/rfc2629.html
642
- [RFC 7749]: http://tools.ietf.org/html/rfc7749
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
643
648
  [markdown]: http://en.wikipedia.org/wiki/Markdown
644
649
  [IETF]: http://www.ietf.org
645
650
  [Miek Gieben]: http://www.miek.nl/
@@ -169,6 +169,10 @@
169
169
 
170
170
  <back>
171
171
 
172
+ <% displayref.each do |k, v| -%>
173
+ <displayreference target="<%=k%>" to="<%=v%>"/>
174
+ <% end -%>
175
+
172
176
  <% if sh = sechash.delete("normative") -%>
173
177
  <references title='Normative References'>
174
178
 
@@ -1,8 +1,8 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.6.1'
4
- s.summary = "Kramdown extension for generating RFC 7749 XML."
5
- s.description = %{An RFC7749 (XML2RFC) generating backend for Thomas Leitner's
3
+ s.version = '1.6.4'
4
+ s.summary = "Kramdown extension for generating RFCXML (RFC 799x)."
5
+ s.description = %{An RFCXML (RFC 799x) generating backend for Thomas Leitner's
6
6
  "kramdown" markdown parser. Mostly useful for RFC writers.}
7
7
  s.add_dependency('kramdown', '~> 2.3.0')
8
8
  s.add_dependency('kramdown-parser-gfm', '~> 1.1')
@@ -283,6 +283,8 @@ def xml_from_sections(input)
283
283
  ref_replacements = { }
284
284
  anchor_to_bibref = { }
285
285
 
286
+ displayref = {}
287
+
286
288
  [:ref, :normative, :informative].each do |sn|
287
289
  if refs = ps.has(sn)
288
290
  warn "*** bad section #{sn}: #{refs.inspect}" unless refs.respond_to? :each
@@ -300,6 +302,9 @@ def xml_from_sections(input)
300
302
  if bibref = v.delete("=")
301
303
  anchor_to_bibref[k] = bibref
302
304
  end
305
+ if dr = v.delete("display")
306
+ displayref[k] = dr
307
+ end
303
308
  end
304
309
  end
305
310
  end
@@ -93,6 +93,10 @@ module KramdownRFC
93
93
  def self.handle_ins(aups, ins_k, initials_k, surname_k)
94
94
  if ins = aups[ins_k]
95
95
  parts = ins.split('.').map(&:strip) # split on dots first
96
+ if parts == []
97
+ warn "*** an empty '#{ins_k}:' value is not useful, try leaving it out"
98
+ return
99
+ end
96
100
  # Coalesce H.-P.
97
101
  i = 1; while i < parts.size
98
102
  if parts[i][0] == "-"
@@ -115,6 +119,10 @@ module KramdownRFC
115
119
  def self.handle_name(aups, fn_k, initials_k, surname_k)
116
120
  if name = aups.rest[fn_k]
117
121
  names = name.split(/ *\| */, 2) # boundary for given/last name
122
+ if names == []
123
+ warn "*** an empty '#{fn_k}:' value is not useful, try leaving it out"
124
+ return
125
+ end
118
126
  if names[1]
119
127
  aups.rest[fn_k] = name = names.join(" ") # remove boundary
120
128
  if surname = aups.rest[surname_k]
@@ -125,6 +133,10 @@ module KramdownRFC
125
133
  aups.rest[surname_k] = names[1]
126
134
  end
127
135
  parts = name.split
136
+ if parts == []
137
+ warn "*** a blank '#{fn_k}:' value is not useful, try leaving it out"
138
+ return
139
+ end
128
140
  surname = aups.rest[surname_k] || parts[-1]
129
141
  s = surname.split
130
142
  aups.rest[initials_k] ||= initials_from_parts_and_surname(aups, parts, s)
@@ -808,7 +808,7 @@ COLORS
808
808
  out ="#{' '*indent}<dd><t/></dd>\n" # you can't make this one up
809
809
  end
810
810
  opts[:haddt] = true
811
- out << "#{' '*indent}<dt#{el_html_attributes(el)}>\n#{inner(el, indent, opts)}#{' '*indent}</dt>\n"
811
+ out << "#{' '*indent}<dt#{el_html_attributes(el)}>#{inner(el, indent, opts)}</dt>\n"
812
812
  else
813
813
  close = "#{' '*indent}</t>\n" * @in_dt
814
814
  @in_dt = 1
@@ -914,6 +914,17 @@ COLORS
914
914
  gi = el.attr.delete('gi')
915
915
  res = inner(el, indent, opts)
916
916
  target = el.attr['target']
917
+ if target[0..1] == "{{"
918
+ # XXX ignoring all attributes and content
919
+ s = ::Kramdown::Converter::Rfc2629::process_markdown(target)
920
+ # if res != '' && s[-2..-1] == '/>'
921
+ # if s =~ /\A<([-A-Za-z0-9_.]+) /
922
+ # gi ||= $1
923
+ # end
924
+ # s[-2..-1] = ">#{res}</#{gi}>"
925
+ # end
926
+ return s
927
+ end
917
928
  if target[0] == "#" # handle [](#foo) as xref as in RFC 7328
918
929
  el.attr['target'] = target = target[1..-1]
919
930
  if target.downcase == res.downcase
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.1
4
+ version: 1.6.4
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-02-21 00:00:00.000000000 Z
11
+ date: 2022-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
69
  description: |-
70
- An RFC7749 (XML2RFC) generating backend for Thomas Leitner's
70
+ An RFCXML (RFC 799x) generating backend for Thomas Leitner's
71
71
  "kramdown" markdown parser. Mostly useful for RFC writers.
72
72
  email: cabo@tzi.org
73
73
  executables:
@@ -123,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubygems_version: 3.3.3
126
+ rubygems_version: 3.3.7
127
127
  signing_key:
128
128
  specification_version: 4
129
- summary: Kramdown extension for generating RFC 7749 XML.
129
+ summary: Kramdown extension for generating RFCXML (RFC 799x).
130
130
  test_files: []