kramdown-rfc2629 1.7.8 → 1.7.9

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: c99a7ec32844a2fced30e2bfe3e2298e8aeedd25ee6a2121dbe9a78192c5ec20
4
- data.tar.gz: 93120c8aea044967c819a98b25b653996bfc6e2336b5e5e7a8ec22a97912c55f
3
+ metadata.gz: 19205d36d58adcb319445d107550e706df01dec57b2b11ae8d83bcf98ba0f692
4
+ data.tar.gz: afb2233b556ee2e8906a39726f9e974784bd3cf48f294b1c492dcc257e545fc9
5
5
  SHA512:
6
- metadata.gz: c665a92ccd06bfd50109368d23f403afbb520fe1bad419907cef87be7a035de77616a423ddcee8fadea525cb182cb05797f06cb50a78677c72039dc12074d24d
7
- data.tar.gz: f6b7fbd510a50e88b48bae36be9447755ff970b04876e8ebfe0bdfbcdcb8a292abe24745f900f4c9445d8988e10af6585b8ca1dd6cdfc9701eeaafb3fc33fbb5
6
+ metadata.gz: ab0627eb9f1484f16fa7a3ef6653f2289c6b7e569ba13a2e4b9de00e961e981558ebd2ef06e6dda4f504c04fbab65f4427575ac5f1c5afbebcee27af17366ebd
7
+ data.tar.gz: ff634b58a990bad533c3e47a72fc428c1a61e8976aa87e2cdab977bc896ac7400aadbd17ef2c005c3bf0665f93c92a044e54ae6c25b6049949b4b314b7fb9adf
data/README.md CHANGED
@@ -180,7 +180,7 @@ and then just write `{{RFC2119}}` or `{{RFC1925}}`. (Yes, there is a
180
180
  colon in the YAML, because this is a hash that could provide other
181
181
  information.)
182
182
 
183
- Since version 1.1, references imported from the [XML2RFC][] databases
183
+ Since version 1.1, references imported from the [BibXML][] databases
184
184
  can be supplied with a replacement label (anchor name). E.g., RFC 793
185
185
  could be referenced as `{{!TCP=RFC0793}}`, further references then just
186
186
  can say `{{TCP}}`; both will get `[TCP]` as the label. In the
@@ -205,7 +205,7 @@ Notes about this feature:
205
205
  maintaining live references then may require some manual editing to
206
206
  get rid of the custom anchors.
207
207
 
208
- If your references are not in the [XML2RFC][] databases and do not
208
+ If your references are not in the [BibXML][] databases and do not
209
209
  have a DOI (that also happens to have correct data) either, you need
210
210
  to spell it out like in the examples below:
211
211
 
@@ -667,7 +667,7 @@ made it possible to license kramdown-rfc under the same license.
667
667
  [IETF]: http://www.ietf.org
668
668
  [Miek Gieben]: http://www.miek.nl/
669
669
  [pandoc2rfc]: https://github.com/miekg/pandoc2rfc/
670
- [XML2RFC]: http://xml.resource.org
670
+ [XML2RFC]: https://github.com/ietf-tools/xml2rfc
671
671
  [RFC 7328]: http://tools.ietf.org/html/rfc7328
672
672
  [mmark-git]: https://github.com/miekg/mmark
673
673
  [mmark]: https://mmark.nl
@@ -676,3 +676,4 @@ made it possible to license kramdown-rfc under the same license.
676
676
  [asciidoctor-rfc]: https://github.com/metanorma/asciidoctor-rfc
677
677
  [asciidoc]: http://www.methods.co.nz/asciidoc/
678
678
  [orgmode]: http://orgmode.org
679
+ [BibXML]: https://bib.ietf.org/
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.7.8'
3
+ s.version = '1.7.9'
4
4
  s.summary = "Kramdown extension for generating RFCXML (RFC 799x)."
