kramdown-rfc2629 1.5.18 → 1.5.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1899e3dda0205ba1affda979ec1e972a27fc7d13ae721737e14cf4ab737b13ff
4
- data.tar.gz: 442106a989c71107a357d7c0bfec6ed9cf6b51c23cbfe870c81a26adc4542438
3
+ metadata.gz: 4a589f2a63da88b17cc5b56af63afe5a0faa9e7aae446f99b0a14aed7876e22d
4
+ data.tar.gz: 693ce583c48dbe4768727d684f3aa303436ad46bf824f291a9f0b3d63063d62c
5
5
  SHA512:
6
- metadata.gz: 1072b3d275c6ff6692bdc2cb3e666ac76f3c4838d6978b822c034b6ac4c70bf29a5d0be20aad42881bd9dcdf1ef5b69decb59114ecbfbb4457988ef0b0a2f3aa
7
- data.tar.gz: 81360978cd5ff6692263c0b0b3aff2780b0b806ed83edd2d96ac40e5f705120ed54a529b874a51b27d25be10b44f14fd4bb84a7d7fe067dd3b2b73e4e1234714
6
+ metadata.gz: 965e4be16c1a7b5f372a911d861d5bfca8fdca3ebc999b1e61feb1aaabb003b3504f882f28224185ec497777eba1c4e6aa1be98890cf9f05ae0493b9b5d146a5
7
+ data.tar.gz: 4b9a3ec95bc29455192af45e0dac1701b2e76f934816746edea7b57ffca1001f23ed11df91b710398a60356297e955807d9e5d912298eb320ebb62daab17302c
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,36 @@
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_NO = {"true" => "yes", "false" => "no"}
27
+ pis = KramdownRFC::ParameterSet.new({})
28
+ ps.arr("pi", false) do |pi, val|
29
+ pis[pi] = TRUE_FALSE[val] || val
30
+ end
31
+ if $options.v3
32
+ piattrs = pis.attrs("tocDepth=tocdepth", "tocInclude=toc",
33
+ "sortRefs=sortrefs", "symRefs=symrefs", "indexInclude=index")
34
+ if piattrs != ""
35
+ rfcattrs << " " << piattrs
36
+ end
37
+ end
38
+ pis.rest.each do |pi, val|
39
+ v = YES_NO[val] || escape_html(val.to_s, :attribute)
40
+ -%>
41
+ <?rfc <%=pi%>="<%=v%>"?>
17
42
  <% end -%>
18
43
 
19
- <rfc <%= ps.attrs("ipr", "docName=docname", "category=cat",
20
- "consensus", "submissionType=submissiontype", "xml:lang=lang",
21
- "number", "obsoletes", "updates", "seriesNo=seriesno") %>>
22
-
44
+ <rfc <%=rfcattrs%>>
23
45
  <front>
24
46
  <%= ps.ele("title", ps.attr("abbrev=titleabbrev")) %>
25
47
 
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.5.18'
3
+ s.version = '1.5.19'
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.}
@@ -13,6 +13,9 @@ module KramdownRFC
13
13
  def [](pn)
14
14
  @f.delete(pn.to_s)
15
15
  end
16
+ def []=(pn, val)
17
+ @f[pn] = val
18
+ end
16
19
  def has(pn)
17
20
  @f[pn.to_s]
18
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-rfc2629
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.18
4
+ version: 1.5.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann