staticmatic 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +49 -0
- data/LICENSE +21 -0
- data/README +5 -27
- data/Rakefile +25 -2
- data/lib/staticmatic.rb +3 -5
- data/lib/staticmatic/base.rb +6 -2
- data/lib/staticmatic/configuration.rb +5 -9
- data/lib/staticmatic/helpers.rb +81 -54
- data/lib/staticmatic/version.rb +34 -0
- data/test/base_test.rb +5 -2
- data/test/helpers_test.rb +220 -27
- data/test/version_test.rb +26 -0
- data/website/site/download.html +84 -78
- data/website/site/faq.html +77 -71
- data/website/site/how_to_use.html +307 -173
- data/website/site/index.html +98 -92
- data/website/site/releases/0_8_10.html +106 -0
- data/website/site/releases/0_8_4.html +101 -95
- data/website/site/releases/0_8_8.html +96 -86
- data/website/site/releases/0_9_0.html +124 -0
- data/website/src/layouts/application.haml +10 -7
- data/website/src/pages/how_to_use.haml +149 -8
- data/website/src/pages/releases/0_8_10.haml +22 -0
- data/website/src/pages/releases/0_8_8.haml +4 -0
- data/website/src/pages/releases/0_9_0.haml +34 -0
- data/website/src/partials/news.haml +8 -6
- metadata +12 -5
@@ -1,86 +1,96 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
-
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
-
<head>
|
4
|
-
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
|
5
|
-
<title>StaticMatic</title>
|
6
|
-
<link
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
</div>
|
15
|
-
<div class='title'>StaticMatic</div>
|
16
|
-
</div>
|
17
|
-
<div id='menu'>
|
18
|
-
<ul>
|
19
|
-
<li><a href="/">Home</a></li>
|
20
|
-
<li><a href="
|
21
|
-
<li><a href="
|
22
|
-
<li>
|
23
|
-
<a href="http://
|
24
|
-
</li>
|
25
|
-
<li>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<
|
40
|
-
|
41
|
-
<li
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</
|
52
|
-
|
53
|
-
<
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
<
|
60
|
-
configuration.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
configuration.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
</
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
|
5
|
+
<title>StaticMatic</title>
|
6
|
+
<link href="../stylesheets/application.css" media="all" rel="stylesheet"/>
|
7
|
+
<link href="../stylesheets/application.css" media="screen" rel="stylesheet"/>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id='container'>
|
11
|
+
<div id='header'>
|
12
|
+
<div class='bycurve21'>
|
13
|
+
<a href="http://www.curve21.com"><img alt="Bycurve21" src="../images/bycurve21.gif"/></a>
|
14
|
+
</div>
|
15
|
+
<div class='title'>StaticMatic</div>
|
16
|
+
</div>
|
17
|
+
<div id='menu'>
|
18
|
+
<ul>
|
19
|
+
<li><a href="/">Home</a></li>
|
20
|
+
<li><a href="../download.html">Download</a></li>
|
21
|
+
<li><a href="../how_to_use.html">How to use</a></li>
|
22
|
+
<li>
|
23
|
+
<a href="http://groups.google.co.uk/group/staticmatic">Community</a>
|
24
|
+
</li>
|
25
|
+
<li><a href="../faq.html">FAQ</a></li>
|
26
|
+
<li>
|
27
|
+
<a href="http://rubyforge.org/tracker/?func=browse&group_id=3712&atid=14306">Report Bug</a>
|
28
|
+
</li>
|
29
|
+
<li>
|
30
|
+
<a href="http://rubyforge.org/projects/staticmatic">Development</a>
|
31
|
+
</li>
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div id='content_wrapper'>
|
35
|
+
<div id='side'>
|
36
|
+
<div id='news'>
|
37
|
+
<div class='heading'>News</div>
|
38
|
+
<div class='title'>0.9.0 Released!</div>
|
39
|
+
<p>Complete with:</p>
|
40
|
+
<ul>
|
41
|
+
<li>"Local" links are always relative</li>
|
42
|
+
<li>
|
43
|
+
Ability to strip .html and index.html from link tag urls
|
44
|
+
</li>
|
45
|
+
<li>configuration.sass_options</li>
|
46
|
+
</ul>
|
47
|
+
<a href="/releases/0_9_0.html">And More!</a>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
<div id='content'>
|
51
|
+
<h1>StaticMatic 0.8.8</h1>
|
52
|
+
<h2>Helpers</h2>
|
53
|
+
<p>
|
54
|
+
Thanks to Craig Webster, we now have Rails-style helpers.
|
55
|
+
</p>
|
56
|
+
src/application_helper.rb:
|
57
|
+
<pre class="code">
module ApplicationHelper
 def greet(name)
 "Hello, #{name}!"
 end
end
</pre>


|
58
|
+
<h2>Configuration</h2>
|
59
|
+
<p>
|
60
|
+
We also now have configuration. It's only basic right now but expect this to expand.
|
61
|
+
</p>
|
62
|
+
src/configuration.rb:
|
63
|
+
<div class='code'>
|
64
|
+
configuration.preview_server_port = 3000
|
65
|
+
configuration.use_relative_paths_for_links = false
|
66
|
+
configuration.use_relative_paths_for_images = false
|
67
|
+
configuration.use_relative_paths_for_stylesheets = false
|
68
|
+
configuration.use_relative_paths_for_javascripts = false
|
69
|
+
</div>
|
70
|
+
<p>
|
71
|
+
The configuration file is also loaded before StaticMatic starts so it can be used to monkey-patch to demonstrate new features.
|
72
|
+
</p>
|
73
|
+
<p>
|
74
|
+
See what changed in
|
75
|
+
<a href="/releases/0_8_4.html">0.8.4</a>
|
76
|
+
</p>
|
77
|
+
</div>
|
78
|
+
</div>
|
79
|
+
<div id='footer'>
|
80
|
+
<p>
|
81
|
+
Made with StaticMatic
|
82
|
+
0.9.0
|
83
|
+
, Hosted by
|
84
|
+
<a href="http://rubyforge.org">RubyForge</a>
|
85
|
+
</p>
|
86
|
+
</div>
|
87
|
+
<script src='http://www.google-analytics.com/urchin.js' type='text/javascript'>
|
88
|
+
_hamlspace = "";
|
89
|
+
</script>
|
90
|
+
<script type='text/javascript'>
|
91
|
+
_uacct = "UA-775359-8";
|
92
|
+
urchinTracker();
|
93
|
+
</script>
|
94
|
+
</div>
|
95
|
+
</body>
|
96
|
+
</html>
|
@@ -0,0 +1,124 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
|
5
|
+
<title>StaticMatic</title>
|
6
|
+
<link href="../stylesheets/application.css" media="all" rel="stylesheet"/>
|
7
|
+
<link href="../stylesheets/application.css" media="screen" rel="stylesheet"/>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id='container'>
|
11
|
+
<div id='header'>
|
12
|
+
<div class='bycurve21'>
|
13
|
+
<a href="http://www.curve21.com"><img alt="Bycurve21" src="../images/bycurve21.gif"/></a>
|
14
|
+
</div>
|
15
|
+
<div class='title'>StaticMatic</div>
|
16
|
+
</div>
|
17
|
+
<div id='menu'>
|
18
|
+
<ul>
|
19
|
+
<li><a href="/">Home</a></li>
|
20
|
+
<li><a href="../download.html">Download</a></li>
|
21
|
+
<li><a href="../how_to_use.html">How to use</a></li>
|
22
|
+
<li>
|
23
|
+
<a href="http://groups.google.co.uk/group/staticmatic">Community</a>
|
24
|
+
</li>
|
25
|
+
<li><a href="../faq.html">FAQ</a></li>
|
26
|
+
<li>
|
27
|
+
<a href="http://rubyforge.org/tracker/?func=browse&group_id=3712&atid=14306">Report Bug</a>
|
28
|
+
</li>
|
29
|
+
<li>
|
30
|
+
<a href="http://rubyforge.org/projects/staticmatic">Development</a>
|
31
|
+
</li>
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<div id='content_wrapper'>
|
35
|
+
<div id='side'>
|
36
|
+
<div id='news'>
|
37
|
+
<div class='heading'>News</div>
|
38
|
+
<div class='title'>0.9.0 Released!</div>
|
39
|
+
<p>Complete with:</p>
|
40
|
+
<ul>
|
41
|
+
<li>"Local" links are always relative</li>
|
42
|
+
<li>
|
43
|
+
Ability to strip .html and index.html from link tag urls
|
44
|
+
</li>
|
45
|
+
<li>configuration.sass_options</li>
|
46
|
+
</ul>
|
47
|
+
<a href="/releases/0_9_0.html">And More!</a>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
<div id='content'>
|
51
|
+
<h1>StaticMatic 0.9.0</h1>
|
52
|
+
<p>
|
53
|
+
The biggest change is that
|
54
|
+
<span class='highlight'>
|
55
|
+
all the "local" links (pages/stylesheets/images) are always relative
|
56
|
+
</span>
|
57
|
+
now that we know the current page. So the
|
58
|
+
use_relative_path_for_* configuration settings were removed.
|
59
|
+
<span class='highlight'>
|
60
|
+
This will cause your configuration.rb to blow up unless you delete them.
|
61
|
+
</span>
|
62
|
+
</p>
|
63
|
+
<h2>What's New</h2>
|
64
|
+
<ul>
|
65
|
+
<li>added StaticMatic::VERSION.requirements_met?</li>
|
66
|
+
<li>added LICENSE and CHANGELOG files</li>
|
67
|
+
<li>
|
68
|
+
can now specify relative paths when only specifying a title - link("../other/How to download")
|
69
|
+
</li>
|
70
|
+
<li>
|
71
|
+
add src_dir/stylesheets directory to sass load path so you can use @import styles.sass
|
72
|
+
</li>
|
73
|
+
<li>
|
74
|
+
added sass_options hash to configuration so you can configure sass (ie: :style => :compact)
|
75
|
+
</li>
|
76
|
+
<li>
|
77
|
+
added configuration.use_extensions_for_page_links (defaults to true) when false will strip index.html and .html off the end of links for pretty urls
|
78
|
+
</li>
|
79
|
+
<li>
|
80
|
+
made all "local" links (pages/stylesheets/images) relative to the current page and removed use_relative_path_for_* configuration settings
|
81
|
+
</li>
|
82
|
+
<li>
|
83
|
+
stylesheets helper can now take a list of stylesheets to include and the order as well as options (ie: :media => :print)
|
84
|
+
</li>
|
85
|
+
<li>added clean and clobber tasks to Rakefile</li>
|
86
|
+
<li>added StaticMatic::VERSION in version.rb</li>
|
87
|
+
<li>
|
88
|
+
added package task to Rakefile and made it the default
|
89
|
+
</li>
|
90
|
+
</ul>
|
91
|
+
<h2>What's Fixed</h2>
|
92
|
+
<ul>
|
93
|
+
<li>
|
94
|
+
clear all instance variables in @scope except @staticmatic
|
95
|
+
</li>
|
96
|
+
<li>no longer add \n after the tag in the tag helper</li>
|
97
|
+
<li>
|
98
|
+
mailto: links were getting a / inserted at in front of the mailto:
|
99
|
+
</li>
|
100
|
+
</ul>
|
101
|
+
<p>
|
102
|
+
See what changed in
|
103
|
+
<a href="/releases/0_8_10.html">0.8.10</a>
|
104
|
+
</p>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
<div id='footer'>
|
108
|
+
<p>
|
109
|
+
Made with StaticMatic
|
110
|
+
0.9.0
|
111
|
+
, Hosted by
|
112
|
+
<a href="http://rubyforge.org">RubyForge</a>
|
113
|
+
</p>
|
114
|
+
</div>
|
115
|
+
<script src='http://www.google-analytics.com/urchin.js' type='text/javascript'>
|
116
|
+
_hamlspace = "";
|
117
|
+
</script>
|
118
|
+
<script type='text/javascript'>
|
119
|
+
_uacct = "UA-775359-8";
|
120
|
+
urchinTracker();
|
121
|
+
</script>
|
122
|
+
</div>
|
123
|
+
</body>
|
124
|
+
</html>
|
@@ -4,22 +4,23 @@
|
|
4
4
|
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}
|
5
5
|
%title StaticMatic
|
6
6
|
= stylesheets
|
7
|
+
= stylesheets :reset, :application, :media => :screen
|
7
8
|
%body
|
8
9
|
#container
|
9
10
|
#header
|
10
|
-
.bycurve21= link(img("
|
11
|
+
.bycurve21= link(img("bycurve21.gif"), "http://www.curve21.com")
|
11
12
|
.title StaticMatic
|
12
13
|
|
13
14
|
#menu
|
14
15
|
|
15
16
|
%ul
|
16
17
|
%li= link "Home", "/"
|
17
|
-
%li= link "Download"
|
18
|
-
%li= link "How to use"
|
19
|
-
%li= link "Development", "http://rubyforge.org/projects/staticmatic"
|
18
|
+
%li= link "Download"
|
19
|
+
%li= link "How to use"
|
20
20
|
%li= link "Community", "http://groups.google.co.uk/group/staticmatic"
|
21
|
-
%li= link "FAQ"
|
22
|
-
|
21
|
+
%li= link "FAQ"
|
22
|
+
%li= link 'Report Bug', 'http://rubyforge.org/tracker/?func=browse&group_id=3712&atid=14306'
|
23
|
+
%li= link "Development", "http://rubyforge.org/projects/staticmatic"
|
23
24
|
#content_wrapper
|
24
25
|
#side
|
25
26
|
#news= partial("news")
|
@@ -29,7 +30,9 @@
|
|
29
30
|
|
30
31
|
#footer
|
31
32
|
%p
|
32
|
-
Made with StaticMatic
|
33
|
+
Made with StaticMatic
|
34
|
+
= StaticMatic::VERSION::STRING
|
35
|
+
\, Hosted by
|
33
36
|
= link "RubyForge", "http://rubyforge.org"
|
34
37
|
|
35
38
|
%script{:src => "http://www.google-analytics.com/urchin.js", :type => "text/javascript"}
|
@@ -4,11 +4,13 @@
|
|
4
4
|
|
5
5
|
%ul
|
6
6
|
%li= link "Developing a site", "#developing"
|
7
|
+
%li= link "Configuration", "#configuration"
|
7
8
|
%li
|
8
9
|
= link "Templates", "#templates"
|
9
10
|
%ul
|
10
11
|
%li= link "Layouts", "#layouts"
|
11
12
|
%li= link "Helpers", "#helpers"
|
13
|
+
%li= link "Partials", "#partials"
|
12
14
|
|
13
15
|
%h2{:id => 'developing'} Developing a site with StaticMatic
|
14
16
|
|
@@ -25,9 +27,14 @@
|
|
25
27
|
%li
|
26
28
|
src/ - where you'll work on your templates
|
27
29
|
%ul
|
30
|
+
%li helpers/ - contains any helpers you want to use in your website
|
28
31
|
%li layouts/ - contains templates that 'wrap' your main content pages
|
29
32
|
%li pages/ - contains the actual pages of content
|
30
|
-
%li
|
33
|
+
%li partials/ - contains any "partial pages" that can be reused in other pages or layouts
|
34
|
+
%li
|
35
|
+
stylesheets/ - contains any
|
36
|
+
= link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass'
|
37
|
+
stylesheets you want to create
|
31
38
|
|
32
39
|
%h3 Previewing your site
|
33
40
|
|
@@ -46,21 +53,49 @@
|
|
46
53
|
|
47
54
|
.code staticmatic build my_site
|
48
55
|
|
56
|
+
%h2{:id => 'configuration'} Configuration
|
57
|
+
|
58
|
+
%p
|
59
|
+
You can put a file called configuration.rb in your staticmatic project base directory.
|
60
|
+
In this file, you can set configuration settings or whatever else since it's just a
|
61
|
+
ruby file.
|
62
|
+
|
63
|
+
%h3 configuration.preview_server_port
|
64
|
+
|
65
|
+
%p
|
66
|
+
The default is 3000.
|
67
|
+
|
68
|
+
%h3 configuration.preview_server_host
|
69
|
+
|
70
|
+
%p
|
71
|
+
The default is localhost.
|
72
|
+
|
73
|
+
%h3 configuration.use_extensions_for_page_links
|
74
|
+
|
75
|
+
%p
|
76
|
+
The default is true. When false .html and index.html will be stripped off
|
77
|
+
urls generated by the link tag helper.
|
78
|
+
|
79
|
+
%h3 configuration.sass_options
|
80
|
+
|
81
|
+
%p
|
82
|
+
Default is an empty hash. You can specify any options that
|
83
|
+
= link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass'
|
84
|
+
can take like :style => :compact
|
49
85
|
|
50
86
|
%h2{:id => 'templates'} Templates
|
51
87
|
|
52
88
|
%p
|
53
89
|
%em
|
54
90
|
For information on how to use Haml itself, please check out the
|
55
|
-
= link
|
56
|
-
\.
|
91
|
+
= link("Haml website", "http://haml.hamptoncatlin.com/docs/haml") + "."
|
57
92
|
|
58
93
|
%h3{:id => 'layouts'} Layouts
|
59
94
|
|
60
95
|
%p
|
61
96
|
As with web frameworks like
|
62
|
-
= link
|
63
|
-
|
97
|
+
= link("Ruby on Rails", "http://www.rubyonrails.com") + ","
|
98
|
+
StaticMatic uses layouts to 'wrap' up the content contained within page templates.
|
64
99
|
|
65
100
|
%p A layout typically contains the header and footer code for a page - code that is common to all pages on the site.
|
66
101
|
|
@@ -75,7 +110,8 @@
|
|
75
110
|
|
76
111
|
%p The above code would tell StaticMatic to use the layout called 'contact.haml' when building and previewing the 'contact_us' page.
|
77
112
|
|
78
|
-
|
113
|
+
|
114
|
+
%h3{:id => 'helpers'} Helpers
|
79
115
|
|
80
116
|
%p StaticMatic provides a number of 'helpers' on top of those in Haml to handle common code and reduce code.
|
81
117
|
|
@@ -89,6 +125,14 @@ produces:
|
|
89
125
|
|
90
126
|
.code <a href="contact_us.html">Contact Us</a>"
|
91
127
|
|
128
|
+
%p It is also possible to specify a relative path in your url:
|
129
|
+
|
130
|
+
.code = link "../Contact Us"
|
131
|
+
|
132
|
+
produces:
|
133
|
+
|
134
|
+
.code <a href="../contact_us.html">Contact Us</a>"
|
135
|
+
|
92
136
|
%p You can also specify a URL:
|
93
137
|
|
94
138
|
.code = link "StaticMatic", "http://staticmatic.rubyforge.org"
|
@@ -99,10 +143,107 @@ produces:
|
|
99
143
|
produces:
|
100
144
|
.code <img src="/images/me.jpg"/>
|
101
145
|
|
146
|
+
%p It is also possible to specify a relative path in your url:
|
147
|
+
|
148
|
+
.code = img "../me.jpg"
|
149
|
+
produces:
|
150
|
+
.code <img src="../me.jpg"/>
|
151
|
+
|
102
152
|
%h4 Stylesheets
|
103
153
|
|
104
154
|
.code = stylesheets
|
105
155
|
|
106
|
-
%p
|
156
|
+
%p
|
157
|
+
This will automatically insert links to any
|
158
|
+
= link 'Sass', 'http://haml.hamptoncatlin.com/docs/sass'
|
159
|
+
stylesheets in your site source.
|
160
|
+
|
161
|
+
It will also link up any static stylesheets in your site/stylesheets/ directory
|
162
|
+
|
163
|
+
%p
|
164
|
+
You can also specify the files and the order explicitly along with setting attributes:
|
165
|
+
|
166
|
+
.code = stylesheets :reset, :application, :media => :screen
|
167
|
+
|
168
|
+
produces
|
169
|
+
|
170
|
+
.code
|
171
|
+
<link href="stylesheets/reset.css" media="screen" rel="stylesheet"/>
|
172
|
+
%br
|
173
|
+
<link href="stylesheets/application.css" media="screen" rel="stylesheet"/>
|
174
|
+
|
175
|
+
%h4 Javascript
|
176
|
+
|
177
|
+
.code = javascripts('test', :other)
|
178
|
+
produces:
|
179
|
+
.code
|
180
|
+
<script language="javascript" src="/javascripts/test.js" type="text/javascript"></script>
|
181
|
+
%br
|
182
|
+
<script language="javascript" src="/javascripts/other.js" type="text/javascript"></script>
|
183
|
+
|
184
|
+
%h4 Current page
|
185
|
+
|
186
|
+
%p
|
187
|
+
It can be very useful to know what page you're on in your layout and helpers
|
188
|
+
(ie: setting selected style on a menu item).
|
189
|
+
|
190
|
+
For the page src/pages/index.html
|
191
|
+
.code = current_page # => "/index.html"
|
192
|
+
%br
|
193
|
+
For the page src/pages/subdirectory/other.html
|
194
|
+
.code = current_page # => "/subdirectory/other.html"
|
195
|
+
|
196
|
+
%h4 urlify
|
197
|
+
|
198
|
+
%p Will convert a string to be usable in a url
|
199
|
+
|
200
|
+
.code
|
201
|
+
\= urlify("We love Haml") # => "we_love_haml"
|
202
|
+
%br
|
203
|
+
\= urlify("Elf & Ham") # => "elf_and_ham"
|
204
|
+
%br
|
205
|
+
\= urlify("Stephen's gem") # => "stephens_gem"
|
206
|
+
%br
|
207
|
+
\= urlify("Test/Link") # => "testlink"
|
208
|
+
|
209
|
+
%h4 text_field
|
210
|
+
|
211
|
+
%p Generates a text input field
|
212
|
+
|
213
|
+
.code = text_field('first_name', 'bob')
|
214
|
+
produces:
|
215
|
+
.code <input name="first_name" type="text" value="bob"/>
|
216
|
+
|
217
|
+
|
218
|
+
%h3{:id => 'partials'} Partials
|
219
|
+
|
220
|
+
%p
|
221
|
+
As with web frameworks like
|
222
|
+
= link("Ruby on Rails", "http://www.rubyonrails.com") + ","
|
223
|
+
StaticMatic uses partials to keep things
|
224
|
+
= link('DRY', 'http://en.wikipedia.org/wiki/DRY') + "."
|
225
|
+
|
226
|
+
.code = partial('mypartial')
|
227
|
+
|
228
|
+
%p
|
229
|
+
This will first look in the current page/partial's directory for a file called _mypartial.haml.
|
230
|
+
If not found there it will look for src/partials/mypartial.haml.
|
231
|
+
|
232
|
+
%h4 Specify the partial's local variables
|
233
|
+
|
234
|
+
.code = partial('mypartial', :locals => { :title => 'My Title' })
|
235
|
+
|
236
|
+
%p
|
237
|
+
This will locate the partial file as in the previous example above but now passes in a local variable called
|
238
|
+
%em title
|
239
|
+
that can be used in the partial like so:
|
240
|
+
|
241
|
+
.code %h1 title
|
242
|
+
|
243
|
+
%h4 Specify the partial's directory
|
244
|
+
|
245
|
+
.code = partial('shared/mypartial')
|
107
246
|
|
108
|
-
|
247
|
+
%p
|
248
|
+
This will look for the file src/pages/shared/_mypartial.haml first.
|
249
|
+
If not found there it will look for src/partials/mypartial.haml.
|