nydp-html 0.0.6.1 → 0.0.7
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.
- checksums.yaml +4 -4
 - data/README.md +29 -0
 - data/lib/lisp/tests/html-tag-tests.nydp +32 -0
 - data/lib/lisp/to-html.nydp +21 -1
 - data/lib/nydp/html/version.rb +1 -1
 - data/nydp-html.gemspec +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 66713483a3c6c9f3fd592499c322a9fb608cd5bb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 69a7ddf8287f948918187e36ed5c6ed413c57d7e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 213f6cb41c604eef0f6f27c87de4715ad3a337a84012040f731145db805de389b6e5510f4f3fff06edec76c014324530bef36dbe60317428ad57c5fe482130a2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 638f23055de03498f840bb9683eb57924c9a840e08ebd2b584aa0458425a62a528a9c5ad16c09c4012dd1b9f3dd8ed4f5e4a07705ad8c6983f929b2fa17deb0b
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -62,6 +62,35 @@ interpolations, don't be inhibited: 
     | 
|
| 
       62 
62 
     | 
    
         | 
| 
       63 
63 
     | 
    
         
             
            ```
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
      
 65 
     | 
    
         
            +
            `'nydp-html` also provides haml-like expressions in lisp. Here are some examples from the spec:
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            ```lisp
         
     | 
| 
      
 68 
     | 
    
         
            +
               (%p "hello, world")
         
     | 
| 
      
 69 
     | 
    
         
            +
               "<p>hello, world</p>"
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
               (%p "hello " (%b "you") " over " (%i "there"))
         
     | 
| 
      
 72 
     | 
    
         
            +
               "<p>hello <b>you</b> over <i>there</i></p>"
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
               (%p "hello " (%b.thick "you") " over " (%i "there"))
         
     | 
| 
      
 75 
     | 
    
         
            +
               "<p>hello <b class='thick'>you</b> over <i>there</i></p>"
         
     | 
| 
      
 76 
     | 
    
         
            +
            ```
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            here's a slightly more intricate example:
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            ```lisp
         
     | 
| 
      
 81 
     | 
    
         
            +
            (%tr (map λd(%th.calendar-column d)
         
     | 
| 
      
 82 
     | 
    
         
            +
                      '(mon tue wed thu fri sat sun)))
         
     | 
| 
      
 83 
     | 
    
         
            +
            "<tr>
         
     | 
| 
      
 84 
     | 
    
         
            +
              <th class='calendar-column'>mon</th>
         
     | 
| 
      
 85 
     | 
    
         
            +
              <th class='calendar-column'>tue</th>
         
     | 
| 
      
 86 
     | 
    
         
            +
              <th class='calendar-column'>wed</th>
         
     | 
| 
      
 87 
     | 
    
         
            +
              <th class='calendar-column'>thu</th>
         
     | 
| 
      
 88 
     | 
    
         
            +
              <th class='calendar-column'>fri</th>
         
     | 
| 
      
 89 
     | 
    
         
            +
              <th class='calendar-column'>sat</th>
         
     | 
| 
      
 90 
     | 
    
         
            +
              <th class='calendar-column'>sun</th>
         
     | 
| 
      
 91 
     | 
    
         
            +
            </tr>"
         
     | 
| 
      
 92 
     | 
    
         
            +
            ```
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
       65 
94 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       66 
95 
     | 
    
         | 
| 
       67 
96 
     | 
    
         
             
            1. Fork it ( https://github.com/[my-github-username]/nydp-html/fork )
         
     | 
| 
         @@ -16,3 +16,35 @@ 
     | 
|
| 
       16 
16 
     | 
    
         
             
                       ("returns an anchor tag"
         
     | 
| 
       17 
17 
     | 
    
         
             
                        (link-to "click here!" "/other-page.html" { class "turbo" })
         
     | 
| 
       18 
18 
     | 
    
         
             
                        "<a href='/other-page.html' class='turbo'>click here!</a>"))))
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            (examples-for percent-syntax
         
     | 
| 
      
 21 
     | 
    
         
            +
              ("generates a simple html tag"
         
     | 
| 
      
 22 
     | 
    
         
            +
               (%p "hello, world")
         
     | 
| 
      
 23 
     | 
    
         
            +
               "<p>hello, world</p>")
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              ("generates nested html tags"
         
     | 
| 
      
 26 
     | 
    
         
            +
               (%p "hello " (%b "you") " over " (%i "there"))
         
     | 
| 
      
 27 
     | 
    
         
            +
               "<p>hello <b>you</b> over <i>there</i></p>")
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              ("generates html tags with classnames"
         
     | 
| 
      
 30 
     | 
    
         
            +
               (%p "hello " (%b.thick "you") " over " (%i "there"))
         
     | 
| 
      
 31 
     | 
    
         
            +
               "<p>hello <b class='thick'>you</b> over <i>there</i></p>"))
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            (examples-for prefix-list
         
     | 
| 
      
 34 
     | 
    
         
            +
              ("generates a simple html tag with attributes"
         
     | 
| 
      
 35 
     | 
    
         
            +
                (%a(href "/fr/index") "click here")
         
     | 
| 
      
 36 
     | 
    
         
            +
                "<a href='/fr/index'>click here</a>")
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              ("generates nested html tags with attributes"
         
     | 
| 
      
 39 
     | 
    
         
            +
               (%p(class 'important)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  "read this and "
         
     | 
| 
      
 41 
     | 
    
         
            +
                  (%a(href "/fr/index") "click here")
         
     | 
| 
      
 42 
     | 
    
         
            +
                  "!")
         
     | 
| 
      
 43 
     | 
    
         
            +
                "<p class='important'>read this and <a href='/fr/index'>click here</a>!</p>")
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              ("generates nested html tags with classnames and other attributes"
         
     | 
| 
      
 46 
     | 
    
         
            +
               (%p(class 'important)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  "read this and "
         
     | 
| 
      
 48 
     | 
    
         
            +
                  (%a.wow(href "/fr/index") "click here")
         
     | 
| 
      
 49 
     | 
    
         
            +
                  "!")
         
     | 
| 
      
 50 
     | 
    
         
            +
                "<p class='important'>read this and <a class='wow' href='/fr/index'>click here</a>!</p>"))
         
     | 
    
        data/lib/lisp/to-html.nydp
    CHANGED
    
    | 
         @@ -62,4 +62,24 @@ 
     | 
|
| 
       62 
62 
     | 
    
         
             
            (def html-tag/ (name attrs) "<~|name|~(as-tag-attrs attrs)/>")
         
     | 
| 
       63 
63 
     | 
    
         
             
            (def html-tag (name attrs . content) "<~|name|~(as-tag-attrs attrs)>~(apply joinstr "" content)</~|name|>")
         
     | 
| 
       64 
64 
     | 
    
         
             
            (def img (src)                (html-tag/ "img" { src src }))
         
     | 
| 
       65 
     | 
    
         
            -
            (def link-to (txt path attrs) (html-tag "a" (hash-merge { href path } attrs) txt))
         
     | 
| 
      
 65 
     | 
    
         
            +
            (def link-to (txt path attrs) (html-tag "a" (hash-merge { href path } (or attrs (hash))) txt))
         
     | 
| 
      
 66 
     | 
    
         
            +
            (def html-tag-fn (name attrs) (fn content (apply html-tag name attrs content)))
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            (def build-html-tag-fn (tagname attrs)
         
     | 
| 
      
 69 
     | 
    
         
            +
              `(curry html-tag ',tagname (brace-list ,@attrs)))
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            (def html-percent-syntax (tagname attrs)
         
     | 
| 
      
 72 
     | 
    
         
            +
              (if (caris 'dot-syntax tagname)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  (let dot-params (cdr tagname)
         
     | 
| 
      
 74 
     | 
    
         
            +
                    (build-html-tag-fn (car dot-params)
         
     | 
| 
      
 75 
     | 
    
         
            +
                                       (+ `(class ,(joinstr " " (cdr dot-params))) attrs)))
         
     | 
| 
      
 76 
     | 
    
         
            +
                  (build-html-tag-fn tagname attrs)))
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            (mac percent-syntax names
         
     | 
| 
      
 79 
     | 
    
         
            +
              (html-percent-syntax (cadr names) nil))
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            (define-prefix-list-macro "^%.+" vars expr
         
     | 
| 
      
 82 
     | 
    
         
            +
              ; allows (%a(href "/fr/index") "click" name)
         
     | 
| 
      
 83 
     | 
    
         
            +
              ; as shortcut for (html-tag "a" { href "/fr/index" } "click " name)
         
     | 
| 
      
 84 
     | 
    
         
            +
              (let tag-name (car:parse:joinstr "" (cdr:string-split vars))
         
     | 
| 
      
 85 
     | 
    
         
            +
                (html-percent-syntax tag-name expr)))
         
     | 
    
        data/lib/nydp/html/version.rb
    CHANGED
    
    
    
        data/nydp-html.gemspec
    CHANGED
    
    | 
         @@ -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.1'
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_dependency             'nydp',    '~> 0.1.4'
         
     | 
| 
       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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.7
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-11-06 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:  
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 0.1.4
         
     | 
| 
       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:  
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 0.1.4
         
     | 
| 
       83 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
84 
     | 
    
         
             
              name: haml
         
     | 
| 
       85 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |