mdless 2.1.41 → 2.1.42

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: f1a73a6f53b1069e90cb3c9760f7ec30fa49c7b0bc6583278d85059cadc6558b
4
- data.tar.gz: 934c7ce94e399d4f91bb3c2a6fb53053e3584ff9efba64d83e2e1c2b30430657
3
+ metadata.gz: b68decdfe8cb1115818810e9ead795533e1bc961059b43531b659a85e6144b24
4
+ data.tar.gz: b7a4cf80d2107af5a233c414e0ef90f67ff26a59563796c2956b2e541854f7f9
5
5
  SHA512:
6
- metadata.gz: 52641ae7aa9bb96488c43df3793eaafd32c21d36e77695ebe5c9aebb085a2b241ffae9a7d1faa1cef40184b3f49e6da0c795ae36176eafe4c24f0339504a1d42
7
- data.tar.gz: 44316ff110310cc9f026d6f21782b64f301e7a3cca99d9171fe34dc2ea2725e6731feafeee39d5cbac98ff782ba4e3548ee91810aaa33e5955a8e7fe46e2ee03
6
+ metadata.gz: 803a7b524eb3415d4490c24d6f1c6bbb5c7f56cc16eb87b85537ca20d5253ba4b92c3e19cce18e39cfc9c057e5bcdaa97c5797af76d3b285c7c7a7947decb32d
7
+ data.tar.gz: f37f47de66de5549509b14d62e7e8fe8056d2117b0bf48a570b979426f5cd8faf40497391b2bf72affbd62ae061f83d9f9bb97c7b05c9c14a49f5a221cb88dc4
@@ -582,7 +582,7 @@ module Redcarpet
582
582
  notes = line.to_enum(:scan, /\[\^(?<ref>\d+)\]/).map { Regexp.last_match }
583
583
  if notes.count.positive?
584
584
  footnotes = notes.map { |n| color_footnote_def(n['ref'].to_i) }.join("\n")
585
- "#{line}\n\n#{footnotes}\n\n"
585
+ "#{line}\n\n#{footnotes}\n\n\n"
586
586
  else
587
587
  line
588
588
  end
@@ -604,14 +604,12 @@ module Redcarpet
604
604
  end
605
605
  end
606
606
 
607
- def indent_lines(input, spaces)
607
+ def indent_lines(input)
608
608
  return nil if input.nil?
609
609
 
610
- indent = spaces.scan(/ /).count
611
-
612
610
  lines = input.split(/\n/)
613
611
  line1 = lines.shift
614
- pre = spaces + " "
612
+ pre = ' '
615
613
 
616
614
  body = lines.map { |l| "#{pre}#{l.rstrip}" }.join("\n")
617
615
  "#{line1}\n#{body}"
@@ -621,21 +619,21 @@ module Redcarpet
621
619
  out = case type
622
620
  when :unordered
623
621
  [
624
- indent,
622
+ ' ' * indent,
625
623
  color('list bullet'),
626
624
  MDLess.theme['list']['ul_char'].strip,
627
625
  ' ',
628
626
  color('list color'),
629
- indent_lines(content, indent).strip,
627
+ indent_lines(content).strip,
630
628
  xc
631
629
  ].join
632
630
  when :ordered
633
631
  [
634
- indent,
632
+ ' ' * indent,
635
633
  color('list number'),
636
634
  "#{counter}. ",
637
635
  color('list color'),
638
- indent_lines(content, indent).strip,
636
+ indent_lines(content).strip,
639
637
  xc
640
638
  ].join
641
639
  end
@@ -687,21 +685,24 @@ module Redcarpet
687
685
  def fix_items(content, last_indent = 0, levels = [0])
688
686
  content.gsub(%r{^(?<indent> *)<<listitem(?<id>\d+)-(?<type>(?:un)?ordered)>>(?<content>.*?)<</listitem\k<id>>>}m) do
689
687
  m = Regexp.last_match
690
- indent = 0
691
- if indent == last_indent
692
- levels[indent] ||= 0
693
- levels[indent] += 1
694
- elsif indent < last_indent
695
- levels[last_indent] = 0
696
- levels[indent] += 1
697
- last_indent = indent
698
- else
699
- levels[indent] = 1
700
- last_indent = indent
688
+
689
+ indent = m['indent'].length
690
+ if m['type'].to_sym == :ordered
691
+ if indent == last_indent
692
+ levels[indent] ||= 0
693
+ levels[indent] += 1
694
+ elsif indent < last_indent
695
+ levels[last_indent] = 0
696
+ levels[indent] += 1
697
+ last_indent = indent
698
+ else
699
+ levels[indent] = 1
700
+ last_indent = indent
701
+ end
701
702
  end
702
703
 
703
704
  content = m['content'] =~/<<listitem/ ? fix_items(m['content'], indent, levels) : m['content']
704
- color_list_item(" " * indent, uncolor_grafs(content), m['type'].to_sym, levels[indent])
705
+ color_list_item(indent, uncolor_grafs(content), m['type'].to_sym, levels[indent])
705
706
  end
706
707
  end
707
708
 
@@ -832,7 +833,7 @@ module Redcarpet
832
833
  end
833
834
 
834
835
  def fix_image_attributes(input)
835
- input.gsub(/^( {0,3}\[[^^].*?\]: *\S+) +([^"].*?)$/, '\1')
836
+ input.gsub(/^( {0,3}\[[^^*>].*?\]: *\S+) +([^"].*?)$/, '\1')
836
837
  end
837
838
 
838
839
  def preprocess(input)
@@ -584,13 +584,17 @@ module CLIMarkdown
584
584
  end
585
585
 
586
586
  def printout
587
- if MDLess.options[:taskpaper]
588
- out = @output
589
- else
590
- out = @output.rstrip.split(/\n/).map do |p|
591
- p.wrap(MDLess.cols, color('text'))
592
- end.join("\n")
593
- end
587
+ out = @output
588
+
589
+ # out = if MDLess.options[:taskpaper]
590
+ # @output
591
+ # else
592
+ # # TODO: Figure out a word wrap that accounts for indentation
593
+ # @output
594
+ # # out = @output.rstrip.split(/\n/).map do |p|
595
+ # # p.wrap(MDLess.cols, color('text'))
596
+ # # end.join("\n")
597
+ # end
594
598
 
595
599
  unless out.size&.positive?
596
600
  MDLess.log.warn 'No results'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CLIMarkdown
4
- VERSION = '2.1.41'
4
+ VERSION = '2.1.42'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdless
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.41
4
+ version: 2.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra