kramdown-rfc2629 1.5.17 → 1.5.21

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: 437ec106fe0458259c9f776fb89ed2993ffea7a466a66f087cb2dd4a460616b3
4
- data.tar.gz: 255a5c80a71f8e5447c59a557b58c8ccbb6bc4ad503f838650a6e5c49083b0fb
3
+ metadata.gz: a2f9b627799934e130561b80d0625ee127bb67e340742ab9df6f309f069d2487
4
+ data.tar.gz: fd3bb7cbbe1a54316d809844f12070836e18c5eb38286a00fc322c915bebd363
5
5
  SHA512:
6
- metadata.gz: d2a9724e14f28a37f6426b1173b25941a7fe1ed113be1a7c45da2e1bc855ae367723a5bf92c515ad6dd7da95d6616c91c8d16de51f366c0ec4c20417073c0ac8
7
- data.tar.gz: '088030252b477385ecfa4447a4b76a472f8fbe33b0104c680feb8ea6493b4fe72334c087ec2321bfc567901595a3113750757fb35a7d69e794ef25c30071c435'
6
+ metadata.gz: 1d588638f3ae60b71555a23236546f0639f612774e38d8325515d9304154038cbedba463fa2c3fe3dedf028ab1b44ee9386325215114ef9a8a5c11029d57d9a6
7
+ data.tar.gz: 6307e13b08a45165813ceec0ea1cc5e5cc9e788fcdc0024fee168979e87803eac96dca878288b7eee628f5a167a35c1079dcc1c411b2ad88fda0fcf11757eaf7
data/README.md CHANGED
@@ -28,7 +28,8 @@ structure provided by kramdown. `bin/kramdown-rfc2629` started out as
28
28
  a simple command-line program showing how to use this, but can now do
29
29
  much more (see below).
30
30
 
31
- To use kramdown-rfc2629, you'll need a Ruby 2.x, and maybe
31
+ To use kramdown-rfc2629, you'll need Ruby (at least version 2.3, but
32
+ preferably a current version), and maybe
32
33
  [XML2RFC][] if you want to see the fruits of your work.
33
34
 
34
35
  kramdown-rfc2629 mydraft.mkd >mydraft.xml
@@ -12,14 +12,37 @@
12
12
  <% end -%>
13
13
  ]>
14
14
 
15
- <% ps.arr("pi", false) do |pi, val| -%>
16
- <?rfc <%=pi%>="<%= {true => "yes", false => "no", nil => "yes"}[val] || val %>"?>
15
+ <%
16
+ ps.rest.fetch("consensus") do
17
+ # consensus not given -- default intelligently
18
+ cat = ps.has("category") || ps.has("cat")
19
+ MUST_CONSENSUS = {"std" => true, "bcp" => true}
20
+ ps["consensus"] = true if MUST_CONSENSUS[cat]
21
+ end
22
+ rfcattrs = ps.attrs("ipr", "docName=docname", "category=cat",
23
+ "consensus", "submissionType=submissiontype", "xml:lang=lang",
24
+ "number", "obsoletes", "updates", "seriesNo=seriesno")
25
+ TRUE_FALSE = {nil => "true", false => "false", true => "true",
26
+ "yes" => "true", "no" => "false"}
27
+ YES_NO = {"true" => "yes", "false" => "no"}
28
+ pis = KramdownRFC::ParameterSet.new({})
29
+ ps.arr("pi", false) do |pi, val|
30
+ pis[pi] = TRUE_FALSE[val] || val
31
+ end
32
+ if $options.v3
33
+ piattrs = pis.attrs("tocDepth=tocdepth", "tocInclude=toc",
34
+ "sortRefs=sortrefs", "symRefs=symrefs", "indexInclude=index")
35
+ if piattrs != ""
36
+ rfcattrs << " " << piattrs
37
+ end
38
+ end
39
+ pis.rest.each do |pi, val|
40
+ v = YES_NO[val] || pis.escattr(val)
41
+ -%>
42
+ <?rfc <%=pi%>="<%=v%>"?>
17
43
  <% end -%>
