hum 0.0.5 → 0.0.6
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/CHANGELOG.md +5 -1
- data/README.md +5 -1
- data/lib/hum/engine.rb +34 -7
- data/lib/hum/version.rb +1 -1
- data/test/engine_tests.rb +5 -0
- data/test/haml/anchor_links.haml +2 -0
- data/test/haml/input_elements.haml +8 -0
- data/test/sass/anchor_links.sass +5 -1
- data/test/sass/input_elements.sass +8 -0
- metadata +14 -10
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# Hum
|
2
2
|
|
3
|
-
Hum generates HTML from your SASS, SCSS or CSS.
|
3
|
+
Hum generates HTML from your SASS, SCSS or CSS. **For now you need Ruby 1.9 and above.**
|
4
4
|
|
5
5
|
`gem install hum`
|
6
6
|
|
7
|
+
If you're using Windows also install this gem.
|
8
|
+
|
9
|
+
`gem install win32console`
|
10
|
+
|
7
11
|
## SASS to HTML
|
8
12
|
|
9
13
|
`hum [stylesheet].sass`
|
data/lib/hum/engine.rb
CHANGED
@@ -286,7 +286,7 @@ module Hum
|
|
286
286
|
hash[:exclude] = true
|
287
287
|
|
288
288
|
#if this is a named mixin
|
289
|
-
elsif code.match(
|
289
|
+
elsif code.match(/^\=/)
|
290
290
|
|
291
291
|
#ignore the hash on output
|
292
292
|
hash[:exclude] = true
|
@@ -380,35 +380,62 @@ module Hum
|
|
380
380
|
tag = tag.gsub("%#", "%div#")
|
381
381
|
end
|
382
382
|
|
383
|
-
#
|
384
|
-
if tag.match(
|
383
|
+
#if anchor with class
|
384
|
+
if tag.match(/%a\./)
|
385
|
+
|
386
|
+
#get the data
|
387
|
+
data = /%a\.(?<tag_class>.*)/.match(tag)
|
388
|
+
|
389
|
+
#make the tag
|
390
|
+
tag = "%a{:href=>'#',:class=>'#{data[:tag_class]}'}"
|
391
|
+
|
392
|
+
#if anchor with ID
|
393
|
+
elsif tag.match(/%a\#/)
|
394
|
+
|
395
|
+
#get the data
|
396
|
+
data = /%a\#(?<tag_id>.*)/.match(tag)
|
397
|
+
|
398
|
+
#make the tag
|
399
|
+
tag = "%a{:href=>'#',:id=>'#{data[:tag_id]}'}"
|
400
|
+
|
401
|
+
#else just give it an link
|
402
|
+
elsif tag.match("%a")
|
385
403
|
tag = tag.gsub("%a", "%a{:href=>'#'}")
|
386
404
|
end
|
387
405
|
|
406
|
+
#if the tag has an attribute selector
|
407
|
+
if tag.match(/%.*\[.*\=.*\]/)
|
408
|
+
|
409
|
+
#get the data
|
410
|
+
data = /(?<tag_element>%.*)\[(?<tag_attribute>.*)\=(?<tag_value>.*)\]/.match(tag)
|
411
|
+
|
412
|
+
tag = data[:tag_element] + "{:#{data[:tag_attribute]}=>'#{data[:tag_value]}'}"
|
413
|
+
#make the tag
|
414
|
+
end
|
415
|
+
|
388
416
|
tag
|
389
417
|
end
|
390
418
|
|
391
419
|
#Output the HAML
|
392
420
|
def _output_haml
|
393
|
-
|
394
421
|
#convert to HAML
|
395
422
|
@haml = "%html\n"
|
396
423
|
@haml += "\t%head\n"
|
397
424
|
@haml += "\t\t%link{:type => 'text/css', :rel => 'stylesheet', :href => '#{@input_name.gsub(/\..*/, ".css")}'}\n"
|
398
425
|
@haml += "\t%body\n"
|
399
|
-
|
426
|
+
|
400
427
|
#time to build the HAML
|
401
428
|
@tree.each do |hash|
|
402
429
|
|
403
430
|
if hash[:exclude] != true
|
404
431
|
|
405
432
|
extra = []
|
406
|
-
|
433
|
+
|
407
434
|
#if there's a parent, find the extra kids
|
408
435
|
if !hash[:parent].nil?
|
409
436
|
extra = @tree.find_extra_kids(hash)
|
410
437
|
end
|
411
|
-
|
438
|
+
|
412
439
|
#for each generate the HAML line
|
413
440
|
hash[:haml].each { |haml_tag|
|
414
441
|
|
data/lib/hum/version.rb
CHANGED
data/test/engine_tests.rb
CHANGED
data/test/haml/anchor_links.haml
CHANGED
data/test/sass/anchor_links.sass
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-23 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sass
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156393620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.12
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156393620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: haml
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156392960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.1.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156392960
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fssm
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156392320 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.2.7
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156392320
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: colored
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156391780 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '1.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156391780
|
58
58
|
description: Hum creates HTML from your sass, scss and css documents. View more info
|
59
59
|
at github.com/jefweg/hum
|
60
60
|
email:
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- test/haml/direct_child.haml
|
86
86
|
- test/haml/exclude_mixins.haml
|
87
87
|
- test/haml/imports.haml
|
88
|
+
- test/haml/input_elements.haml
|
88
89
|
- test/haml/insert_extra_child.haml
|
89
90
|
- test/haml/nested_direct_child.haml
|
90
91
|
- test/haml/nests.haml
|
@@ -102,6 +103,7 @@ files:
|
|
102
103
|
- test/sass/direct_child.sass
|
103
104
|
- test/sass/exclude_mixins.sass
|
104
105
|
- test/sass/imports.sass
|
106
|
+
- test/sass/input_elements.sass
|
105
107
|
- test/sass/insert_extra_child.sass
|
106
108
|
- test/sass/nested_direct_child.sass
|
107
109
|
- test/sass/nests.sass
|
@@ -145,6 +147,7 @@ test_files:
|
|
145
147
|
- test/haml/direct_child.haml
|
146
148
|
- test/haml/exclude_mixins.haml
|
147
149
|
- test/haml/imports.haml
|
150
|
+
- test/haml/input_elements.haml
|
148
151
|
- test/haml/insert_extra_child.haml
|
149
152
|
- test/haml/nested_direct_child.haml
|
150
153
|
- test/haml/nests.haml
|
@@ -162,6 +165,7 @@ test_files:
|
|
162
165
|
- test/sass/direct_child.sass
|
163
166
|
- test/sass/exclude_mixins.sass
|
164
167
|
- test/sass/imports.sass
|
168
|
+
- test/sass/input_elements.sass
|
165
169
|
- test/sass/insert_extra_child.sass
|
166
170
|
- test/sass/nested_direct_child.sass
|
167
171
|
- test/sass/nests.sass
|