5
5
  s.description = %{An RFCXML (RFC 799x) generating backend for Thomas Leitner's
6
6
  "kramdown" markdown parser. Mostly useful for RFC writers.}
@@ -33,6 +33,44 @@ end
33
33
 
34
34
  module Kramdown
35
35
 
36
+ Kramdown::Options.define(:nested_ol_types, Object, %w[1], <<~EOF) do |val|
37
+ Values for type= attribute for nested ordered lists (ol).
38
+ The value needs to be an array of <ol type= values, expressed as one of:
39
+ 1. A YAML array
40
+ 2. A string that will be split on commas (with optional blank space following)
41
+ 3. A string that will be split on blank space
42
+
43
+ Default: ["1"]
44
+ Used by: RFCXML converter
45
+ EOF
46
+ val = case val
47
+ when String
48
+ if val[0] == "[" && val[-1] == "]"
49
+ begin
50
+ val = YAML.safe_load(val)
51
+ rescue Psych::SyntaxError
52
+ warn "** YAML syntax error in nested_ol_types=#{val.inspect}"
53
+ val = %w[1]
54
+ end
55
+ else
56
+ val = val.split(/, */)
57
+ val = val[0].split(/ +/) if val.size == 1
58
+ end
59
+ Kramdown::Options.simple_array_validator(val, :nested_ol_types)
60
+ when Array
61
+ val.map!{ |x| x.to_s }
62
+ val = Kramdown::Options.simple_array_validator(val, :nested_ol_types)
63
+ else
64
+ raise Kramdown::Error, "Invalid value for option '#{:nested_ol_types}': '#{val.inspect}'"
65
+ end
66
+ if val == []
67
+ val = %w[1]
68
+ warn "** Option #{:nested_ol_types} cannot be empty, defaulting to #{val.inspect}"
69
+ end
70
+ val
71
+ end
72
+
73
+
36
74
  module Parser
37
75
 
38
76
  class RFC2629Kramdown < Kramdown
@@ -347,7 +385,10 @@ module Kramdown
347
385
  location + @location_delta + @location_correction
348
386
  end
349
387
 
350
- def convert(el, indent = -INDENTATION, opts = {})
388
+ def convert(el)
389
+ opts = el.options[:options]
390
+ # warn "** tree opts #{opts.inspect}"
391
+ indent = -INDENTATION
351
392
  if el.children[-1].type == :raw
352
393
  raw = convert1(el.children.pop, indent, opts)
353
394
  end
@@ -872,7 +913,22 @@ COLORS
872
913
  "#{' '*indent}<t><list#{attrstring}>\n#{inner(el, indent, opts)}#{' '*indent}</list></t>\n"
873
914
  end
874
915
  end
875
- alias :convert_ol :convert_ul
916
+
917
+ def convert_ol(el, indent, opts)
918
+ nested_types = opts[:nested_ol_types] || ["1"]
919
+ # warn "** ol opts #{opts.inspect} types #{nested_types.inspect}"
920
+ if nested_attr = el.attr.delete('nestedOlTypes')
921
+ nested_types = ::Kramdown::Options.parse(:nested_ol_types, nested_attr)
922
+ end
923
+ if nested_types = nested_types.dup
924
+ # warn "** nested_types #{nested_types.inspect}"
925
+ nested_here = nested_types.shift
926
+ opts = opts.merge(nested_ol_types: nested_types << nested_here)
927
+ el.attr['type'] ||= nested_here
928
+ # warn "** actual ol type #{el.attr['type'].inspect}"
929
+ end
930
+ convert_ul(el, indent, opts)
931
+ end
876
932
 
877
933
  def convert_dl(el, indent, opts)
878
934
  if $options.v3
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.7.8
4
+ version: 1.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-07 00:00:00.000000000 Z
11
+ date: 2024-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kramdown
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubygems_version: 3.4.10
209
+ rubygems_version: 3.5.4
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: Kramdown extension for generating RFCXML (RFC 799x).