Top Level Namespace
Defined Under Namespace
Classes: ColorizeFilter, ExtendedHtml, ExtendedMarkup, HtmlConverter, Presentation, PresentationMaker, PsHtmlConverter, Slide, SlidesHtml, SlidesMarkup, TC
Instance Method Summary
collapse
Instance Method Details
#gen_cache_name(content, lang) ⇒ Object
56
57
58
59
|
# File 'lib/wee-pm/colorize.rb', line 56
def gen_cache_name(content, lang)
md5 = MD5.new(content)
$OPT["cache-prefix"] + ".#{ md5 }.#{ lang }"
end
|
#remove_leading_and_trailing_empty_lines(str) ⇒ Object
#remove_leading_empty_lines(str) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/wee-pm/utils.rb', line 13
def remove_leading_empty_lines(str)
first_non_empty_line_seen = false
res = ""
str.each_line {|l|
if first_non_empty_line_seen
res << l
else
unless l.strip.empty?
first_non_empty_line_seen = true
res << l
end
end
}
res
end
|
#remove_trailing_empty_lines(str) ⇒ Object
7
8
9
10
11
|
# File 'lib/wee-pm/utils.rb', line 7
def remove_trailing_empty_lines(str)
str = str.chomp + "\n"
str = remove_leading_empty_lines(str.to_enum(:each_line).to_a.reverse.join(""))
str.to_enum(:each_line).to_a.reverse.join("")
end
|
#strip_ws(str) ⇒ Object
remove leading and trailing empty lines
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/wee-pm/colorize.rb', line 35
def strip_ws(str)
first_non_empty = 0
str.each_with_index do |line, i|
if line.strip != ""
first_non_empty = i
break
end
end
last_non_empty = 0
str.each_with_index do |line, i|
if line.strip != ""
last_non_empty = i
end
end
return str.to_a[first_non_empty..last_non_empty].join("")
end
|
#usage ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/wee-pm/colorize.rb', line 21
def usage
STDERR.puts "USAGE: #{ $0 }
[--mode=gui|text] (default: text)
[--lang=vim_lang] (default: __auto__)
[--strip-ws]
[--cache [--cache-prefix=prefix]] (default: cache-prefix=/tmp/_colorize)
[--headers]
[--terminal=...] (default: __none__; which terminal to use for vim)
[input-file [output-file]] (default: stdin stdout)
[--help]"
exit 1
end
|