haml_tumblr 1.0.0

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.
Files changed (2) hide show
  1. data/lib/haml_tumblr.rb +64 -0
  2. metadata +45 -0
@@ -0,0 +1,64 @@
1
+ def render( partial )
2
+ haml_concat Haml::Engine.new(File.read "partials/_#{partial.to_s}.haml" ).render(self)
3
+ end
4
+
5
+ def tab
6
+ tab_up
7
+ yield
8
+ tab_down
9
+ end
10
+
11
+ def coffee_tag( coffee_file )
12
+ require 'coffee-script'
13
+ haml_tag :script, :type => 'text/javascript' do
14
+ haml_concat CoffeeScript.compile File.read "#{coffee_file.to_s}.coffee"
15
+ end
16
+ end
17
+
18
+ def jquery_tag( version = "1.7.2" )
19
+ haml_tag :script,
20
+ :type => 'text/javascript',
21
+ :src => 'http://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js'
22
+ end
23
+
24
+ def sass_tag( sass_file )
25
+ require 'sass'
26
+ haml_tag :style, :type => 'text/css' do
27
+ haml_concat Sass::Engine.new(File.read "#{sass_file.to_s}.sass").render
28
+ end
29
+ end
30
+
31
+ def scss_tag( scss_file )
32
+ require 'sass'
33
+ haml_tag :style, :type => 'text/css' do
34
+ haml_concat Sass::Engine.new(File.read "#{scss_file.to_s}.scss").render
35
+ end
36
+ end
37
+
38
+ def tumblr_tag( tag )
39
+ if block_given?
40
+ haml_concat "{block:#{process tag}}"
41
+ tab do
42
+ yield
43
+ end
44
+ haml_concat "{/block:#{process tag}}"
45
+ else
46
+ haml_concat "{#{process tag}}"
47
+ end
48
+ end
49
+
50
+ def tumblr_link_tag( tag )
51
+ "{#{process tag}}"
52
+ end
53
+
54
+ def link_to( text, address )
55
+ haml_tag :a, :href => address do
56
+ haml_concat text
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ def process( tag )
63
+ tag.to_s.split("_").map(&:capitalize).join
64
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: haml_tumblr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fraser Murray
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-14 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description:
15
+ email: fraser.m.murray@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/haml_tumblr.rb
21
+ homepage: http://github.com/intolerable/haml_tumblr
22
+ licenses: []
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 1.8.15
42
+ signing_key:
43
+ specification_version: 3
44
+ summary: library for making Tumblr themes nicer to write in Haml
45
+ test_files: []