hamljsx 0.1.1 → 0.1.2
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/lib/engine.rb +15 -2
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9e24ded7802979e3ce7debe51b3d34d5f7008498
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f2591eb80c22cd5b363b2c399bacad4aa6a41dc8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 739a50c010d77078cb41429d103d35791c359fb17ba091c172c22541c15c78de870c622277d62e56b1f7155ba9c468f7257a2073abcbba2ea7b82fe1ff17b8ce
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c2f4f4c2f8b32403b21b9485939899ec0bcbceff81079ea8dcb02cc881b322b7822fed66194030e583fd4e963809fb2e7b1586eeec9c7a159222f59517602734
         
     | 
    
        data/lib/engine.rb
    CHANGED
    
    | 
         @@ -18,7 +18,7 @@ class HamlJsxEngine 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    offset = idx_end + MARKER_END.length
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                    haml = data[(idx_start + MARKER_START.length)..(idx_end-1)]
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       22 
22 
     | 
    
         
             
                    # Escape { } so they'll survive the HAML render
         
     | 
| 
       23 
23 
     | 
    
         
             
                    haml.gsub!(/\{/,"'{")
         
     | 
| 
       24 
24 
     | 
    
         
             
                    haml.gsub!(/\}/,"}'")
         
     | 
| 
         @@ -34,11 +34,24 @@ class HamlJsxEngine 
     | 
|
| 
       34 
34 
     | 
    
         
             
                    haml.gsub!(/^\s*\/\/.*$/,'')
         
     | 
| 
       35 
35 
     | 
    
         
             
                    haml.gsub!(/\/\*.*?\*\//,'')
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
      
 37 
     | 
    
         
            +
                    # p haml
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       37 
39 
     | 
    
         
             
                    html = Haml::Engine.new(haml).render
         
     | 
| 
       38 
40 
     | 
    
         
             
                    html.gsub!("class=","className=")
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    # p html
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    html.gsub!(/\'\{/,"{")
         
     | 
| 
       40 
45 
     | 
    
         
             
                    html.gsub!(/\}\'/,"}")
         
     | 
| 
       41 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
                    # Make JSX spacing consistent with Rails/Haml spacing
         
     | 
| 
      
 48 
     | 
    
         
            +
                    html.gsub!(/([^>] *)\n(\s*[^< ])/,'\1{\' \'}\2')
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    # For adding spaces before spans, divs, etc. Not supported for more flexibility
         
     | 
| 
      
 51 
     | 
    
         
            +
                    # html.gsub!(/([^>] *)\n((?!(\s*<\/)))/,'\1{\' \'}\2')
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                    # p html
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       42 
55 
     | 
    
         
             
                    result += html
         
     | 
| 
       43 
56 
     | 
    
         
             
                  else
         
     | 
| 
       44 
57 
     | 
    
         
             
                    result += data[offset..-1]
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hamljsx
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Dan Hassin
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-01-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: Inline Haml in JSX just like HTML, using (~ and ~) delimeters. Rather
         
     | 
| 
       14 
14 
     | 
    
         
             
              limited still.
         
     | 
| 
         @@ -20,7 +20,7 @@ extra_rdoc_files: [] 
     | 
|
| 
       20 
20 
     | 
    
         
             
            files:
         
     | 
| 
       21 
21 
     | 
    
         
             
            - lib/hamljsx.rb
         
     | 
| 
       22 
22 
     | 
    
         
             
            - lib/engine.rb
         
     | 
| 
       23 
     | 
    
         
            -
            homepage:  
     | 
| 
      
 23 
     | 
    
         
            +
            homepage: https://github.com/dingbat/hamljsx
         
     | 
| 
       24 
24 
     | 
    
         
             
            licenses:
         
     | 
| 
       25 
25 
     | 
    
         
             
            - license.md
         
     | 
| 
       26 
26 
     | 
    
         
             
            metadata: {}
         
     |