Class: Markdown::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/tool-markdown/markdown/link.rb

Class Method Summary collapse

Class Method Details

.check(dirname) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tool-markdown/markdown/link.rb', line 24

def self.check(dirname)
  puts "[ markdown ] Running check...".cyan
  filenames = Read.locate_md_filenames_from(dirname)
  msg = "  Check links: #{filenames.size.to_s} files <= #{dirname}"
  puts msg.cyan
  filenames.each_with_index do |filename, index|
    linklines = Read.get_lines_with_links_into filename

    unless linklines.size.zero?
      msg =  "  File: #{filename} (#{linklines.size} link/s)"
      puts msg.light_cyan
      Debug.check_links lines: linklines, dirpath: dirname
    end
  end
end

.show_info(dirname) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tool-markdown/markdown/link.rb', line 8

def self.show_info(dirname)
  puts "[ markdown ] Running info...".cyan
  filenames = Read.locate_md_filenames_from(dirname)
  msg = "  Show links: #{filenames.size.to_s} files <= #{dirname}"
  puts msg.cyan
  filenames.each_with_index do |filename, index|
    linklines = Read.get_lines_with_links_into filename

    unless linklines.size.zero?
      msg = "  File: #{filename} (#{linklines.size} link/s)"
      puts msg.light_cyan
      Debug.show_lines_with_links(linklines)
    end
  end
end