haml_parser 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +4 -0
 - data/README.md +5 -4
 - data/lib/haml_parser/ast.rb +15 -2
 - data/lib/haml_parser/element_parser.rb +2 -10
 - data/lib/haml_parser/version.rb +1 -1
 - 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: 9b06a7a145edcaee2bae05feafbd265c680a8e54
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 70e85219456f494d6d3d0f8f337727ecbbede342
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 88b446fd2edd5507ec973dd5926fc8b12b118c4e07f30bcb93a080d546905095ff87c08e683535d648b8801452d06188e1b9a41685911e356e2215a1545c206d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 65583c26a71fe5890e5f78dc9f885b17b9c5c169f8cb6ff95767971c50e82b7d3f8ae2f64f3a967b1612216db5590d7bdfe140fd5189d1fd22f52ae9b135d961
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -42,17 +42,19 @@ Simple CLI interface is also available. 
     | 
|
| 
       42 
42 
     | 
    
         
             
                tag_name="p",
         
     | 
| 
       43 
43 
     | 
    
         
             
                static_class="",
         
     | 
| 
       44 
44 
     | 
    
         
             
                static_id="",
         
     | 
| 
       45 
     | 
    
         
            -
                 
     | 
| 
      
 45 
     | 
    
         
            +
                old_attributes=nil,
         
     | 
| 
      
 46 
     | 
    
         
            +
                new_attributes=nil,
         
     | 
| 
       46 
47 
     | 
    
         
             
                oneline_child=
         
     | 
| 
       47 
48 
     | 
    
         
             
                 #<struct HamlParser::Ast::Text
         
     | 
| 
       48 
49 
     | 
    
         
             
                  text="hello world",
         
     | 
| 
       49 
50 
     | 
    
         
             
                  escape_html=true,
         
     | 
| 
       50 
     | 
    
         
            -
                  filename=" 
     | 
| 
      
 51 
     | 
    
         
            +
                  filename="input.haml",
         
     | 
| 
       51 
52 
     | 
    
         
             
                  lineno=1>,
         
     | 
| 
       52 
53 
     | 
    
         
             
                self_closing=false,
         
     | 
| 
       53 
54 
     | 
    
         
             
                nuke_inner_whitespace=false,
         
     | 
| 
       54 
55 
     | 
    
         
             
                nuke_outer_whitespace=false,
         
     | 
| 
       55 
     | 
    
         
            -
                 
     | 
| 
      
 56 
     | 
    
         
            +
                object_ref=nil,
         
     | 
| 
      
 57 
     | 
    
         
            +
                filename="input.haml",
         
     | 
| 
       56 
58 
     | 
    
         
             
                lineno=1>]>
         
     | 
| 
       57 
