liquid 3.0.6 → 5.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 +5 -5
 - data/History.md +243 -58
 - data/README.md +43 -4
 - data/lib/liquid/block.rb +57 -123
 - data/lib/liquid/block_body.rb +217 -85
 - data/lib/liquid/condition.rb +92 -45
 - data/lib/liquid/context.rb +154 -89
 - data/lib/liquid/document.rb +57 -9
 - data/lib/liquid/drop.rb +20 -17
 - data/lib/liquid/errors.rb +27 -29
 - data/lib/liquid/expression.rb +32 -20
 - data/lib/liquid/extensions.rb +21 -7
 - data/lib/liquid/file_system.rb +17 -15
 - data/lib/liquid/forloop_drop.rb +92 -0
 - data/lib/liquid/i18n.rb +10 -8
 - data/lib/liquid/interrupts.rb +4 -3
 - data/lib/liquid/lexer.rb +37 -26
 - data/lib/liquid/locales/en.yml +13 -6
 - data/lib/liquid/parse_context.rb +54 -0
 - data/lib/liquid/parse_tree_visitor.rb +42 -0
 - data/lib/liquid/parser.rb +30 -18
 - data/lib/liquid/parser_switching.rb +20 -6
 - data/lib/liquid/partial_cache.rb +24 -0
 - data/lib/liquid/profiler/hooks.rb +26 -14
 - data/lib/liquid/profiler.rb +72 -92
 - data/lib/liquid/range_lookup.rb +28 -3
 - data/lib/liquid/registers.rb +51 -0
 - data/lib/liquid/resource_limits.rb +62 -0
 - data/lib/liquid/standardfilters.rb +715 -132
 - data/lib/liquid/strainer_factory.rb +41 -0
 - data/lib/liquid/strainer_template.rb +62 -0
 - data/lib/liquid/tablerowloop_drop.rb +121 -0
 - data/lib/liquid/tag/disableable.rb +22 -0
 - data/lib/liquid/tag/disabler.rb +21 -0
 - data/lib/liquid/tag.rb +35 -12
 - data/lib/liquid/tags/assign.rb +57 -18
 - data/lib/liquid/tags/break.rb +15 -5
 - data/lib/liquid/tags/capture.rb +24 -18
 - data/lib/liquid/tags/case.rb +79 -30
 - data/lib/liquid/tags/comment.rb +19 -4
 - data/lib/liquid/tags/continue.rb +16 -12
 - data/lib/liquid/tags/cycle.rb +47 -27
 - data/lib/liquid/tags/decrement.rb +23 -24
 - data/lib/liquid/tags/echo.rb +41 -0
 - data/lib/liquid/tags/for.rb +155 -124
 - data/lib/liquid/tags/if.rb +97 -63
 - data/lib/liquid/tags/ifchanged.rb +11 -12
 - data/lib/liquid/tags/include.rb +82 -73
 - data/lib/liquid/tags/increment.rb +23 -17
 - data/lib/liquid/tags/inline_comment.rb +43 -0
 - data/lib/liquid/tags/raw.rb +50 -8
 - data/lib/liquid/tags/render.rb +109 -0
 - data/lib/liquid/tags/table_row.rb +57 -41
 - data/lib/liquid/tags/unless.rb +38 -20
 - data/lib/liquid/template.rb +71 -103
 - data/lib/liquid/template_factory.rb +9 -0
 - data/lib/liquid/tokenizer.rb +39 -0
 - data/lib/liquid/usage.rb +8 -0
 - data/lib/liquid/utils.rb +63 -9
 - data/lib/liquid/variable.rb +74 -56
 - data/lib/liquid/variable_lookup.rb +31 -15
 - data/lib/liquid/version.rb +3 -1
 - data/lib/liquid.rb +27 -12
 - metadata +30 -106
 - data/lib/liquid/module_ex.rb +0 -62
 - data/lib/liquid/strainer.rb +0 -59
 - data/lib/liquid/token.rb +0 -18
 - data/test/fixtures/en_locale.yml +0 -9
 - data/test/integration/assign_test.rb +0 -48
 - data/test/integration/blank_test.rb +0 -106
 - data/test/integration/capture_test.rb +0 -50
 - data/test/integration/context_test.rb +0 -32
 - data/test/integration/drop_test.rb +0 -271
 - data/test/integration/error_handling_test.rb +0 -207
 - data/test/integration/filter_test.rb +0 -138
 - data/test/integration/hash_ordering_test.rb +0 -23
 - data/test/integration/output_test.rb +0 -124
 - data/test/integration/parsing_quirks_test.rb +0 -116
 - data/test/integration/render_profiling_test.rb +0 -154
 - data/test/integration/security_test.rb +0 -64
 - data/test/integration/standard_filter_test.rb +0 -396
 - data/test/integration/tags/break_tag_test.rb +0 -16
 - data/test/integration/tags/continue_tag_test.rb +0 -16
 - data/test/integration/tags/for_tag_test.rb +0 -375
 - data/test/integration/tags/if_else_tag_test.rb +0 -190
 - data/test/integration/tags/include_tag_test.rb +0 -234
 - data/test/integration/tags/increment_tag_test.rb +0 -24
 - data/test/integration/tags/raw_tag_test.rb +0 -25
 - data/test/integration/tags/standard_tag_test.rb +0 -297
 - data/test/integration/tags/statements_test.rb +0 -113
 - data/test/integration/tags/table_row_test.rb +0 -63
 - data/test/integration/tags/unless_else_tag_test.rb +0 -26
 - data/test/integration/template_test.rb +0 -182
 - data/test/integration/variable_test.rb +0 -82
 - data/test/test_helper.rb +0 -89
 - data/test/unit/block_unit_test.rb +0 -55
 - data/test/unit/condition_unit_test.rb +0 -149
 - data/test/unit/context_unit_test.rb +0 -492
 - data/test/unit/file_system_unit_test.rb +0 -35
 - data/test/unit/i18n_unit_test.rb +0 -37
 - data/test/unit/lexer_unit_test.rb +0 -48
 - data/test/unit/module_ex_unit_test.rb +0 -87
 - data/test/unit/parser_unit_test.rb +0 -82
 - data/test/unit/regexp_unit_test.rb +0 -44
 - data/test/unit/strainer_unit_test.rb +0 -69
 - data/test/unit/tag_unit_test.rb +0 -16
 - data/test/unit/tags/case_tag_unit_test.rb +0 -10
 - data/test/unit/tags/for_tag_unit_test.rb +0 -13
 - data/test/unit/tags/if_tag_unit_test.rb +0 -8
 - data/test/unit/template_unit_test.rb +0 -69
 - data/test/unit/tokenizer_unit_test.rb +0 -38
 - data/test/unit/variable_unit_test.rb +0 -145
 - /data/{MIT-LICENSE → LICENSE} +0 -0
 
    
        metadata
    CHANGED
    
    | 
         @@ -1,29 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: liquid
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 5.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
     | 
    
         
            -
            - Tobias  
     | 
| 
      
 7 
     | 
    
         
            +
            - Tobias Lütke
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-07-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - - " 
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '13.0'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :development
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - - " 
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: '0'
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '13.0'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: minitest
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -48,7 +48,7 @@ extra_rdoc_files: 
     | 
|
| 
       48 
48 
     | 
    
         
             
            - README.md
         
     | 
| 
       49 
49 
     | 
    
         
             
            files:
         
     | 
| 
       50 
50 
     | 
    
         
             
            - History.md
         
     | 
| 
       51 
     | 
    
         
            -
            -  
     | 
| 
      
 51 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
       52 
52 
     | 
    
         
             
            - README.md
         
     | 
| 
       53 
53 
     | 
    
         
             
            - lib/liquid.rb
         
     | 
| 
       54 
54 
     | 
    
         
             
            - lib/liquid/block.rb
         
     | 
| 
         @@ -61,19 +61,28 @@ files: 
     | 
|
| 
       61 
61 
     | 
    
         
             
            - lib/liquid/expression.rb
         
     | 
| 
       62 
62 
     | 
    
         
             
            - lib/liquid/extensions.rb
         
     | 
| 
       63 
63 
     | 
    
         
             
            - lib/liquid/file_system.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/liquid/forloop_drop.rb
         
     | 
| 
       64 
65 
     | 
    
         
             
            - lib/liquid/i18n.rb
         
     | 
| 
       65 
66 
     | 
    
         
             
            - lib/liquid/interrupts.rb
         
     | 
| 
       66 
67 
     | 
    
         
             
            - lib/liquid/lexer.rb
         
     | 
| 
       67 
68 
     | 
    
         
             
            - lib/liquid/locales/en.yml
         
     | 
| 
       68 
     | 
    
         
            -
            - lib/liquid/ 
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/liquid/parse_context.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib/liquid/parse_tree_visitor.rb
         
     | 
| 
       69 
71 
     | 
    
         
             
            - lib/liquid/parser.rb
         
     | 
| 
       70 
72 
     | 
    
         
             
            - lib/liquid/parser_switching.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/liquid/partial_cache.rb
         
     | 
| 
       71 
74 
     | 
    
         
             
            - lib/liquid/profiler.rb
         
     | 
| 
       72 
75 
     | 
    
         
             
            - lib/liquid/profiler/hooks.rb
         
     | 
| 
       73 
76 
     | 
    
         
             
            - lib/liquid/range_lookup.rb
         
     | 
| 
      
 77 
     | 
    
         
            +
            - lib/liquid/registers.rb
         
     | 
| 
      
 78 
     | 
    
         
            +
            - lib/liquid/resource_limits.rb
         
     | 
| 
       74 
79 
     | 
    
         
             
            - lib/liquid/standardfilters.rb
         
     | 
| 
       75 
     | 
    
         
            -
            - lib/liquid/ 
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/liquid/strainer_factory.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - lib/liquid/strainer_template.rb
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib/liquid/tablerowloop_drop.rb
         
     | 
| 
       76 
83 
     | 
    
         
             
            - lib/liquid/tag.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/liquid/tag/disableable.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - lib/liquid/tag/disabler.rb
         
     | 
| 
       77 
86 
     | 
    
         
             
            - lib/liquid/tags/assign.rb
         
     | 
| 
       78 
87 
     | 
    
         
             
            - lib/liquid/tags/break.rb
         
     | 
| 
       79 
88 
     | 
    
         
             
            - lib/liquid/tags/capture.rb
         
     | 
| 
         @@ -82,69 +91,30 @@ files: 
     | 
|
| 
       82 
91 
     | 
    
         
             
            - lib/liquid/tags/continue.rb
         
     | 
| 
       83 
92 
     | 
    
         
             
            - lib/liquid/tags/cycle.rb
         
     | 
| 
       84 
93 
     | 
    
         
             
            - lib/liquid/tags/decrement.rb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - lib/liquid/tags/echo.rb
         
     | 
| 
       85 
95 
     | 
    
         
             
            - lib/liquid/tags/for.rb
         
     | 
| 
       86 
96 
     | 
    
         
             
            - lib/liquid/tags/if.rb
         
     | 
| 
       87 
97 
     | 
    
         
             
            - lib/liquid/tags/ifchanged.rb
         
     | 
| 
       88 
98 
     | 
    
         
             
            - lib/liquid/tags/include.rb
         
     | 
| 
       89 
99 
     | 
    
         
             
            - lib/liquid/tags/increment.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib/liquid/tags/inline_comment.rb
         
     | 
| 
       90 
101 
     | 
    
         
             
            - lib/liquid/tags/raw.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/liquid/tags/render.rb
         
     | 
| 
       91 
103 
     | 
    
         
             
            - lib/liquid/tags/table_row.rb
         
     | 
| 
       92 
104 
     | 
    
         
             
            - lib/liquid/tags/unless.rb
         
     | 
| 
       93 
105 
     | 
    
         
             
            - lib/liquid/template.rb
         
     | 
| 
       94 
     | 
    
         
            -
            - lib/liquid/ 
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/liquid/template_factory.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/liquid/tokenizer.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/liquid/usage.rb
         
     | 
| 
       95 
109 
     | 
    
         
             
            - lib/liquid/utils.rb
         
     | 
| 
       96 
110 
     | 
    
         
             
            - lib/liquid/variable.rb
         
     | 
| 
       97 
111 
     | 
    
         
             
            - lib/liquid/variable_lookup.rb
         
     | 
| 
       98 
112 
     | 
    
         
             
            - lib/liquid/version.rb
         
     | 
| 
       99 
     | 
    
         
            -
            - test/fixtures/en_locale.yml
         
     | 
| 
       100 
     | 
    
         
            -
            - test/integration/assign_test.rb
         
     | 
| 
       101 
     | 
    
         
            -
            - test/integration/blank_test.rb
         
     | 
| 
       102 
     | 
    
         
            -
            - test/integration/capture_test.rb
         
     | 
| 
       103 
     | 
    
         
            -
            - test/integration/context_test.rb
         
     | 
| 
       104 
     | 
    
         
            -
            - test/integration/drop_test.rb
         
     | 
| 
       105 
     | 
    
         
            -
            - test/integration/error_handling_test.rb
         
     | 
| 
       106 
     | 
    
         
            -
            - test/integration/filter_test.rb
         
     | 
| 
       107 
     | 
    
         
            -
            - test/integration/hash_ordering_test.rb
         
     | 
| 
       108 
     | 
    
         
            -
            - test/integration/output_test.rb
         
     | 
| 
       109 
     | 
    
         
            -
            - test/integration/parsing_quirks_test.rb
         
     | 
| 
       110 
     | 
    
         
            -
            - test/integration/render_profiling_test.rb
         
     | 
| 
       111 
     | 
    
         
            -
            - test/integration/security_test.rb
         
     | 
| 
       112 
     | 
    
         
            -
            - test/integration/standard_filter_test.rb
         
     | 
| 
       113 
     | 
    
         
            -
            - test/integration/tags/break_tag_test.rb
         
     | 
| 
       114 
     | 
    
         
            -
            - test/integration/tags/continue_tag_test.rb
         
     | 
| 
       115 
     | 
    
         
            -
            - test/integration/tags/for_tag_test.rb
         
     | 
| 
       116 
     | 
    
         
            -
            - test/integration/tags/if_else_tag_test.rb
         
     | 
| 
       117 
     | 
    
         
            -
            - test/integration/tags/include_tag_test.rb
         
     | 
| 
       118 
     | 
    
         
            -
            - test/integration/tags/increment_tag_test.rb
         
     | 
| 
       119 
     | 
    
         
            -
            - test/integration/tags/raw_tag_test.rb
         
     | 
| 
       120 
     | 
    
         
            -
            - test/integration/tags/standard_tag_test.rb
         
     | 
| 
       121 
     | 
    
         
            -
            - test/integration/tags/statements_test.rb
         
     | 
| 
       122 
     | 
    
         
            -
            - test/integration/tags/table_row_test.rb
         
     | 
| 
       123 
     | 
    
         
            -
            - test/integration/tags/unless_else_tag_test.rb
         
     | 
| 
       124 
     | 
    
         
            -
            - test/integration/template_test.rb
         
     | 
| 
       125 
     | 
    
         
            -
            - test/integration/variable_test.rb
         
     | 
| 
       126 
     | 
    
         
            -
            - test/test_helper.rb
         
     | 
| 
       127 
     | 
    
         
            -
            - test/unit/block_unit_test.rb
         
     | 
| 
       128 
     | 
    
         
            -
            - test/unit/condition_unit_test.rb
         
     | 
| 
       129 
     | 
    
         
            -
            - test/unit/context_unit_test.rb
         
     | 
| 
       130 
     | 
    
         
            -
            - test/unit/file_system_unit_test.rb
         
     | 
| 
       131 
     | 
    
         
            -
            - test/unit/i18n_unit_test.rb
         
     | 
| 
       132 
     | 
    
         
            -
            - test/unit/lexer_unit_test.rb
         
     | 
| 
       133 
     | 
    
         
            -
            - test/unit/module_ex_unit_test.rb
         
     | 
| 
       134 
     | 
    
         
            -
            - test/unit/parser_unit_test.rb
         
     | 
| 
       135 
     | 
    
         
            -
            - test/unit/regexp_unit_test.rb
         
     | 
| 
       136 
     | 
    
         
            -
            - test/unit/strainer_unit_test.rb
         
     | 
| 
       137 
     | 
    
         
            -
            - test/unit/tag_unit_test.rb
         
     | 
| 
       138 
     | 
    
         
            -
            - test/unit/tags/case_tag_unit_test.rb
         
     | 
| 
       139 
     | 
    
         
            -
            - test/unit/tags/for_tag_unit_test.rb
         
     | 
| 
       140 
     | 
    
         
            -
            - test/unit/tags/if_tag_unit_test.rb
         
     | 
| 
       141 
     | 
    
         
            -
            - test/unit/template_unit_test.rb
         
     | 
| 
       142 
     | 
    
         
            -
            - test/unit/tokenizer_unit_test.rb
         
     | 
| 
       143 
     | 
    
         
            -
            - test/unit/variable_unit_test.rb
         
     | 
| 
       144 
113 
     | 
    
         
             
            homepage: http://www.liquidmarkup.org
         
     | 
| 
       145 
114 
     | 
    
         
             
            licenses:
         
     | 
| 
       146 
115 
     | 
    
         
             
            - MIT
         
     | 
| 
       147 
     | 
    
         
            -
            metadata: 
     | 
| 
      
 116 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 117 
     | 
    
         
            +
              allowed_push_host: https://rubygems.org
         
     | 
| 
       148 
118 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       149 
119 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       150 
120 
     | 
    
         
             
            require_paths:
         
     | 
| 
         @@ -153,61 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       153 
123 
     | 
    
         
             
              requirements:
         
     | 
| 
       154 
124 
     | 
    
         
             
              - - ">="
         
     | 
| 
       155 
125 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       156 
     | 
    
         
            -
                  version:  
     | 
| 
      
 126 
     | 
    
         
            +
                  version: 2.7.0
         
     | 
| 
       157 
127 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       158 
128 
     | 
    
         
             
              requirements:
         
     | 
| 
       159 
129 
     | 
    
         
             
              - - ">="
         
     | 
| 
       160 
130 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       161 
131 
     | 
    
         
             
                  version: 1.3.7
         
     | 
| 
       162 
132 
     | 
    
         
             
            requirements: []
         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
            rubygems_version: 2.2.1
         
     | 
| 
      
 133 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
       165 
134 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       166 
135 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       167 
136 
     | 
    
         
             
            summary: A secure, non-evaling end user template engine with aesthetic markup.
         
     | 
| 
       168 
     | 
    
         
            -
            test_files:
         
     | 
| 
       169 
     | 
    
         
            -
            - test/fixtures/en_locale.yml
         
     | 
| 
       170 
     | 
    
         
            -
            - test/integration/assign_test.rb
         
     | 
| 
       171 
     | 
    
         
            -
            - test/integration/blank_test.rb
         
     | 
| 
       172 
     | 
    
         
            -
            - test/integration/capture_test.rb
         
     | 
| 
       173 
     | 
    
         
            -
            - test/integration/context_test.rb
         
     | 
| 
       174 
     | 
    
         
            -
            - test/integration/drop_test.rb
         
     | 
| 
       175 
     | 
    
         
            -
            - test/integration/error_handling_test.rb
         
     | 
| 
       176 
     | 
    
         
            -
            - test/integration/filter_test.rb
         
     | 
| 
       177 
     | 
    
         
            -
            - test/integration/hash_ordering_test.rb
         
     | 
| 
       178 
     | 
    
         
            -
            - test/integration/output_test.rb
         
     | 
| 
       179 
     | 
    
         
            -
            - test/integration/parsing_quirks_test.rb
         
     | 
| 
       180 
     | 
    
         
            -
            - test/integration/render_profiling_test.rb
         
     | 
| 
       181 
     | 
    
         
            -
            - test/integration/security_test.rb
         
     | 
| 
       182 
     | 
    
         
            -
            - test/integration/standard_filter_test.rb
         
     | 
| 
       183 
     | 
    
         
            -
            - test/integration/tags/break_tag_test.rb
         
     | 
| 
       184 
     | 
    
         
            -
            - test/integration/tags/continue_tag_test.rb
         
     | 
| 
       185 
     | 
    
         
            -
            - test/integration/tags/for_tag_test.rb
         
     | 
| 
       186 
     | 
    
         
            -
            - test/integration/tags/if_else_tag_test.rb
         
     | 
| 
       187 
     | 
    
         
            -
            - test/integration/tags/include_tag_test.rb
         
     | 
| 
       188 
     | 
    
         
            -
            - test/integration/tags/increment_tag_test.rb
         
     | 
| 
       189 
     | 
    
         
            -
            - test/integration/tags/raw_tag_test.rb
         
     | 
| 
       190 
     | 
    
         
            -
            - test/integration/tags/standard_tag_test.rb
         
     | 
| 
       191 
     | 
    
         
            -
            - test/integration/tags/statements_test.rb
         
     | 
| 
       192 
     | 
    
         
            -
            - test/integration/tags/table_row_test.rb
         
     | 
| 
       193 
     | 
    
         
            -
            - test/integration/tags/unless_else_tag_test.rb
         
     | 
| 
       194 
     | 
    
         
            -
            - test/integration/template_test.rb
         
     | 
| 
       195 
     | 
    
         
            -
            - test/integration/variable_test.rb
         
     | 
| 
       196 
     | 
    
         
            -
            - test/test_helper.rb
         
     | 
| 
       197 
     | 
    
         
            -
            - test/unit/block_unit_test.rb
         
     | 
| 
       198 
     | 
    
         
            -
            - test/unit/condition_unit_test.rb
         
     | 
| 
       199 
     | 
    
         
            -
            - test/unit/context_unit_test.rb
         
     | 
| 
       200 
     | 
    
         
            -
            - test/unit/file_system_unit_test.rb
         
     | 
| 
       201 
     | 
    
         
            -
            - test/unit/i18n_unit_test.rb
         
     | 
| 
       202 
     | 
    
         
            -
            - test/unit/lexer_unit_test.rb
         
     | 
| 
       203 
     | 
    
         
            -
            - test/unit/module_ex_unit_test.rb
         
     | 
| 
       204 
     | 
    
         
            -
            - test/unit/parser_unit_test.rb
         
     | 
| 
       205 
     | 
    
         
            -
            - test/unit/regexp_unit_test.rb
         
     | 
| 
       206 
     | 
    
         
            -
            - test/unit/strainer_unit_test.rb
         
     | 
| 
       207 
     | 
    
         
            -
            - test/unit/tag_unit_test.rb
         
     | 
| 
       208 
     | 
    
         
            -
            - test/unit/tags/case_tag_unit_test.rb
         
     | 
| 
       209 
     | 
    
         
            -
            - test/unit/tags/for_tag_unit_test.rb
         
     | 
| 
       210 
     | 
    
         
            -
            - test/unit/tags/if_tag_unit_test.rb
         
     | 
| 
       211 
     | 
    
         
            -
            - test/unit/template_unit_test.rb
         
     | 
| 
       212 
     | 
    
         
            -
            - test/unit/tokenizer_unit_test.rb
         
     | 
| 
       213 
     | 
    
         
            -
            - test/unit/variable_unit_test.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            test_files: []
         
     | 
    
        data/lib/liquid/module_ex.rb
    DELETED
    
    | 
         @@ -1,62 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Copyright 2007 by Domizio Demichelis
         
     | 
| 
       2 
     | 
    
         
            -
            # This library is free software. It may be used, redistributed and/or modified
         
     | 
| 
       3 
     | 
    
         
            -
            # under the same terms as Ruby itself
         
     | 
| 
       4 
     | 
    
         
            -
            #
         
     | 
| 
       5 
     | 
    
         
            -
            # This extension is used in order to expose the object of the implementing class
         
     | 
| 
       6 
     | 
    
         
            -
            # to liquid as it were a Drop. It also limits the liquid-callable methods of the instance
         
     | 
| 
       7 
     | 
    
         
            -
            # to the allowed method passed with the liquid_methods call
         
     | 
| 
       8 
     | 
    
         
            -
            # Example:
         
     | 
| 
       9 
     | 
    
         
            -
            #
         
     | 
| 
       10 
     | 
    
         
            -
            # class SomeClass
         
     | 
| 
       11 
     | 
    
         
            -
            #   liquid_methods :an_allowed_method
         
     | 
| 
       12 
     | 
    
         
            -
            #
         
     | 
| 
       13 
     | 
    
         
            -
            #   def an_allowed_method
         
     | 
| 
       14 
     | 
    
         
            -
            #     'this comes from an allowed method'
         
     | 
| 
       15 
     | 
    
         
            -
            #   end
         
     | 
| 
       16 
     | 
    
         
            -
            #   def unallowed_method
         
     | 
| 
       17 
     | 
    
         
            -
            #     'this will never be an output'
         
     | 
| 
       18 
     | 
    
         
            -
            #   end
         
     | 
| 
       19 
     | 
    
         
            -
            # end
         
     | 
| 
       20 
     | 
    
         
            -
            #
         
     | 
| 
       21 
     | 
    
         
            -
            # if you want to extend the drop to other methods you can defines more methods
         
     | 
| 
       22 
     | 
    
         
            -
            # in the class <YourClass>::LiquidDropClass
         
     | 
| 
       23 
     | 
    
         
            -
            #
         
     | 
| 
       24 
     | 
    
         
            -
            #   class SomeClass::LiquidDropClass
         
     | 
| 
       25 
     | 
    
         
            -
            #     def another_allowed_method
         
     | 
| 
       26 
     | 
    
         
            -
            #       'and this from another allowed method'
         
     | 
| 
       27 
     | 
    
         
            -
            #     end
         
     | 
| 
       28 
     | 
    
         
            -
            #   end
         
     | 
| 
       29 
     | 
    
         
            -
            # end
         
     | 
| 
       30 
     | 
    
         
            -
            #
         
     | 
| 
       31 
     | 
    
         
            -
            # usage:
         
     | 
| 
       32 
     | 
    
         
            -
            # @something = SomeClass.new
         
     | 
| 
       33 
     | 
    
         
            -
            #
         
     | 
| 
       34 
     | 
    
         
            -
            # template:
         
     | 
| 
       35 
     | 
    
         
            -
            # {{something.an_allowed_method}}{{something.unallowed_method}} {{something.another_allowed_method}}
         
     | 
| 
       36 
     | 
    
         
            -
            #
         
     | 
| 
       37 
     | 
    
         
            -
            # output:
         
     | 
| 
       38 
     | 
    
         
            -
            # 'this comes from an allowed method and this from another allowed method'
         
     | 
| 
       39 
     | 
    
         
            -
            #
         
     | 
| 
       40 
     | 
    
         
            -
            # You can also chain associations, by adding the liquid_method call in the
         
     | 
| 
       41 
     | 
    
         
            -
            # association models.
         
     | 
| 
       42 
     | 
    
         
            -
            #
         
     | 
| 
       43 
     | 
    
         
            -
            class Module
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
              def liquid_methods(*allowed_methods)
         
     | 
| 
       46 
     | 
    
         
            -
                drop_class = eval "class #{self.to_s}::LiquidDropClass < Liquid::Drop; self; end"
         
     | 
| 
       47 
     | 
    
         
            -
                define_method :to_liquid do
         
     | 
| 
       48 
     | 
    
         
            -
                  drop_class.new(self)
         
     | 
| 
       49 
     | 
    
         
            -
                end
         
     | 
| 
       50 
     | 
    
         
            -
                drop_class.class_eval do
         
     | 
| 
       51 
     | 
    
         
            -
                  def initialize(object)
         
     | 
| 
       52 
     | 
    
         
            -
                    @object = object
         
     | 
| 
       53 
     | 
    
         
            -
                  end
         
     | 
| 
       54 
     | 
    
         
            -
                  allowed_methods.each do |sym|
         
     | 
| 
       55 
     | 
    
         
            -
                    define_method sym do
         
     | 
| 
       56 
     | 
    
         
            -
                      @object.send sym
         
     | 
| 
       57 
     | 
    
         
            -
                    end
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
       59 
     | 
    
         
            -
                end
         
     | 
| 
       60 
     | 
    
         
            -
              end
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/liquid/strainer.rb
    DELETED
    
    | 
         @@ -1,59 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'set'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Liquid
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              # Strainer is the parent class for the filters system.
         
     | 
| 
       6 
     | 
    
         
            -
              # New filters are mixed into the strainer class which is then instantiated for each liquid template render run.
         
     | 
| 
       7 
     | 
    
         
            -
              #
         
     | 
| 
       8 
     | 
    
         
            -
              # The Strainer only allows method calls defined in filters given to it via Strainer.global_filter,
         
     | 
| 
       9 
     | 
    
         
            -
              # Context#add_filters or Template.register_filter
         
     | 
| 
       10 
     | 
    
         
            -
              class Strainer #:nodoc:
         
     | 
| 
       11 
     | 
    
         
            -
                @@global_strainer = Class.new(Strainer) do
         
     | 
| 
       12 
     | 
    
         
            -
                  @filter_methods = Set.new
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
                @@strainer_class_cache = Hash.new do |hash, filters|
         
     | 
| 
       15 
     | 
    
         
            -
                  hash[filters] = Class.new(@@global_strainer) do
         
     | 
| 
       16 
     | 
    
         
            -
                    @filter_methods = @@global_strainer.filter_methods.dup
         
     | 
| 
       17 
     | 
    
         
            -
                    filters.each { |f| add_filter(f) }
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                def initialize(context)
         
     | 
| 
       22 
     | 
    
         
            -
                  @context = context
         
     | 
| 
       23 
     | 
    
         
            -
                end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                def self.filter_methods
         
     | 
| 
       26 
     | 
    
         
            -
                  @filter_methods
         
     | 
| 
       27 
     | 
    
         
            -
                end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                def self.add_filter(filter)
         
     | 
| 
       30 
     | 
    
         
            -
                  raise ArgumentError, "Expected module but got: #{f.class}" unless filter.is_a?(Module)
         
     | 
