mdless 2.1.41 → 2.1.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mdless/console.rb +24 -23
- data/lib/mdless/converter.rb +11 -7
- data/lib/mdless/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc43970cd07331cf14e92986ab2a746e346d659c73daa78f78bd9ecb703d87e
|
4
|
+
data.tar.gz: 164d0c3bc168dd654c928c0727ddd96e6972098c6a59ba6659a16b14f2fdfd99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318437aec49a4259d1108bec7fd30dca9429db9ae048c33839da92b0eaaa3eaf733683b1a317bc4e89f3fc7c14b268376130090d0fbe8a9226f9da87c79e67f0
|
7
|
+
data.tar.gz: 90f1705e25d710e1e669d68fad39bb573cdedd16c9a10103aa240ffdb84d2af9e0095f1c7131c3fb43b983f0f4ac53a836bef75a4280c473347a2ebbe222efa3
|
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)
|
@@ -1000,7 +1001,7 @@ module Redcarpet
|
|
1000
1001
|
tmp_img = File.basename(img_path)
|
1001
1002
|
img = `chafa #{term} "#{tmp_img}"`
|
1002
1003
|
pre = alt_text ? " #{c(%i[d blue])}[#{alt_text.strip}]\n" : ''
|
1003
|
-
post = title ? "\n #{c(%i[b blue])}-- #{
|
1004
|
+
post = title ? "\n #{c(%i[b blue])}-- #{title} --" : ''
|
1004
1005
|
result = pre + img + post
|
1005
1006
|
Dir.chdir('..')
|
1006
1007
|
FileUtils.rm_r '.mdless_tmp', force: true
|
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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|