18
44
 
19
- <rfc <%= ps.attrs("ipr", "docName=docname", "category=cat",
20
- "consensus", "submissionType=submissiontype", "xml:lang=lang",
21
- "number", "obsoletes", "updates", "seriesNo=seriesno") %>>
22
-
45
+ <rfc <%=rfcattrs%>>
23
46
  <front>
24
47
  <%= ps.ele("title", ps.attr("abbrev=titleabbrev")) %>
25
48
 
@@ -46,15 +69,24 @@
46
69
  <% venue = ps[:venue] -%>
47
70
  <% if venue -%>
48
71
  <% venue = KramdownRFC::ParameterSet.new(venue) -%>
49
- <note title="Discussion Venues" removeInRFC="true">
72
+ <note title="About This Document" removeInRFC="true">
73
+ <% if (dn = ps.av[:docName]) &&
74
+ (dt = dn.rpartition('-')[0]) != ""
75
+ -%>
76
+ <t>
77
+ <% if latest = venue[:latest] -%>
78
+ The latest revision of this draft can be found at <eref target="<%=latest%>"/>.
79
+ <% end -%>
80
+ Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/<%=dt%>/"/>.
81
+ </t>
82
+ <% end -%>
50
83
  <% mail = venue[:mail] -%>
51
84
  <% homepage = venue[:home] -%>
52
85
  <% gtype = venue[:type] -%>
53
86
  <% if mail || homepage -%>
54
87
  <t>
55
88
  <% end -%>
56
- <% if mail -%>
57
- <% mail_local, mail_host = mail.split("@", 2) -%>
89
+ <% if mail && (mail_local, mail_host = mail.split("@", 2)) && mail_host -%>
58
90
  <% mail_subdomain, mail_domain = mail_host.split(".", 2) -%>
59
91
  <% group = venue[:group] || mail_local # XXX -%>
60
92
  <% arch = venue[:arch] || "https://mailarchive.ietf.org/arch/browse/#{mail_local}/" -%>
@@ -74,6 +106,7 @@
74
106
  <t>Source for this draft and an issue tracker can be found at
75
107
  <eref target="<%=repo%>"/>.</t>
76
108
  <% end -%>
109
+ <%= venue.ele("t=text", nil, nil, true) -%>
77
110
  </note>
78
111
  <% venue.warn_if_leftovers -%>
79
112
  <% end -%>
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.5.17'
3
+ s.version = '1.5.21'
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.}
@@ -7,10 +7,15 @@ module KramdownRFC
7
7
  def initialize(y)
8
8
  raise "*** invalid parameter set #{y.inspect}" unless Hash === y
9
9
  @f = y
10
+ @av = {}
10
11
  end
12
+ attr :av
11
13
  def [](pn)
12
14
  @f.delete(pn.to_s)
13
15
  end
16
+ def []=(pn, val)
17
+ @f[pn] = val
18
+ end
14
19
  def has(pn)
15
20
  @f[pn.to_s]
16
21
  end
@@ -24,10 +29,11 @@ module KramdownRFC
24
29
  end
25
30
  def attr(pn)
26
31
  val, an = van(pn)
32
+ @av[an.intern] = val
27
33
  %{#{an}="#{escattr(val)}"} if val
28
34
  end
29
35
  def attrs(*pns)
30
- pns.map{ |pn| attr(pn) }.compact.join(" ")
36
+ pns.map{ |pn| attr(pn) if pn }.compact.join(" ")
31
37
  end
32
38
  def ele(pn, attr=nil, defcontent=nil, markdown=false)
33
39
  val, an = van(pn)
@@ -59,5 +65,4 @@ module KramdownRFC
59
65
  end
60
66
  end
61
67
 
62
-
63
68
  end
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.5.17
4
+ version: 1.5.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-18 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown