Class: Layout
- Inherits:
-
Erector::Widget
- Object
- Erector::Widget
- Layout
show all
- Defined in:
- lib/mail/vendor/treetop-1.4.3/doc/site.rb,
lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.absolute_path ⇒ Object
23
24
25
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 23
def absolute_path
absolutize(relative_path)
end
|
.absolutize(relative_path) ⇒ Object
31
32
33
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 31
def absolutize(relative_path)
File.join(site_dir, relative_path)
end
|
.abstract ⇒ Object
35
36
37
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 35
def abstract
@abstract = true
end
|
.abstract? ⇒ Boolean
39
40
41
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 39
def abstract?
@abstract
end
|
.generate_html ⇒ Object
17
18
19
20
21
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 17
def generate_html
File.open(absolute_path, 'w') do |file|
file.write(new.render)
end
end
|
.generate_site ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 9
def generate_site
FileUtils.mkdir_p(site_dir)
@@page_classes.each do |page_class|
page_class.generate_html unless page_class.abstract?
puts page_class
end
end
|
.inherited(page_class) ⇒ Object
4
5
6
7
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 4
def inherited(page_class)
puts page_class
(@@page_classes ||= []) << page_class
end
|
.relative_path ⇒ Object
27
28
29
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 27
def relative_path
"#{name.gsub('::', '_').underscore}.html"
end
|
.site_dir ⇒ Object
43
44
45
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 43
def site_dir
File.join(File.dirname(__FILE__), "site")
end
|
Instance Method Details
#absolutize(relative_path) ⇒ Object
54
55
56
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 54
def absolutize(relative_path)
self.class.absolutize(relative_path)
end
|
#bluecloth(relative_path) ⇒ Object
48
49
50
51
52
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 48
def bluecloth(relative_path)
File.open(File.join(File.dirname(__FILE__), relative_path)) do |file|
rawtext BlueCloth.new(file.read).to_html
end
end
|
#content ⇒ Object
51
52
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/site.rb', line 51
def content
end
|
#link_to(link_text, page_class, section_class = nil) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/sitegen.rb', line 58
def link_to(link_text, page_class, section_class=nil)
if instance_of?(page_class) || section_class && is_a?(section_class)
text link_text
else
a link_text, :href => page_class.relative_path
end
end
|
#main_navigation ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/site.rb', line 43
def main_navigation
ul do
li { link_to "Documentation", SyntacticRecognition, Documentation }
li { link_to "Contribute", Contribute }
li { link_to "Home", Index }
end
end
|
#render ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/mail/vendor/treetop-1.4.3/doc/site.rb', line 8
def render
html do
head do
link :rel => "stylesheet",
:type => "text/css",
:href => "./screen.css"
rawtext %(
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-3418876-1";
urchinTracker();
</script>
)
end
body do
div :id => 'top' do
div :id => 'main_navigation' do
main_navigation
end
end
div :id => 'middle' do
div :id => 'content' do
content
end
end
div :id => 'bottom' do
end
end
end
end
|