kramdown-rfc2629 1.7.8 → 1.7.10

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: b0a5264ae5d33d3262c29ecb664f1e40d0ad952fe43eea5858d291aab075159b
4
+ data.tar.gz: b3658555f711dce89c2c2919520b7e1734d620cdebba552b2eec33a24de78bf2
5
5
  SHA512:
6
- metadata.gz: c665a92ccd06bfd50109368d23f403afbb520fe1bad419907cef87be7a035de77616a423ddcee8fadea525cb182cb05797f06cb50a78677c72039dc12074d24d
7
- data.tar.gz: f6b7fbd510a50e88b48bae36be9447755ff970b04876e8ebfe0bdfbcdcb8a292abe24745f900f4c9445d8988e10af6585b8ca1dd6cdfc9701eeaafb3fc33fbb5
6
+ metadata.gz: 9624afa4465c9e3307568787cbd49f18efa8f8924d12398b3c40c413607af0dd23b592e3456fe21d18ce7ac4a37cf8925aefc86f32ef8d5c183ded1197c52404
7
+ data.tar.gz: 4627bc17140218836e34cb22237a7cea860c9f6b74452292dcab4e83ced32444386236c247848984afd62a7d5db84500b46890c2a369e12cfda5510c838b6bc0
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.10'
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,14 @@ 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
+ if nested_ol_types = @options[:nested_ol_types]
392
+ opts[:nested_ol_types] ||= nested_ol_types
393
+ # warn "** tree opts out #{opts.inspect}"
394
+ end
395
+ indent = -INDENTATION
351
396
  if el.children[-1].type == :raw
352
397
  raw = convert1(el.children.pop, indent, opts)
353
398
  end
@@ -872,7 +917,22 @@ COLORS
872
917
  "#{' '*indent}<t><list#{attrstring}>\n#{inner(el, indent, opts)}#{' '*indent}</list></t>\n"
873
918
  end
874
919
  end
875
- alias :convert_ol :convert_ul
920
+
921
+ def convert_ol(el, indent, opts)
922
+ nested_types = opts[:nested_ol_types] || ["1"]
923
+ # warn "** ol opts #{opts.inspect} types #{nested_types.inspect}"
924
+ if nested_attr = el.attr.delete('nestedOlTypes')
925
+ nested_types = ::Kramdown::Options.parse(:nested_ol_types, nested_attr)
926
+ end
927
+ if nested_types = nested_types.dup
928
+ # warn "** nested_types #{nested_types.inspect}"
929
+ nested_here = nested_types.shift
930
+ opts = opts.merge(nested_ol_types: nested_types << nested_here)
931
+ el.attr['type'] ||= nested_here
932
+ # warn "** actual ol type #{el.attr['type'].inspect}"
933
+ end
934
+ convert_ul(el, indent, opts)
935
+ end
876
936
 
877
937
  def convert_dl(el, indent, opts)
878
938
  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.10
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-21 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).