laydown 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,9 +14,7 @@
14
14
  # | | | oo |
15
15
  #'''''''''''''''''''''''''''''******
16
16
 
17
- Bored of writing the same html boilerplate every time you make a new app?
18
-
19
- How about something like this?
17
+ Quick HTML5 layouts.
20
18
 
21
19
  # $ gem install laydown
22
20
 
@@ -29,16 +27,16 @@ How about something like this?
29
27
  title: 'A man in a #{@where}',
30
28
  description: 'Very interesting',
31
29
  favicon: 'pill.png',
32
- keywords: 'man, #{@keywords}',
30
+ keywords: ['man', :@keywords],
33
31
 
34
32
  css: ['site.css', :@css],
35
33
  js: ['app.js', :@js],
36
34
  inline_js: ['alert("#{@msg}");'],
37
35
 
38
36
  head: '<meta soundtrack="Piazzolla">',
39
- body: '#{yield}', # default
40
- body_class: 'dark',
41
- ga_code: 'ga-some-number'
37
+ body: :yield, # default
38
+ body_class: ['dark', :@body_class],
39
+ ga_code: 'google_analytics_id'
42
40
  )
43
41
 
44
42
  # ----------------------------
data/Rakefile CHANGED
@@ -27,8 +27,10 @@ namespace :build do
27
27
  engine = Slim::Engine.new()
28
28
  compiled = engine.compile(src)
29
29
 
30
- File.open('lib/template.rb', 'w') do |f|
30
+ File.open('lib/laydown/template.rb', 'w') do |f|
31
+ f.write "Laydown::TEMPLATE = <<'TEMPLATE'\n"
31
32
  f.write compiled
33
+ f.write "\nTEMPLATE\n"
32
34
  end
33
35
  end
34
36
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
data/laydown.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{laydown}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jbe"]
12
- s.date = %q{2011-02-25}
12
+ s.date = %q{2011-02-27}
13
13
  s.description = %q{Provides a simple Ruby DSL for defining HTML5 layouts for web apps. For those who has written the same layout too many times.}
14
14
  s.email = %q{post@jostein.be}
15
15
  s.extra_rdoc_files = [
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "laydown.gemspec",
27
27
  "lib/laydown.rb",
28
- "lib/template.rb",
28
+ "lib/laydown/template.rb",
29
29
  "spec/laydown_spec.rb",
30
30
  "template.slim"
31
31
  ]
data/lib/laydown.rb CHANGED
@@ -5,11 +5,9 @@ require 'temple/utils'
5
5
 
6
6
  module Laydown
7
7
 
8
- RAW_TEMPLATE = File.read(File.join(
9
- File.dirname(__FILE__), 'template.rb'
10
- ))
8
+ require 'laydown/template'
11
9
 
12
- DEFAULT_TEMPLATE = {
10
+ DEFAULTS = {
13
11
  :charset => 'utf-8',
14
12
  :title => nil,
15
13
  :description => nil,
@@ -28,13 +26,13 @@ module Laydown
28
26
 
29
27
  def self.compile(template={})
30
28
 
31
- template = DEFAULT_TEMPLATE.merge(template)
29
+ template = DEFAULTS.merge(template)
32
30
 
33
31
  ARRAY_PROPS.each do |k|
34
32
  template[k] = Array(template[k]).flatten.compact
35
33
  end
36
34
 
37
- RAW_TEMPLATE.gsub(/data\[:([a-zA-Z0-9_]+)\]/) do |m|
35
+ TEMPLATE.gsub(/data\[:([a-zA-Z0-9_]+)\]/) do |m|
38
36
  literalize template[:"#{$1}"]
39
37
  end
40
38
  end
@@ -1,3 +1,4 @@
1
+ Laydown::TEMPLATE = <<'TEMPLATE'
1
2
  _buf = [] ; _temple_pre_tags = /<pre|<textarea/ ; _buf << ("<!DOCTYPE html><html><head>") ;
2
3
  ;
3
4
  ;
@@ -44,4 +45,5 @@ _buf = [] ; _temple_pre_tags = /<pre|<textarea/ ; _buf << ("<!DOCTYPE html><html
44
45
  ""\
45
46
  ""\
46
47
  ""\
47
- "") ; end ; _buf << ("</body></html>") ; _buf = _buf.join
48
+ "") ; end ; _buf << ("</body></html>") ; _buf = _buf.join
49
+ TEMPLATE
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 1
9
- version: 0.6.1
8
+ - 2
9
+ version: 0.6.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - jbe
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-25 00:00:00 +01:00
17
+ date: 2011-02-27 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,7 @@ files:
61
61
  - VERSION
62
62
  - laydown.gemspec
63
63
  - lib/laydown.rb
64
- - lib/template.rb
64
+ - lib/laydown/template.rb
65
65
  - spec/laydown_spec.rb
66
66
  - template.slim
67
67
  has_rdoc: true