| 
       31 
     | 
    
         
            -
                  unless self.class.include?(filter)
         
     | 
| 
       32 
     | 
    
         
            -
                    self.send(:include, filter)
         
     | 
| 
       33 
     | 
    
         
            -
                    @filter_methods.merge(filter.public_instance_methods.map(&:to_s))
         
     | 
| 
       34 
     | 
    
         
            -
                  end
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
                def self.global_filter(filter)
         
     | 
| 
       38 
     | 
    
         
            -
                  @@global_strainer.add_filter(filter)
         
     | 
| 
       39 
     | 
    
         
            -
                end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                def self.invokable?(method)
         
     | 
| 
       42 
     | 
    
         
            -
                  @filter_methods.include?(method.to_s)
         
     | 
| 
       43 
     | 
    
         
            -
                end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                def self.create(context, filters = [])
         
     | 
| 
       46 
     | 
    
         
            -
                  @@strainer_class_cache[filters].new(context)
         
     | 
| 
       47 
     | 
    
         
            -
                end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                def invoke(method, *args)
         
     | 
| 
       50 
     | 
    
         
            -
                  if self.class.invokable?(method)
         
     | 
| 
       51 
     | 
    
         
            -
                    send(method, *args)
         
     | 
| 
       52 
     | 
    
         
            -
                  else
         
     | 
| 
       53 
     | 
    
         
            -
                    args.first
         
     | 
| 
       54 
     | 
    
         
            -
                  end
         
     | 
| 
       55 
     | 
    
         
            -
                rescue ::ArgumentError => e
         
     | 
| 
       56 
     | 
    
         
            -
                  raise Liquid::ArgumentError.new(e.message)
         
     | 
| 
       57 
     | 
    
         
            -
                end
         
     | 
| 
       58 
     | 
    
         
            -
              end
         
     | 
| 
       59 
     | 
    
         
            -
            end
         
     | 
    
        data/lib/liquid/token.rb
    DELETED
    
    | 
         @@ -1,18 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Liquid
         
     | 
| 
       2 
     | 
    
         
            -
              class Token < String
         
     | 
| 
       3 
     | 
    
         
            -
                attr_reader :line_number
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                def initialize(content, line_number)
         
     | 
| 
       6 
     | 
    
         
            -
                  super(content)
         
     | 
| 
       7 
     | 
    
         
            -
                  @line_number = line_number
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                def raw
         
     | 
| 
       11 
     | 
    
         
            -
                  "<raw>"
         
     | 
| 
       12 
     | 
    
         
            -
                end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                def child(string)
         
     | 
| 
       15 
     | 
    
         
            -
                  Token.new(string, @line_number)
         
     | 
| 
       16 
     | 
    
         
            -
                end
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
       18 
     | 
    
         
            -
            end
         
     | 
    
        data/test/fixtures/en_locale.yml
    DELETED
    
    
| 
         @@ -1,48 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'test_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class AssignTest < Minitest::Test
         
     | 
| 
       4 
     | 
    
         
            -
              include Liquid
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              def test_assign_with_hyphen_in_variable_name
         
     | 
| 
       7 
     | 
    
         
            -
                template_source = <<-END_TEMPLATE
         
     | 
| 
       8 
     | 
    
         
            -
                {% assign this-thing = 'Print this-thing' %}
         
     | 
| 
       9 
     | 
    
         
            -
                {{ this-thing }}
         
     | 
| 
       10 
     | 
    
         
            -
                END_TEMPLATE
         
     | 
| 
       11 
     | 
    
         
            -
                template = Template.parse(template_source)
         
     | 
| 
       12 
     | 
    
         
            -
                rendered = template.render!
         
     | 
| 
       13 
     | 
    
         
            -
                assert_equal "Print this-thing", rendered.strip
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              def test_assigned_variable
         
     | 
| 
       17 
     | 
    
         
            -
                assert_template_result('.foo.',
         
     | 
| 
       18 
     | 
    
         
            -
                                       '{% assign foo = values %}.{{ foo[0] }}.',
         
     | 
| 
       19 
     | 
    
         
            -
                                       'values' => %w{foo bar baz})
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                assert_template_result('.bar.',
         
     | 
| 
       22 
     | 
    
         
            -
                                       '{% assign foo = values %}.{{ foo[1] }}.',
         
     | 
| 
       23 
     | 
    
         
            -
                                       'values' => %w{foo bar baz})
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              def test_assign_with_filter
         
     | 
| 
       27 
     | 
    
         
            -
                assert_template_result('.bar.',
         
     | 
| 
       28 
     | 
    
         
            -
                                       '{% assign foo = values | split: "," %}.{{ foo[1] }}.',
         
     | 
| 
       29 
     | 
    
         
            -
                                       'values' => "foo,bar,baz")
         
     | 
| 
       30 
     | 
    
         
            -
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              def test_assign_syntax_error
         
     | 
| 
       33 
     | 
    
         
            -
                assert_match_syntax_error(/assign/,
         
     | 
| 
       34 
     | 
    
         
            -
                                   '{% assign foo not values %}.',
         
     | 
| 
       35 
     | 
    
         
            -
                                   'values' => "foo,bar,baz")
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              def test_assign_uses_error_mode
         
     | 
| 
       39 
     | 
    
         
            -
                with_error_mode(:strict) do
         
     | 
| 
       40 
     | 
    
         
            -
                  assert_raises(SyntaxError) do
         
     | 
| 
       41 
     | 
    
         
            -
                    Template.parse("{% assign foo = ('X' | downcase) %}")
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
                end
         
     | 
| 
       44 
     | 
    
         
            -
                with_error_mode(:lax) do
         
     | 
| 
       45 
     | 
    
         
            -
                  assert Template.parse("{% assign foo = ('X' | downcase) %}")
         
     | 
| 
       46 
     | 
    
         
            -
                end
         
     | 
| 
       47 
     | 
    
         
            -
              end
         
     | 
| 
       48 
     | 
    
         
            -
            end # AssignTest
         
     | 
| 
         @@ -1,106 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'test_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class FoobarTag < Liquid::Tag
         
     | 
| 
       4 
     | 
    
         
            -
              def render(*args)
         
     | 
| 
       5 
     | 
    
         
            -
                " "
         
     | 
| 
       6 
     | 
    
         
            -
              end
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              Liquid::Template.register_tag('foobar', FoobarTag)
         
     | 
| 
       9 
     | 
    
         
            -
            end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            class BlankTestFileSystem
         
     | 
| 
       12 
     | 
    
         
            -
              def read_template_file(template_path, context)
         
     | 
| 
       13 
     | 
    
         
            -
                template_path
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
            end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            class BlankTest < Minitest::Test
         
     | 
| 
       18 
     | 
    
         
            -
              include Liquid
         
     | 
| 
       19 
     | 
    
         
            -
              N = 10
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              def wrap_in_for(body)
         
     | 
| 
       22 
     | 
    
         
            -
                "{% for i in (1..#{N}) %}#{body}{% endfor %}"
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              def wrap_in_if(body)
         
     | 
| 
       26 
     | 
    
         
            -
                "{% if true %}#{body}{% endif %}"
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
              def wrap(body)
         
     | 
| 
       30 
     | 
    
         
            -
                wrap_in_for(body) + wrap_in_if(body)
         
     | 
| 
       31 
     | 
    
         
            -
              end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              def test_new_tags_are_not_blank_by_default
         
     | 
| 
       34 
     | 
    
         
            -
                assert_template_result(" "*N, wrap_in_for("{% foobar %}"))
         
     | 
| 
       35 
     | 
    
         
            -
              end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
              def test_loops_are_blank
         
     | 
| 
       38 
     | 
    
         
            -
                assert_template_result("", wrap_in_for(" "))
         
     | 
| 
       39 
     | 
    
         
            -
              end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
              def test_if_else_are_blank
         
     | 
| 
       42 
     | 
    
         
            -
                assert_template_result("", "{% if true %} {% elsif false %} {% else %} {% endif %}")
         
     | 
| 
       43 
     | 
    
         
            -
              end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
              def test_unless_is_blank
         
     | 
| 
       46 
     | 
    
         
            -
                assert_template_result("", wrap("{% unless true %} {% endunless %}"))
         
     | 
| 
       47 
     | 
    
         
            -
              end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
              def test_mark_as_blank_only_during_parsing
         
     | 
| 
       50 
     | 
    
         
            -
                assert_template_result(" "*(N+1), wrap(" {% if false %} this never happens, but still, this block is not blank {% endif %}"))
         
     | 
| 
       51 
     | 
    
         
            -
              end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              def test_comments_are_blank
         
     | 
| 
       54 
     | 
    
         
            -
                assert_template_result("", wrap(" {% comment %} whatever {% endcomment %} "))
         
     | 
| 
       55 
     | 
    
         
            -
              end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              def test_captures_are_blank
         
     | 
| 
       58 
     | 
    
         
            -
                assert_template_result("", wrap(" {% capture foo %} whatever {% endcapture %} "))
         
     | 
| 
       59 
     | 
    
         
            -
              end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
              def test_nested_blocks_are_blank_but_only_if_all_children_are
         
     | 
| 
       62 
     | 
    
         
            -
                assert_template_result("", wrap(wrap(" ")))
         
     | 
| 
       63 
     | 
    
         
            -
                assert_template_result("\n       but this is not "*(N+1),
         
     | 
| 
       64 
     | 
    
         
            -
                  wrap(%q{{% if true %} {% comment %} this is blank {% endcomment %} {% endif %}
         
     | 
| 
       65 
     | 
    
         
            -
                  {% if true %} but this is not {% endif %}}))
         
     | 
| 
       66 
     | 
    
         
            -
              end
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
              def test_assigns_are_blank
         
     | 
| 
       69 
     | 
    
         
            -
                assert_template_result("", wrap(' {% assign foo = "bar" %} '))
         
     | 
| 
       70 
     | 
    
         
            -
              end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
              def test_whitespace_is_blank
         
     | 
| 
       73 
     | 
    
         
            -
                assert_template_result("", wrap(" "))
         
     | 
| 
       74 
     | 
    
         
            -
                assert_template_result("", wrap("\t"))
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
              def test_whitespace_is_not_blank_if_other_stuff_is_present
         
     | 
| 
       78 
     | 
    
         
            -
                body = "     x "
         
     | 
| 
       79 
     | 
    
         
            -
                assert_template_result(body*(N+1), wrap(body))
         
     | 
| 
       80 
     | 
    
         
            -
              end
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
              def test_increment_is_not_blank
         
     | 
| 
       83 
     | 
    
         
            -
                assert_template_result(" 0"*2*(N+1), wrap("{% assign foo = 0 %} {% increment foo %} {% decrement foo %}"))
         
     | 
| 
       84 
     | 
    
         
            -
              end
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
              def test_cycle_is_not_blank
         
     | 
| 
       87 
     | 
    
         
            -
                assert_template_result("  "*((N+1)/2)+" ", wrap("{% cycle ' ', ' ' %}"))
         
     | 
| 
       88 
     | 
    
         
            -
              end
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
              def test_raw_is_not_blank
         
     | 
| 
       91 
     | 
    
         
            -
                assert_template_result("  "*(N+1), wrap(" {% raw %} {% endraw %}"))
         
     | 
| 
       92 
     | 
    
         
            -
              end
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
              def test_include_is_blank
         
     | 
| 
       95 
     | 
    
         
            -
                Liquid::Template.file_system = BlankTestFileSystem.new
         
     | 
| 
       96 
     | 
    
         
            -
                assert_template_result "foobar"*(N+1), wrap("{% include 'foobar' %}")
         
     | 
| 
       97 
     | 
    
         
            -
                assert_template_result " foobar "*(N+1), wrap("{% include ' foobar ' %}")
         
     | 
| 
       98 
     | 
    
         
            -
                assert_template_result "   "*(N+1), wrap(" {% include ' ' %} ")
         
     | 
| 
       99 
     | 
    
         
            -
              end
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
              def test_case_is_blank
         
     | 
| 
       102 
     | 
    
         
            -
                assert_template_result("", wrap(" {% assign foo = 'bar' %} {% case foo %} {% when 'bar' %} {% when 'whatever' %} {% else %} {% endcase %} "))
         
     | 
| 
       103 
     | 
    
         
            -
                assert_template_result("", wrap(" {% assign foo = 'else' %} {% case foo %} {% when 'bar' %} {% when 'whatever' %} {% else %} {% endcase %} "))
         
     | 
| 
       104 
     | 
    
         
            -
                assert_template_result("   x  "*(N+1), wrap(" {% assign foo = 'else' %} {% case foo %} {% when 'bar' %} {% when 'whatever' %} {% else %} x {% endcase %} "))
         
     | 
| 
       105 
     | 
    
         
            -
              end
         
     | 
| 
       106 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,50 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'test_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class CaptureTest < Minitest::Test
         
     | 
| 
       4 
     | 
    
         
            -
              include Liquid
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              def test_captures_block_content_in_variable
         
     | 
| 
       7 
     | 
    
         
            -
                assert_template_result("test string", "{% capture 'var' %}test string{% endcapture %}{{var}}", {})
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              def test_capture_with_hyphen_in_variable_name
         
     | 
| 
       11 
     | 
    
         
            -
                template_source = <<-END_TEMPLATE
         
     | 
| 
       12 
     | 
    
         
            -
                {% capture this-thing %}Print this-thing{% endcapture %}
         
     | 
| 
       13 
     | 
    
         
            -
                {{ this-thing }}
         
     | 
| 
       14 
     | 
    
         
            -
                END_TEMPLATE
         
     | 
| 
       15 
     | 
    
         
            -
                template = Template.parse(template_source)
         
     | 
| 
       16 
     | 
    
         
            -
                rendered = template.render!
         
     | 
| 
       17 
     | 
    
         
            -
                assert_equal "Print this-thing", rendered.strip
         
     | 
| 
       18 
     | 
    
         
            -
              end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
              def test_capture_to_variable_from_outer_scope_if_existing
         
     | 
| 
       21 
     | 
    
         
            -
                template_source = <<-END_TEMPLATE
         
     | 
| 
       22 
     | 
    
         
            -
                {% assign var = '' %}
         
     | 
| 
       23 
     | 
    
         
            -
                {% if true %}
         
     | 
| 
       24 
     | 
    
         
            -
                {% capture var %}first-block-string{% endcapture %}
         
     | 
| 
       25 
     | 
    
         
            -
                {% endif %}
         
     | 
| 
       26 
     | 
    
         
            -
                {% if true %}
         
     | 
| 
       27 
     | 
    
         
            -
                {% capture var %}test-string{% endcapture %}
         
     | 
| 
       28 
     | 
    
         
            -
                {% endif %}
         
     | 
| 
       29 
     | 
    
         
            -
                {{var}}
         
     | 
| 
       30 
     | 
    
         
            -
                END_TEMPLATE
         
     | 
| 
       31 
     | 
    
         
            -
                template = Template.parse(template_source)
         
     | 
| 
       32 
     | 
    
         
            -
                rendered = template.render!
         
     | 
| 
       33 
     | 
    
         
            -
                assert_equal "test-string", rendered.gsub(/\s/, '')
         
     | 
| 
       34 
     | 
    
         
            -
              end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              def test_assigning_from_capture
         
     | 
| 
       37 
     | 
    
         
            -
                template_source = <<-END_TEMPLATE
         
     | 
| 
       38 
     | 
    
         
            -
                {% assign first = '' %}
         
     | 
| 
       39 
     | 
    
         
            -
                {% assign second = '' %}
         
     | 
| 
       40 
     | 
    
         
            -
                {% for number in (1..3) %}
         
     | 
| 
       41 
     | 
    
         
            -
                {% capture first %}{{number}}{% endcapture %}
         
     | 
| 
       42 
     | 
    
         
            -
                {% assign second = first %}
         
     | 
| 
       43 
     | 
    
         
            -
                {% endfor %}
         
     | 
| 
       44 
     | 
    
         
            -
                {{ first }}-{{ second }}
         
     | 
| 
       45 
     | 
    
         
            -
                END_TEMPLATE
         
     | 
| 
       46 
     | 
    
         
            -
                template = Template.parse(template_source)
         
     | 
| 
       47 
     | 
    
         
            -
                rendered = template.render!
         
     | 
| 
       48 
     | 
    
         
            -
                assert_equal "3-3", rendered.gsub(/\s/, '')
         
     | 
| 
       49 
     | 
    
         
            -
              end
         
     | 
| 
       50 
     | 
    
         
            -
            end # CaptureTest
         
     | 
| 
         @@ -1,32 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'test_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            class ContextTest < Minitest::Test
         
     | 
| 
       4 
     | 
    
         
            -
              include Liquid
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              def test_override_global_filter
         
     | 
| 
       7 
     | 
    
         
            -
                global = Module.new do
         
     | 
| 
       8 
     | 
    
         
            -
                  def notice(output)
         
     | 
| 
       9 
     | 
    
         
            -
                    "Global #{output}"
         
     | 
| 
       10 
     | 
    
         
            -
                  end
         
     | 
| 
       11 
     | 
    
         
            -
                end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                local = Module.new do
         
     | 
| 
       14 
     | 
    
         
            -
                  def notice(output)
         
     | 
| 
       15 
     | 
    
         
            -
                    "Local #{output}"
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                with_global_filter(global) do
         
     | 
| 
       20 
     | 
    
         
            -
                  assert_equal 'Global test', Template.parse("{{'test' | notice }}").render!
         
     | 
| 
       21 
     | 
    
         
            -
                  assert_equal 'Local test', Template.parse("{{'test' | notice }}").render!({}, :filters => [local])
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              def test_has_key_will_not_add_an_error_for_missing_keys
         
     | 
| 
       26 
     | 
    
         
            -
                with_error_mode :strict do
         
     | 
| 
       27 
     | 
    
         
            -
                  context = Context.new
         
     | 
| 
       28 
     | 
    
         
            -
                  context.has_key?('unknown')
         
     | 
| 
       29 
     | 
    
         
            -
                  assert_empty context.errors
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
              end
         
     | 
| 
       32 
     | 
    
         
            -
            end
         
     |