Module: MDLess
Constant Summary
CLIMarkdown::Theme::THEME_DEFAULTS
Class Attribute Summary collapse
Class Method Summary
collapse
load_theme, load_theme_file
Class Attribute Details
.cols ⇒ Object
Returns the value of attribute cols.
33
34
35
|
# File 'lib/mdless.rb', line 33
def cols
@cols
end
|
.file ⇒ Object
Returns the value of attribute file.
33
34
35
|
# File 'lib/mdless.rb', line 33
def file
@file
end
|
Returns the value of attribute meta.
33
34
35
|
# File 'lib/mdless.rb', line 33
def meta
@meta
end
|
.options ⇒ Object
Returns the value of attribute options.
33
34
35
|
# File 'lib/mdless.rb', line 33
def options
@options
end
|
Class Method Details
.log ⇒ Object
35
36
37
|
# File 'lib/mdless.rb', line 35
def log
@log ||= Logger.new($stderr)
end
|
.log_level(level) ⇒ Object
39
40
41
|
# File 'lib/mdless.rb', line 39
def log_level(level)
@log.level = level
end
|
.pygments_lexers ⇒ Object
51
52
53
|
# File 'lib/mdless.rb', line 51
def pygments_lexers
@pygments_lexers ||= read_pygments_lexers
end
|
.pygments_styles ⇒ Object
47
48
49
|
# File 'lib/mdless.rb', line 47
def pygments_styles
@pygments_styles ||= read_pygments_styles
end
|
.read_pygments_lexers ⇒ Object
62
63
64
65
66
67
68
69
70
|
# File 'lib/mdless.rb', line 62
def read_pygments_lexers
MDLess.log.info 'Reading Pygments lexers'
pyg = TTY::Which.which('pygmentize')
res = `#{pyg} -L lexers`
lexers = res.scan(/\* ([\w-]+(?:, [\w-]+)*):/).map { |l| l[0] }
lexers_a = []
lexers.each { |l| lexers_a.concat(l.split(/, /)) }
lexers_a
end
|
.read_pygments_styles ⇒ Object
55
56
57
58
59
60
|
# File 'lib/mdless.rb', line 55
def read_pygments_styles
MDLess.log.info 'Reading Pygments styles'
pyg = TTY::Which.which('pygmentize')
res = `#{pyg} -L styles`
res.scan(/\* ([\w-]+):/).map { |l| l[0] }
end
|
.theme ⇒ Object
43
44
45
|
# File 'lib/mdless.rb', line 43
def theme
@theme ||= load_theme(@options[:theme])
end
|