59 
     | 
    
         
             
            ```
         
     | 
| 
       58 
60 
     | 
    
         | 
| 
         @@ -70,4 +72,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/eaglet 
     | 
|
| 
       70 
72 
     | 
    
         
             
            ## License
         
     | 
| 
       71 
73 
     | 
    
         | 
| 
       72 
74 
     | 
    
         
             
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
    
        data/lib/haml_parser/ast.rb
    CHANGED
    
    | 
         @@ -34,7 +34,8 @@ module HamlParser 
     | 
|
| 
       34 
34 
     | 
    
         
             
                  :tag_name,
         
     | 
| 
       35 
35 
     | 
    
         
             
                  :static_class,
         
     | 
| 
       36 
36 
     | 
    
         
             
                  :static_id,
         
     | 
| 
       37 
     | 
    
         
            -
                  : 
     | 
| 
      
 37 
     | 
    
         
            +
                  :old_attributes,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :new_attributes,
         
     | 
| 
       38 
39 
     | 
    
         
             
                  :oneline_child,
         
     | 
| 
       39 
40 
     | 
    
         
             
                  :self_closing,
         
     | 
| 
       40 
41 
     | 
    
         
             
                  :nuke_inner_whitespace,
         
     | 
| 
         @@ -49,7 +50,6 @@ module HamlParser 
     | 
|
| 
       49 
50 
     | 
    
         
             
                    super
         
     | 
| 
       50 
51 
     | 
    
         
             
                    self.static_class ||= ''
         
     | 
| 
       51 
52 
     | 
    
         
             
                    self.static_id ||= ''
         
     | 
| 
       52 
     | 
    
         
            -
                    self.attributes ||= ''
         
     | 
| 
       53 
53 
     | 
    
         
             
                    self.self_closing ||= false
         
     | 
| 
       54 
54 
     | 
    
         
             
                    self.nuke_inner_whitespace ||= false
         
     | 
| 
       55 
55 
     | 
    
         
             
                    self.nuke_outer_whitespace ||= false
         
     | 
| 
         @@ -61,6 +61,19 @@ module HamlParser 
     | 
|
| 
       61 
61 
     | 
    
         
             
                      oneline_child: oneline_child && oneline_child.to_h,
         
     | 
| 
       62 
62 
     | 
    
         
             
                    )
         
     | 
| 
       63 
63 
     | 
    
         
             
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                  # XXX: For compatibility
         
     | 
| 
      
 66 
     | 
    
         
            +
                  def attributes
         
     | 
| 
      
 67 
     | 
    
         
            +
                    attrs = old_attributes || ''
         
     | 
| 
      
 68 
     | 
    
         
            +
                    if new_attributes
         
     | 
| 
      
 69 
     | 
    
         
            +
                      if attrs.empty?
         
     | 
| 
      
 70 
     | 
    
         
            +
                        attrs = new_attributes
         
     | 
| 
      
 71 
     | 
    
         
            +
                      else
         
     | 
| 
      
 72 
     | 
    
         
            +
                        attrs += ", #{new_attributes}"
         
     | 
| 
      
 73 
     | 
    
         
            +
                      end
         
     | 
| 
      
 74 
     | 
    
         
            +
                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
                    attrs
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
       64 
77 
     | 
    
         
             
                end
         
     | 
| 
       65 
78 
     | 
    
         | 
| 
       66 
79 
     | 
    
         
             
                Script = Struct.new(
         
     | 
| 
         @@ -26,7 +26,7 @@ module HamlParser 
     | 
|
| 
       26 
26 
     | 
    
         
             
                  element.static_class, element.static_id = parse_class_and_id(m[2])
         
     | 
| 
       27 
27 
     | 
    
         
             
                  rest = m[3] || ''
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                  element. 
     | 
| 
      
 29 
     | 
    
         
            +
                  element.old_attributes, element.new_attributes, element.object_ref, rest = parse_attributes(rest)
         
     | 
| 
       30 
30 
     | 
    
         
             
                  element.nuke_inner_whitespace, element.nuke_outer_whitespace, rest = parse_nuke_whitespace(rest)
         
     | 
| 
       31 
31 
     | 
    
         
             
                  element.self_closing, rest = parse_self_closing(rest)
         
     | 
| 
       32 
32 
     | 
    
         
             
                  element.oneline_child = ScriptParser.new(@line_parser).parse(rest)
         
     | 
| 
         @@ -86,15 +86,7 @@ module HamlParser 
     | 
|
| 
       86 
86 
     | 
    
         
             
                    end
         
     | 
| 
       87 
87 
     | 
    
         
             
                  end
         
     | 
| 
       88 
88 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                   
     | 
| 
       90 
     | 
    
         
            -
                  if new_attributes
         
     | 
| 
       91 
     | 
    
         
            -
                    if attributes.empty?
         
     | 
| 
       92 
     | 
    
         
            -
                      attributes = new_attributes
         
     | 
| 
       93 
     | 
    
         
            -
                    else
         
     | 
| 
       94 
     | 
    
         
            -
                      attributes << ', ' << new_attributes
         
     | 
| 
       95 
     | 
    
         
            -
                    end
         
     | 
| 
       96 
     | 
    
         
            -
                  end
         
     | 
| 
       97 
     | 
    
         
            -
                  [attributes, object_ref, rest]
         
     | 
| 
      
 89 
     | 
    
         
            +
                  [old_attributes, new_attributes, object_ref, rest]
         
     | 
| 
       98 
90 
     | 
    
         
             
                end
         
     | 
| 
       99 
91 
     | 
    
         | 
| 
       100 
92 
     | 
    
         
             
                def parse_old_attributes(text)
         
     | 
    
        data/lib/haml_parser/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: haml_parser
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kohei Suzuki
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-11-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: benchmark-ips
         
     | 
| 
         @@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       191 
191 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       192 
192 
     | 
    
         
             
            requirements: []
         
     | 
| 
       193 
193 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       194 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 194 
     | 
    
         
            +
            rubygems_version: 2.5.0
         
     | 
| 
       195 
195 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       196 
196 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       197 
197 
     | 
    
         
             
            summary: Parser of Haml template language
         
     |