kramdown-rfc2629 1.7.38 → 1.7.39

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: 2a4229601b804e1214f5b5680529e4eadc85b411dff42300930a7ee67f089677
4
- data.tar.gz: e014af8a2a3fbd97e476fc9f75324aa60b018c86852c863a48ef154bd00edb32
3
+ metadata.gz: 38aca91cefd454730d8c954f9d5d07035bca1a239fb1f580ab9d0d5fd41a60f3
4
+ data.tar.gz: 2eda7764ffdaef67e83376c0d748fa3b5a5d95db9655662454a63d5bda9ae4c0
5
5
  SHA512:
6
- metadata.gz: d75555c1707c87224b3d3e1b79f4df733085b3c325cc8f02e3c6c94716bc663b98dfb623940a34e5ffd2f813aaaeccff2bbf505691d41caceaba09fc04216a3f
7
- data.tar.gz: 0201b85f296e9acc385e6146e5153f812d87e50ae4054a1d0171809b9d8c251d8bb145ef842d730d9b479553292ec82e61c36a8a37fc2506cd5c5ccadfd79053
6
+ metadata.gz: daca417b970b16cfdb61685947a38ec857dbf332259815a609ea54bac9959969dfa9ad0e5b392ac2a60616f0ca7ff51f9cb78f1238f04080cbb307dd7f0de9ca
7
+ data.tar.gz: fc157fa46ff9ea8ef0fc69689c14f35cfd09782fc0440a9815a706c7ddccc21e5035510b4b80a696c987bd392739fe1ab46661f3707aad2a9870ba7bbd8f3b1e
data/README.md CHANGED
@@ -549,6 +549,16 @@ machine-generated:
549
549
  {: #example2 title="A longer RPL example"}
550
550
  ```
551
551
 
552
+ Include flags can be combined and appended to the command name:
553
+
554
+ ```markdown
555
+ {::include-dedent-lines3..8 generated.txt}
556
+ {::include-fold69hardleft4dry generated.json}
557
+ ```
558
+
559
+ Details about include flags can be found in the kramdown-rfc wiki: https://github.com/cabo/kramdown-rfc/wiki/Syntax#file-inclusion
560
+
561
+
552
562
  (0.x:) A page break can be forced by adding a horizontal rule (`----`,
553
563
  note that this creates ugly blank space in some HTML converters).
554
564
 
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kramdown-rfc2629'
3
- s.version = '1.7.38'
3
+ s.version = '1.7.39'
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.}
@@ -65,13 +65,21 @@ def process_includes(input)
65
65
  $2)
66
66
  when "data"
67
67
  data = true
68
- when /\Afold(\d*)(left(\d*))?(dry)?\z/
69
- fold = [$1.to_i, # col 0 for ''
70
- ($3.to_i if $2), # left 0 for '', nil if no "left"
71
- $4] # dry
68
+ when /\Afold(?<columns>\d*)(?<hard>hard)?(?<left>left(?<spaces>\d*))?(?<dry>dry)?\z/
69
+ md = Regexp.last_match
70
+ columns = md[:columns].to_i
71
+ left = md[:spaces].to_i if md[:left]
72
+ fold = [columns, left, md[:dry], md[:hard]]
72
73
  when "all", "last"
74
+ fn_in = fn
73
75
  fn = fn.flat_map{|n| Dir[n]}
74
- fn = [fn.last] if flag == "last"
76
+ if flag == "last"
77
+ if last = fn.last
78
+ fn = [last]
79
+ else
80
+ warn "** include-last: no file matches #{fn_in.inspect}"
81
+ end
82
+ end
75
83
  chunks = fn.map{ |f|
76
84
  ret = process_chunk(File.read(f), nested, dedent, range, fold, quote, xml, data)
77
85
  nested = false; dedent = false; fold = false; quote = false
@@ -44,7 +44,7 @@ MIN_FOLD_COLUMNS = FOLD_MSG.size
44
44
  FOLD_COLUMNS = 69
45
45
  RE_IDENT = /\A[A-Za-z0-9_]\z/
46
46
 
47
- def fold8792_1(s, columns = FOLD_COLUMNS, left = false, dry = false)
47
+ def fold8792_1(s, columns = FOLD_COLUMNS, left = false, dry = false, hard = false)
48
48
  if s.index("\t")
49
49
  warn "*** HT (\"TAB\") in text to be folded. Giving up."
50
50
  return s
@@ -80,7 +80,7 @@ def fold8792_1(s, columns = FOLD_COLUMNS, left = false, dry = false)
80
80
  if col <= min_indent
81
81
  warn "*** Cannot RFC8792-fold1 to #{columns} cols #{"with indent #{left}" if left} |#{li.inspect}|"
82
82
  else
83
- if RE_IDENT === li[col] # Don't split IDs
83
+ if !hard && RE_IDENT === li[col] # Don't split IDs
84
84
  col2 = col
85
85
  while col2 > min_indent && RE_IDENT === li[col2-1]
86
86
  col2 -= 1
@@ -795,10 +795,11 @@ COLORS
795
795
  case proc
796
796
  when "dedent"
797
797
  result = remove_indentation(result)
798
- when /\Afold(\d*)(left(\d*))?(dry)?\z/
799
- fold = [$1.to_i, # col 0 for ''
800
- ($3.to_i if $2), # left 0 for '', nil if no "left"
801
- $4] # dry
798
+ when /\Afold(?<columns>\d*)(?<hard>hard)?(?<left>left(?<spaces>\d*))?(?<dry>dry)?\z/
799
+ md = Regexp.last_match
800
+ columns = md[:columns].to_i
801
+ left = md[:spaces].to_i if md[:left]
802
+ fold = [columns, left, md[:dry], md[:hard]]
802
803
  result = fix_unterminated_line(fold8792_1(trim_empty_lines_around(result), *fold)) # XXX
803
804
  when /\Alines(\d*)\.\.(\.)?(\d*)\z/
804
805
  range = Range.new($1.empty? ? nil : $1.to_i, # compensate for
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.7.38
4
+ version: 1.7.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann