templette 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/files/config.rb +1 -0
- data/lib/templette.rb +1 -1
- data/lib/templette/engineer.rb +1 -1
- data/lib/templette/helpers.rb +3 -3
- data/lib/templette/method_collector.rb +1 -1
- data/lib/templette/page.rb +6 -3
- data/lib/templette/template.rb +4 -3
- metadata +2 -2
data/files/config.rb
CHANGED
data/lib/templette.rb
CHANGED
data/lib/templette/engineer.rb
CHANGED
data/lib/templette/helpers.rb
CHANGED
@@ -21,14 +21,14 @@ module Templette
|
|
21
21
|
"<img src='#{tag_path(path, 'images')}' #{params_to_attributes(options)}/>"
|
22
22
|
end
|
23
23
|
|
24
|
-
# Generates a link to a stylesheet. Default options {:type => 'text/css'}
|
24
|
+
# Generates a link to a stylesheet. Default options {:type => 'text/css', :rel => 'stylesheet'}
|
25
25
|
#
|
26
26
|
# Ex.
|
27
27
|
# stylesheet_tag('print', :media => 'print')
|
28
28
|
# => "<link href='/stylesheets/print.css' media='print' type='text/css' />"
|
29
29
|
|
30
30
|
def stylesheet_tag(path, options = {})
|
31
|
-
options = {:type => 'text/css'}.merge(options)
|
31
|
+
options = {:type => 'text/css', :rel => 'stylesheet', :media => 'screen'}.merge(options)
|
32
32
|
"<link href='#{tag_path(path, 'stylesheets', 'css')}' #{params_to_attributes(options)}/>"
|
33
33
|
end
|
34
34
|
|
@@ -45,7 +45,7 @@ module Templette
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def tag_path(path, asset_subdir, file_ext = nil)
|
48
|
-
if path =~ /
|
48
|
+
if path =~ /https?:\/\//
|
49
49
|
path
|
50
50
|
else
|
51
51
|
"#{Templette.config[:site_root]}#{asset_subdir}/#{path}#{ "."+file_ext if file_ext }"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'erb'
|
2
2
|
|
3
3
|
module Templette
|
4
|
-
# Loads a template and evaluates it
|
4
|
+
# Loads a template and evaluates it. When a missing method is found,
|
5
5
|
# MethodColletor loads that method into a hash, to be rendered as yaml.
|
6
6
|
class MethodCollector
|
7
7
|
include Templette::DataAccessors
|
data/lib/templette/page.rb
CHANGED
@@ -15,8 +15,9 @@ module Templette
|
|
15
15
|
# The <tt>template_name</tt> will be used to load a template.
|
16
16
|
#
|
17
17
|
# Everything in <tt>sections</tt> will be made available as methods in the template when
|
18
|
-
# it's evaluated by ERB. Yaml hash items nested
|
19
|
-
# objects. To call the nav title, the template
|
18
|
+
# it's evaluated by by the rendering engine (ERB by default). Yaml hash items nested
|
19
|
+
# within others will be loaded into nested objects. To call the nav title, the template
|
20
|
+
# should call <tt>nav.title</tt>.
|
20
21
|
|
21
22
|
class Page
|
22
23
|
|
@@ -61,7 +62,9 @@ module Templette
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
|
-
def _binding
|
65
|
+
def _binding # :nodoc:
|
66
|
+
binding
|
67
|
+
end
|
65
68
|
|
66
69
|
# A requriement of the Templette::DataAccessors interface. Returns self.
|
67
70
|
def page; self end
|
data/lib/templette/template.rb
CHANGED
@@ -15,8 +15,9 @@ module Templette
|
|
15
15
|
|
16
16
|
# The name parameter refers to the actual filename of the template. To load
|
17
17
|
# templates/foo.html, a template_name of 'foo' should be given.
|
18
|
-
def initialize(name)
|
19
|
-
@name = name
|
18
|
+
def initialize(name, default_engine = Templette::config[:default_engine])
|
19
|
+
@name = name
|
20
|
+
@default_engine = default_engine
|
20
21
|
end
|
21
22
|
|
22
23
|
# Generates the yaml necessary to render empty page yaml files.
|
@@ -44,7 +45,7 @@ module Templette
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def type
|
47
|
-
path.match(/html\.?(\w+)?/)[1] ||
|
48
|
+
path.match(/html\.?(\w+)?/)[1] || @default_engine
|
48
49
|
end
|
49
50
|
|
50
51
|
def to_html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: templette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Dunphy and Steve Holder
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-27 00:00:00 -08:00
|
13
13
|
default_executable: templette
|
14
14
|
dependencies: []
|
15
15
|
|