nydp-html 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 582943cc0cc6d9903b8b0d02c8e73abc15537867
4
- data.tar.gz: 80f5a959d8673b4cba45780ddfaa8ffd3082173b
3
+ metadata.gz: 8fe3d466c6715379afd8d86097c281ff3d8160b9
4
+ data.tar.gz: 53f72b3ca8999c3e620e91d0f0217b534d956b7e
5
5
  SHA512:
6
- metadata.gz: 41533c53511e93911b827cecb15a063241d011ac15877711fdb88c2f3692185a1f887a58f7f69e019cb791bf6130fbfe5f7896c5e6bcff2fa26848a5d119c702
7
- data.tar.gz: b58e56fecc8f5642fe08c9cb2ffce0311f1d76e397bb93ecc98c46c4d3d28edbe6be7e38b430bf076cb210926dcb81f4ce7190ec4ded9713acbe49ce9e233cf1
6
+ metadata.gz: 3c90ac967f80d3a1876679ed0cc75255b057d7628aab54ebcdcd39e94380323a33a267b3ea9d65d72431b09cdb3faa061e436a89446b758fb41f10d03c4b6d65
7
+ data.tar.gz: 648d435dfacb619a167d710b173c7040d4de9529a73bbbd4682dfa7f2a6534db6020e20378835fe71c9b0b2453a64d041cc14c14d200c4bb8df6e70547dd6c5a
@@ -0,0 +1,18 @@
1
+ (register-test
2
+ '(suite "html-tag functions"
3
+ (suite "html-tag"
4
+ ("returns a html string"
5
+ (html-tag "div" { class 'yellow style (to-css { border "1px solid blue" font-size "3em" }) }
6
+ (html-tag "h1" nil "Welcome")
7
+ (html-tag "p" { class "yadda" } "blah blah"))
8
+ "<div class='yellow' style='border:1px solid blue;font-size:3em;'><h1>Welcome</h1><p class='yadda'>blah blah</p></div>"))
9
+
10
+ (suite "img"
11
+ ("returns an img tag"
12
+ (img "/assets/face.png")
13
+ "<img src='/assets/face.png'/>"))
14
+
15
+ (suite "a"
16
+ ("returns an anchor tag"
17
+ (link-to "click here!" "/other-page.html" { class "turbo" })
18
+ "<a href='/other-page.html'>click here!</a>"))))
@@ -45,3 +45,21 @@
45
45
  (eq? 'string-pieces (car arg)))
46
46
  (html-build-interpolator (cdr arg) { method textile-to-html esc "==" })
47
47
  `(textile-to-html ,arg)))
48
+
49
+ (def to-css-rule (prop val) (joinstr "" prop ":" val ";"))
50
+
51
+ (def to-css (hsh)
52
+ (and hsh
53
+ (joinstr "" (map (fn (k) (to-css-rule k hsh.,k))
54
+ (hash-keys hsh)))))
55
+
56
+ (def as-tag-attrs (attrs)
57
+ (let hsh (or attrs (hash))
58
+ (joinstr ""
59
+ (map (fn (k) " ~|k|='~(joinstr " " hsh.,k)'")
60
+ (hash-keys hsh)))))
61
+
62
+ (def html-tag/ (name attrs) "<~|name|~(as-tag-attrs attrs)/>")
63
+ (def html-tag (name attrs . content) "<~|name|~(as-tag-attrs attrs)>~(apply joinstr "" content)</~|name|>")
64
+ (def img (src) (html-tag/ "img" { src src }))
65
+ (def link-to (txt path attrs) (html-tag "a" { href path } txt))
@@ -1,5 +1,5 @@
1
1
  module Nydp
2
2
  module Html
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Conan Dalton"]
10
10
  spec.email = ["conan@conandalton.net"]
11
11
  spec.summary = %q{nydp interface for HAML and Textile}
12
- spec.description = %q{provides 'render-textile-to-html and 'render-haml-to-html functions}
12
+ spec.description = %q{provides 'render-as-haml and 'render-as-textile functions}
13
13
  spec.homepage = "http://github.com/conanite/nydp-html"
14
14
  spec.license = "MIT"
15
15
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'rspec', '~> 2.9'
25
25
  spec.add_development_dependency 'rspec_numbering_formatter'
26
26
 
27
- spec.add_dependency 'nydp', '~> 0.0.12'
27
+ spec.add_dependency 'nydp', '~> 0.1'
28
28
  spec.add_dependency 'haml', '~> 4.0'
29
29
  spec.add_dependency 'RedCloth'
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nydp-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.12
75
+ version: '0.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.0.12
82
+ version: '0.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: haml
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description: provides 'render-textile-to-html and 'render-haml-to-html functions
111
+ description: provides 'render-as-haml and 'render-as-textile functions
112
112
  email:
113
113
  - conan@conandalton.net
114
114
  executables:
@@ -124,6 +124,7 @@ files:
124
124
  - bin/nydp-tests
125
125
  - lib/lisp/haml.nydp
126
126
  - lib/lisp/tests/haml-tests.nydp
127
+ - lib/lisp/tests/html-tag-tests.nydp
127
128
  - lib/lisp/tests/textile-tests.nydp
128
129
  - lib/lisp/to-html.nydp
129
130
  - lib/nydp/html.rb