Module: ReVIEW::Book::Compilable
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from TextUtils
#convert_inencoding, #convert_outencoding, #detab, #split_paragraph
Instance Attribute Details
Returns the value of attribute book.
17
18
19
|
# File 'lib/review/book/compilable.rb', line 17
def book
@book
end
|
69
70
71
72
73
74
|
# File 'lib/review/book/compilable.rb', line 69
def content
@content = convert_inencoding(File.read(path()),
ReVIEW.book.param["inencoding"])
rescue
@content
end
|
Returns the value of attribute path.
18
19
20
|
# File 'lib/review/book/compilable.rb', line 18
def path
@path
end
|
Instance Method Details
29
30
31
32
|
# File 'lib/review/book/compilable.rb', line 29
def basename
return nil unless @path
File.basename(@path)
end
|
#bibpaper(id) ⇒ Object
143
144
145
|
# File 'lib/review/book/compilable.rb', line 143
def bibpaper(id)
bibpaper_index()[id]
end
|
#bibpaper_index ⇒ Object
147
148
149
150
151
|
# File 'lib/review/book/compilable.rb', line 147
def bibpaper_index
raise FileNotFound, "no such bib file: #{@book.bib_file}" unless @book.bib_exist?
@bibpaper_index ||= BibpaperIndex.parse(@book.read_bib.lines.to_a)
@bibpaper_index
end
|
24
25
26
27
|
# File 'lib/review/book/compilable.rb', line 24
def dirname
return nil unless @path
File.dirname(@path)
end
|
20
21
22
|
# File 'lib/review/book/compilable.rb', line 20
def env
@book
end
|
99
100
101
|
# File 'lib/review/book/compilable.rb', line 99
def (id)
()[id]
end
|
103
104
105
106
|
# File 'lib/review/book/compilable.rb', line 103
def
@footnote_index ||= FootnoteIndex.parse(lines())
@footnote_index
end
|
#headline(caption) ⇒ Object
153
154
155
|
# File 'lib/review/book/compilable.rb', line 153
def headline(caption)
headline_index()[caption]
end
|
#headline_index ⇒ Object
157
158
159
|
# File 'lib/review/book/compilable.rb', line 157
def headline_index
@headline_index ||= HeadlineIndex.parse(lines(), self)
end
|
#icon_index ⇒ Object
129
130
131
132
133
134
|
# File 'lib/review/book/compilable.rb', line 129
def icon_index
@icon_index ||= IconIndex.parse(lines(), id(),
"#{book.basedir}#{@book.image_dir}",
@book.image_types)
@icon_index
end
|
#image(id) ⇒ Object
108
109
110
111
112
113
|
# File 'lib/review/book/compilable.rb', line 108
def image(id)
return image_index()[id] if image_index().has_key?(id)
return icon_index()[id] if icon_index().has_key?(id)
return numberless_image_index()[id] if numberless_image_index().has_key?(id)
indepimage_index()[id]
end
|
#image_index ⇒ Object
122
123
124
125
126
127
|
# File 'lib/review/book/compilable.rb', line 122
def image_index
@image_index ||= ImageIndex.parse(lines(), id(),
"#{book.basedir}#{@book.image_dir}",
@book.image_types)
@image_index
end
|
#indepimage_index ⇒ Object
136
137
138
139
140
141
|
# File 'lib/review/book/compilable.rb', line 136
def indepimage_index
@indepimage_index ||=
IndepImageIndex.parse(lines(), id(),
"#{book.basedir}#{@book.image_dir}",
@book.image_types)
end
|
76
77
78
79
|
# File 'lib/review/book/compilable.rb', line 76
def lines
(@lines ||= content().lines.to_a).dup
end
|
81
82
83
|
# File 'lib/review/book/compilable.rb', line 81
def list(id)
list_index()[id]
end
|
#list_index ⇒ Object
85
86
87
88
|
# File 'lib/review/book/compilable.rb', line 85
def list_index
@list_index ||= ListIndex.parse(lines())
@list_index
end
|
#name ⇒ Object
Also known as:
id
34
35
36
|
# File 'lib/review/book/compilable.rb', line 34
def name
File.basename(@name, '.*')
end
|
#numberless_image_index ⇒ Object
115
116
117
118
119
120
|
# File 'lib/review/book/compilable.rb', line 115
def numberless_image_index
@numberless_image_index ||=
NumberlessImageIndex.parse(lines(), id(),
"#{book.basedir}#{@book.image_dir}",
@book.image_types)
end
|
#open(&block) ⇒ Object
62
63
64
65
|
# File 'lib/review/book/compilable.rb', line 62
def open(&block)
return (block_given?() ? yield(@io) : @io) if @io
File.open(path(), &block)
end
|
54
55
56
|
# File 'lib/review/book/compilable.rb', line 54
def size
File.size(path())
end
|
#table(id) ⇒ Object
90
91
92
|
# File 'lib/review/book/compilable.rb', line 90
def table(id)
table_index()[id]
end
|
#table_index ⇒ Object
94
95
96
97
|
# File 'lib/review/book/compilable.rb', line 94
def table_index
@table_index ||= TableIndex.parse(lines())
@table_index
end
|
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/review/book/compilable.rb', line 40
def title
@title = ""
open {|f|
f.each_line {|l|
l = convert_inencoding(l, ReVIEW.book.param["inencoding"])
if l =~ /\A=+/
@title = l.sub(/\A=+/, '').strip
break
end
}
}
@title
end
|
58
59
60
|
# File 'lib/review/book/compilable.rb', line 58
def volume
@volume ||= Volume.count_file(path())
end
|