Class: ReVIEW::MARKDOWNBuilder
Constant Summary
Constants inherited
from Builder
Builder::CAPTION_TITLES
Instance Method Summary
collapse
Methods included from TextUtils
#convert_inencoding, #convert_outencoding, #detab, #split_paragraph
Methods inherited from Builder
#bibpaper, #bind, #captionblock, #compile_inline, #detab, #entries, #error, #extract_chapter_id, #find_pathes, #get_chap, #graph, #handle_metric, #image, #include, #initialize, #inline_bou, #inline_chap, #inline_chapref, #inline_fn, #inline_hd, #inline_href, #inline_include, #inline_kw, #inline_list, #inline_raw, #inline_ruby, #inline_table, #inline_title, #list, #listnum, #parse_metric, #post_paragraph, #pre_paragraph, #print, #raw, #result, #result_metric, #source, #table, #text, #ul_item_begin, #ul_item_end, #warn
Instance Method Details
23
24
25
26
|
# File 'lib/review/markdownbuilder.rb', line 23
def blank
@output.puts unless @blank_seen
@blank_seen = true
end
|
#compile_href(url, label) ⇒ Object
82
83
84
85
|
# File 'lib/review/markdownbuilder.rb', line 82
def compile_href(url, label)
label = url if label.blank?
"[#{label}](#{url})"
end
|
#emlist(lines, caption = nil) ⇒ Object
68
69
70
71
72
73
74
75
76
|
# File 'lib/review/markdownbuilder.rb', line 68
def emlist(lines, caption = nil)
blank
puts "```"
lines.each do |line|
puts detab(line)
end
puts "```"
blank
end
|
14
15
16
|
# File 'lib/review/markdownbuilder.rb', line 14
def extname
'.md'
end
|
#headline(level, label, caption) ⇒ Object
28
29
30
31
|
# File 'lib/review/markdownbuilder.rb', line 28
def headline(level, label, caption)
prefix = "#" * level
puts "#{prefix} #{caption}"
end
|
78
79
80
|
# File 'lib/review/markdownbuilder.rb', line 78
def hr
puts "----"
end
|
#image_dummy(id, caption, lines) ⇒ Object
105
106
107
|
# File 'lib/review/markdownbuilder.rb', line 105
def image_dummy(id, caption, lines)
puts lines.join
end
|
#image_ext ⇒ Object
120
121
122
|
# File 'lib/review/markdownbuilder.rb', line 120
def image_ext
"jpg"
end
|
#image_image(id, caption, metric) ⇒ Object
99
100
101
102
103
|
# File 'lib/review/markdownbuilder.rb', line 99
def image_image(id, caption, metric)
blank
puts ""
blank
end
|
#inline_b(str) ⇒ Object
91
92
93
|
# File 'lib/review/markdownbuilder.rb', line 91
def inline_b(str)
"**#{str.gsub(/\*/, '\*')}**"
end
|
#inline_code(str) ⇒ Object
95
96
97
|
# File 'lib/review/markdownbuilder.rb', line 95
def inline_code(str)
"`#{str}`"
end
|
#inline_i(str) ⇒ Object
87
88
89
|
# File 'lib/review/markdownbuilder.rb', line 87
def inline_i(str)
"*#{str.gsub(/\*/, '\*')}*"
end
|
#inline_img(id) ⇒ Object
109
110
111
112
113
114
|
# File 'lib/review/markdownbuilder.rb', line 109
def inline_img(id)
"#{I18n.t("image")}#{@chapter.image(id).number}"
rescue KeyError
error "unknown image: #{id}"
nofunc_text("[UnknownImage:#{id}]")
end
|
#nofunc_text(str) ⇒ Object
124
125
126
|
# File 'lib/review/markdownbuilder.rb', line 124
def nofunc_text(str)
str
end
|
56
57
58
|
# File 'lib/review/markdownbuilder.rb', line 56
def ol_begin
blank
end
|
64
65
66
|
# File 'lib/review/markdownbuilder.rb', line 64
def ol_end
blank
end
|
#ol_item(lines, num) ⇒ Object
60
61
62
|
# File 'lib/review/markdownbuilder.rb', line 60
def ol_item(lines, num)
puts "#{num}. #{lines.join}"
end
|
#pagebreak ⇒ Object
116
117
118
|
# File 'lib/review/markdownbuilder.rb', line 116
def pagebreak
puts "{pagebreak}"
end
|
#paragraph(lines) ⇒ Object
39
40
41
42
|
# File 'lib/review/markdownbuilder.rb', line 39
def paragraph(lines)
puts lines.join
puts "\n"
end
|
#puts(str) ⇒ Object
18
19
20
21
|
# File 'lib/review/markdownbuilder.rb', line 18
def puts(str)
@blank_seen = false
super
end
|
#quote(lines) ⇒ Object
33
34
35
36
37
|
# File 'lib/review/markdownbuilder.rb', line 33
def quote(lines)
blank
puts split_paragraph(lines).map{|line| "> #{line}"}.join("\n> \n")
blank
end
|
44
45
46
|
# File 'lib/review/markdownbuilder.rb', line 44
def ul_begin
blank
end
|
52
53
54
|
# File 'lib/review/markdownbuilder.rb', line 52
def ul_end
blank
end
|
#ul_item(lines) ⇒ Object
48
49
50
|
# File 'lib/review/markdownbuilder.rb', line 48
def ul_item(lines)
puts "- #{lines.join}"
end
|