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 +4 -4
- data/lib/mdless/console.rb +23 -22
- data/lib/mdless/converter.rb +11 -7
- data/lib/mdless/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b68decdfe8cb1115818810e9ead795533e1bc961059b43531b659a85e6144b24
         | 
| 4 | 
            +
              data.tar.gz: b7a4cf80d2107af5a233c414e0ef90f67ff26a59563796c2956b2e541854f7f9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 803a7b524eb3415d4490c24d6f1c6bbb5c7f56cc16eb87b85537ca20d5253ba4b92c3e19cce18e39cfc9c057e5bcdaa97c5797af76d3b285c7c7a7947decb32d
         | 
| 7 | 
            +
              data.tar.gz: f37f47de66de5549509b14d62e7e8fe8056d2117b0bf48a570b979426f5cd8faf40497391b2bf72affbd62ae061f83d9f9bb97c7b05c9c14a49f5a221cb88dc4
         | 
    
        data/lib/mdless/console.rb
    CHANGED
    
    | @@ -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 | 
| 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 =  | 
| 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 | 
| 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 | 
| 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 | 
            -
             | 
| 691 | 
            -
                       | 
| 692 | 
            -
             | 
| 693 | 
            -
                         | 
| 694 | 
            -
             | 
| 695 | 
            -
             | 
| 696 | 
            -
                         | 
| 697 | 
            -
             | 
| 698 | 
            -
             | 
| 699 | 
            -
             | 
| 700 | 
            -
                         | 
| 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( | 
| 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}\[[ | 
| 836 | 
            +
                    input.gsub(/^( {0,3}\[[^^*>].*?\]: *\S+) +([^"].*?)$/, '\1')
         | 
| 836 837 | 
             
                  end
         | 
| 837 838 |  | 
| 838 839 | 
             
                  def preprocess(input)
         | 
    
        data/lib/mdless/converter.rb
    CHANGED
    
    | @@ -584,13 +584,17 @@ module CLIMarkdown | |
| 584 584 | 
             
                end
         | 
| 585 585 |  | 
| 586 586 | 
             
                def printout
         | 
| 587 | 
            -
                   | 
| 588 | 
            -
             | 
| 589 | 
            -
                   | 
| 590 | 
            -
             | 
| 591 | 
            -
             | 
| 592 | 
            -
             | 
| 593 | 
            -
                   | 
| 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'
         | 
    
        data/lib/mdless/version.rb
    CHANGED