Giter Club home page Giter Club logo

Comments (14)

senny avatar senny commented on July 20, 2024

@cboe are the tests passing on your machine?

$ cd <path to sablon>
$ bundle
$ bundle exec rake

from sablon.

senny avatar senny commented on July 20, 2024

@cboe There is a sample file checked into the repository. This file is used to compare generated files and make sure they are identical. You can find it here.

Up to this point sablon was developed with only Microsoft Word in mind. I've downloaded OpenOffice and when I open the sample files they do look hugely distorted. I'm guessing there is something wrong in the XML-structure that Word happily ignores:

screen shot 2015-04-10 at 09 28 47

As the README states, this is very much in early development and focused on the use-cases I've encountered so far. If you'd like to use sablon with OpenOffice I expect you'd have to submit some patches to get it to work accordingly. I'm very open to pull requests if you decide to go that path. I can't guarantee that I'll have the time to make it work with OpenOffice in the near future.

from sablon.

senny avatar senny commented on July 20, 2024

Opening and Saving the generated documents with Microsoft Word makes the generated files work with Open Office. It could be non-significant whitespace that I generate into the document.xml or Word restructures the XML on save. This should be a good starting point to investigate the issue.

Following is a screenshot of the same document as above but with a open/save roundtrip through MS Word:

screen shot 2015-04-10 at 09 38 25

from sablon.

senny avatar senny commented on July 20, 2024

@cboe I pushed a commit addressing the whitespace issue with Open Office. This solves the jumbled look of generated documents opened with Open Office (at least on my machine). However, this does not change the fact that your rendered document still contains the placeholders.

from sablon.

cboe avatar cboe commented on July 20, 2024

Thanks for that, it looks right in Open Office now! I have problems running the tests, I'll try again later. BTW, does the gem support chinese characters?

from sablon.

senny avatar senny commented on July 20, 2024

@cboe I have no idea 😁 I'n theory it should work with any unicode character.

from sablon.

cboe avatar cboe commented on July 20, 2024

well here are some of the results from the tests

christophs-mbp:sablon-3d38b9668dc5 cboe$ ruby -I ./test test/processor_test.rb
Run options: --seed 35646

Running:

FFFFFFFFFEFFFFFFF

Finished in 0.204225s, 83.2415 runs/s, 78.3450 assertions/s.

  1. Failure:
    ProcessorTest#test_paragraph_block_replacement [test/processor_test.rb:65]:
    --- expected
    +++ actual
    @@ -1 +1 @@
    -"Ruby Rails"
    +"«technologies:each(technology)» MERGEFIELD =technology \* MERGEFORMAT «=technology» «technologies:endEach»"

  2. Failure:
    ProcessorTest#test_simple_field_replacement [test/processor_test.rb:18]:
    --- expected
    +++ actual
    @@ -1 +1 @@
    -"Hello! My Name is Jack , nice to meet you."
    +"Hello! My Name is «=first_name» , nice to meet you."

  3. Failure:
    ProcessorTest#test_loop_with_missing_variable_raises_error [test/processor_test.rb:301]:
    Sablon::ContextError expected but nothing was raised.

  4. Failure:
    ProcessorTest#test_complex_field_replacement [test/processor_test.rb:37]:
    --- expected
    +++ actual
    @@ -1 +1 @@
    -"Hello! My Name is Zane , nice to meet you."
    +"Hello! My Name is MERGEFIELD =last_name \* MERGEFORMAT «=last_name» , nice to meet you."

  5. Failure:
    ProcessorTest#test_single_row_table_loop [test/processor_test.rb:195]:
    --- expected
    +++ actual
    @@ -65,7 +65,7 @@
    "tr": [
    {
    "w:rsidR": "00757DAD",

  •          \"w14:paraId\": \"1BD2E50A\",
    
  •          \"w14:paraId\": \"229B7A39\",
           \"w14:textId\": \"77777777\",
           \"w:rsidTr\": \"006333C3\",
           \"tc\": [
    

    @@ -82,13 +82,35 @@
    ],
    "p": [
    {

  •                  \"w14:paraId\": \"41ACB3D9\",
    
  •                  \"w14:paraId\": \"3D472BF1\",
                   \"w14:textId\": \"77777777\",
                   \"w:rsidR\": \"00757DAD\",
                   \"w:rsidRDefault\": \"00757DAD\",
                   \"w:rsidP\": \"006333C3\",
                   \"r\": [
                     {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"begin\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"instrText\": [
    
  •                        {
    
  •                          \"xml:space\": \"preserve\",
    
  •                          \"content\": \" MERGEFIELD items:each(item) \\\* MERGEFORMAT \"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"separate\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
                       \"rPr\": [
                         {
                           \"noProof\": [
    

    @@ -98,7 +120,14 @@
    }
    ],
    "t": [

  •                        \"1.\"
    
  •                        \"«items:each(item)»\"
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"end\"
    
  •                        }
                       ]
                     }
                   ]
    

    @@ -118,13 +147,85 @@
    ],
    "p": [
    {

  •                  \"w14:paraId\": \"197C6F31\",
    
  •                  \"w14:paraId\": \"6E6D8DB2\",
    
  •                  \"w14:textId\": \"77777777\",
    
  •                  \"w:rsidR\": \"00757DAD\",
    
  •                  \"w:rsidRDefault\": \"00757DAD\",
    
  •                  \"w:rsidP\": \"006333C3\"
    
  •                }
    
  •              ]
    
  •            },
    
  •            {
    
  •              \"tcPr\": [
    
  •                {
    
  •                  \"tcW\": [
    
  •                    {
    
  •                      \"w:w\": \"2029\",
    
  •                      \"w:type\": \"dxa\"
    
  •                    }
    
  •                  ]
    
  •                }
    
  •              ],
    
  •              \"p\": [
    
  •                {
    
  •                  \"w14:paraId\": \"7BE1DB00\",
    
  •                  \"w14:textId\": \"77777777\",
    
  •                  \"w:rsidR\": \"00757DAD\",
    
  •                  \"w:rsidRDefault\": \"00757DAD\",
    
  •                  \"w:rsidP\": \"006333C3\"
    
  •                }
    
  •              ]
    
  •            }
    
  •          ]
    
  •        },
    
  •        {
    
  •          \"w:rsidR\": \"00757DAD\",
    
  •          \"w14:paraId\": \"1BD2E50A\",
    
  •          \"w14:textId\": \"77777777\",
    
  •          \"w:rsidTr\": \"006333C3\",
    
  •          \"tc\": [
    
  •            {
    
  •              \"tcPr\": [
    
  •                {
    
  •                  \"tcW\": [
    
  •                    {
    
  •                      \"w:w\": \"2202\",
    
  •                      \"w:type\": \"dxa\"
    
  •                    }
    
  •                  ]
    
  •                }
    
  •              ],
    
  •              \"p\": [
    
  •                {
    
  •                  \"w14:paraId\": \"41ACB3D9\",
                   \"w14:textId\": \"77777777\",
                   \"w:rsidR\": \"00757DAD\",
                   \"w:rsidRDefault\": \"00757DAD\",
                   \"w:rsidP\": \"006333C3\",
                   \"r\": [
                     {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"begin\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"instrText\": [
    
  •                        {
    
  •                          \"xml:space\": \"preserve\",
    
  •                          \"content\": \" MERGEFIELD =item.index \\\* MERGEFORMAT \"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"separate\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
                       \"rPr\": [
                         {
                           \"noProof\": [
    

    @@ -134,7 +235,14 @@
    }
    ],
    "t": [

  •                        \"Milk\"
    
  •                        \"«=item.index»\"
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"end\"
    
  •                        }
                       ]
                     }
                   ]
    

    @@ -146,7 +254,7 @@
    {
    "tcW": [
    {

  •                      \"w:w\": \"2029\",
    
  •                      \"w:w\": \"4285\",
                       \"w:type\": \"dxa\"
                     }
                   ]
    

    @@ -154,13 +262,35 @@
    ],
    "p": [
    {

  •                  \"w14:paraId\": \"55C258BB\",
    
  •                  \"w14:paraId\": \"197C6F31\",
                   \"w14:textId\": \"77777777\",
                   \"w:rsidR\": \"00757DAD\",
                   \"w:rsidRDefault\": \"00757DAD\",
                   \"w:rsidP\": \"006333C3\",
                   \"r\": [
                     {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"begin\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"instrText\": [
    
  •                        {
    
  •                          \"xml:space\": \"preserve\",
    
  •                          \"content\": \" MERGEFIELD =item.label \\\* MERGEFORMAT \"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"separate\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
                       \"rPr\": [
                         {
                           \"noProof\": [
    

    @@ -170,27 +300,26 @@
    }
    ],
    "t": [

  •                        \"***\"
    
  •                        \"«=item.label»\"
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"end\"
    
  •                        }
                       ]
                     }
                   ]
                 }
               ]
    
  •            }
    
  •          ]
    
  •        },
    
  •        {
    
  •          \"w:rsidR\": \"00757DAD\",
    
  •          \"w14:paraId\": \"1BD2E50A\",
    
  •          \"w14:textId\": \"77777777\",
    
  •          \"w:rsidTr\": \"006333C3\",
    
  •          \"tc\": [
    
  •            },
             {
               \"tcPr\": [
                 {
                   \"tcW\": [
                     {
    
  •                      \"w:w\": \"2202\",
    
  •                      \"w:w\": \"2029\",
                       \"w:type\": \"dxa\"
                     }
                   ]
    

    @@ -198,13 +327,35 @@
    ],
    "p": [
    {

  •                  \"w14:paraId\": \"41ACB3D9\",
    
  •                  \"w14:paraId\": \"55C258BB\",
                   \"w14:textId\": \"77777777\",
                   \"w:rsidR\": \"00757DAD\",
                   \"w:rsidRDefault\": \"00757DAD\",
                   \"w:rsidP\": \"006333C3\",
                   \"r\": [
                     {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"begin\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"instrText\": [
    
  •                        {
    
  •                          \"xml:space\": \"preserve\",
    
  •                          \"content\": \" MERGEFIELD =item.rating \\\* MERGEFORMAT \"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"separate\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
                       \"rPr\": [
                         {
                           \"noProof\": [
    

    @@ -214,19 +365,34 @@
    }
    ],
    "t": [

  •                        \"2.\"
    
  •                        \"«=item.rating»\"
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"end\"
    
  •                        }
                       ]
                     }
                   ]
                 }
               ]
    
  •            },
    
  •            }
    
  •          ]
    
  •        },
    
  •        {
    
  •          \"w:rsidR\": \"00757DAD\",
    
  •          \"w14:paraId\": \"2D3C09BC\",
    
  •          \"w14:textId\": \"77777777\",
    
  •          \"w:rsidTr\": \"006333C3\",
    
  •          \"tc\": [
             {
               \"tcPr\": [
                 {
                   \"tcW\": [
                     {
    
  •                      \"w:w\": \"4285\",
    
  •                      \"w:w\": \"2202\",
                       \"w:type\": \"dxa\"
                     }
                   ]
    

    @@ -234,13 +400,35 @@
    ],
    "p": [
    {

  •                  \"w14:paraId\": \"197C6F31\",
    
  •                  \"w14:paraId\": \"04A961B7\",
                   \"w14:textId\": \"77777777\",
                   \"w:rsidR\": \"00757DAD\",
                   \"w:rsidRDefault\": \"00757DAD\",
                   \"w:rsidP\": \"006333C3\",
                   \"r\": [
                     {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"begin\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"instrText\": [
    
  •                        {
    
  •                          \"xml:space\": \"preserve\",
    
  •                          \"content\": \" MERGEFIELD items:endEach \\\* MERGEFORMAT \"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"separate\"
    
  •                        }
    
  •                      ]
    
  •                    },
    
  •                    {
                       \"rPr\": [
                         {
                           \"noProof\": [
    

    @@ -250,7 +438,14 @@
    }
    ],
    "t": [

  •                        \"Sugar\"
    
  •                        \"«items:endEach»\"
    
  •                      ]
    
  •                    },
    
  •                    {
    
  •                      \"fldChar\": [
    
  •                        {
    
  •                          \"w:fldCharType\": \"end\"
    
  •                        }
                       ]
                     }
                   ]
    

    @@ -262,7 +457,7 @@
    {
    "tcW": [
    {

  •                      \"w:w\": \"2029\",
    
  •                      \"w:w\": \"4285\",
                       \"w:type\": \"dxa\"
                     }
                   ]
    

    @@ -270,27 +465,33 @@
    ],
    "p": [
    {

  •                  \"w14:paraId\": \"55C258BB\",
    
  •                  \"w14:paraId\": \"71165BFB\",
                   \"w14:textId\": \"77777777\",
                   \"w:rsidR\": \"00757DAD\",
                   \"w:rsidRDefault\": \"00757DAD\",
    
  •                  \"w:rsidP\": \"006333C3\",
    
  •                  \"r\": [
    
  •                  \"w:rsidP\": \"006333C3\"
    
  •                }
    
  •              ]
    
  •            },
    
  •            {
    
  •              \"tcPr\": [
    
  •                {
    
  •                  \"tcW\": [
                     {
    
  •                      \"rPr\": [
    
  •                        {
    
  •                          \"noProof\": [
    
  •                            {
    
  •                            }
    
  •                          ]
    
  •                        }
    
  •                      ],
    
  •                      \"t\": [
    
  •                        \"**\"
    
  •                      ]
    
  •                      \"w:w\": \"2029\",
    
  •                      \"w:type\": \"dxa\"
                     }
                   ]
                 }
    
  •              ],
    
  •              \"p\": [
    
  •                {
    
  •                  \"w14:paraId\": \"01D3965C\",
    
  •                  \"w14:textId\": \"77777777\",
    
  •                  \"w:rsidR\": \"00757DAD\",
    
  •                  \"w:rsidRDefault\": \"00757DAD\",
    
  •                  \"w:rsidP\": \"006333C3\"
    
  •                }
               ]
             }
           ]
    
    1. Failure:
      ProcessorTest#test_paragraph_block_within_table_cell [test/processor_test.rb:98]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -"Puppet Chef"
      +"«technologies:each(technology)» «=technology» «technologies:endEach»"

    2. Failure:
      ProcessorTest#test_multi_row_table_loop [test/processor_test.rb:327]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -"1. Milk Milk is a white liquid. 2. Sugar Sugar is the generalized name for carbohydrates."
      +"«foods:each(food)» «=food.index» MERGEFIELD = food .label \* MERGEFORMAT «=food.label» «=food.body» MERGEFIELD foods:endEach \* MERGEFORMAT «foods:endEach»"

    3. Failure:
      ProcessorTest#test_complex_field_replacement_with_split_field [test/processor_test.rb:51]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -"Hello! My Name is Daniel , nice to meet you."
      +"Hello! My Name is MERGEFIELD = first_name \* MERGEFORMAT «=person.first_name» , nice to meet you."

    4. Failure:
      ProcessorTest#test_loop_with_missing_end_raises_error [test/processor_test.rb:308]:
      Sablon::TemplateError expected but nothing was raised.

    5. Error:
      ProcessorTest#test_adds_blank_paragraph_to_empty_table_cells:
      REXML::UndefinedNamespaceException: Undefined prefix w:w found
      /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:413:in block in pull_event' /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/set.rb:263:ineach_key'
      /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/set.rb:263:in each' /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:411:inpull_event'
      /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:184:in pull' /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/rexml/parsers/treeparser.rb:22:inparse'
      /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/rexml/document.rb:283:in build' /Users/cboe/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/rexml/document.rb:44:ininitialize'
      /Users/cboe/.rvm/gems/[email protected]/gems/xml-simple-1.1.5/lib/xmlsimple.rb:971:in new' /Users/cboe/.rvm/gems/[email protected]/gems/xml-simple-1.1.5/lib/xmlsimple.rb:971:inparse'
      /Users/cboe/.rvm/gems/[email protected]/gems/xml-simple-1.1.5/lib/xmlsimple.rb:164:in xml_in' /Users/cboe/.rvm/gems/[email protected]/gems/xml-simple-1.1.5/lib/xmlsimple.rb:203:inxml_in'
      /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/test/support/document_xml_helper.rb:8:in assert_xml_equal' test/processor_test.rb:144:intest_adds_blank_paragraph_to_empty_table_cells'

    6. Failure:
      ProcessorTest#test_conditional_with_missing_end_raises_error [test/processor_test.rb:315]:
      Sablon::TemplateError expected but nothing was raised.

    7. Failure:
      ProcessorTest#test_context_can_contain_string_and_symbol_keys [test/processor_test.rb:31]:
      Expected: "Jack Davis"
      Actual: "«=first_name» «=last_name»"

    8. Failure:
      ProcessorTest#test_conditional_with_predicate [test/processor_test.rb:340]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -"some content"
      +"«body:if(empty?)» some content «body:endIf»"

    9. Failure:
      ProcessorTest#test_loop_over_collection_convertable_to_an_enumerable [test/processor_test.rb:289]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -"CSS SCSS LESS"
      +"«technologies:each(technology)» MERGEFIELD =technology \* MERGEFORMAT «=technology» «technologies:endEach»"

    10. Failure:
      ProcessorTest#test_paragraph_block_within_empty_table_cell_and_blank_replacement [test/processor_test.rb:127]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -""
      +"«technologies:each(technology)» «=technology» «technologies:endEach»"

    11. Failure:
      ProcessorTest#test_conditional [test/processor_test.rb:332]:
      --- expected
      +++ actual
      @@ -1 +1 @@
      -"Anthony Michael Hall"
      +"Anthony «middle_name:if» «=middle_name» «middle_name:endIf» Hall"

    12. Failure:
      ProcessorTest#test_loop_over_collection_not_convertable_to_an_enumerable_raises_error [test/processor_test.rb:295]:
      Sablon::ContextError expected but nothing was raised.

17 runs, 16 assertions, 16 failures, 1 errors, 0 skips

from sablon.

cboe avatar cboe commented on July 20, 2024

christophs-mbp:sablon-3d38b9668dc5 cboe$ ruby -I ./test test/sablon_test.rb
Run options: --seed 32993

Running:

E

Finished in 0.024424s, 40.9433 runs/s, 0.0000 assertions/s.

  1. Error:
    SablonTest#test_generate_document_from_template:
    TypeError: no implicit conversion of Fixnum into String
    /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/processor/section_properties.rb:17:in []=' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/processor/section_properties.rb:17:instart_page_number='
    /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/processor.rb:31:in write_properties' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/processor.rb:7:inprocess'
    /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:43:in process' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:27:inblock (2 levels) in render'
    /Users/cboe/.rvm/gems/[email protected]/gems/rubyzip-1.1.4/lib/zip/entry_set.rb:42:in call' /Users/cboe/.rvm/gems/[email protected]/gems/rubyzip-1.1.4/lib/zip/entry_set.rb:42:inblock in each'
    /Users/cboe/.rvm/gems/[email protected]/gems/rubyzip-1.1.4/lib/zip/entry_set.rb:41:in each' /Users/cboe/.rvm/gems/[email protected]/gems/rubyzip-1.1.4/lib/zip/entry_set.rb:41:ineach'
    /Users/cboe/.rvm/gems/[email protected]/gems/rubyzip-1.1.4/lib/zip/central_directory.rb:182:in each' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:22:inblock in render'
    /Users/cboe/.rvm/gems/[email protected]/gems/rubyzip-1.1.4/lib/zip/output_stream.rb:60:in write_buffer' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:21:inrender'
    /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:16:in render_to_string' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:10:inblock in render_to_file'
    /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:9:in open' /Users/cboe/.rvm/gems/[email protected]/bundler/gems/sablon-3d38b9668dc5/lib/sablon/template.rb:9:inrender_to_file'
    test/sablon_test.rb:38:in `test_generate_document_from_template'

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
zlib(finalizer): the stream was freed prematurely.

from sablon.

cboe avatar cboe commented on July 20, 2024

christophs-mbp:sablon-3d38b9668dc5 cboe$ ruby -I ./test test/section_properties_test.rb
Run options: --seed 58810

Running:

FF

Finished in 0.004225s, 473.3728 runs/s, 710.0592 assertions/s.

  1. Failure:
    SectionPropertiesTest#test_assign_start_page_number_without_pgNumType_tag [test/section_properties_test.rb:39]:
    Expected: "16"
    Actual: nil

  2. Failure:
    SectionPropertiesTest#test_assign_start_page_number_with_pgNumType_tag [test/section_properties_test.rb:20]:
    Expected: "1"
    Actual: nil

2 runs, 3 assertions, 2 failures, 0 errors, 0 skips

from sablon.

cboe avatar cboe commented on July 20, 2024

christophs-mbp:sablon-3d38b9668dc5 cboe$ ruby -I ./test test/section_properties_test.rb
Run options: --seed 58810

Running:

FF

Finished in 0.004225s, 473.3728 runs/s, 710.0592 assertions/s.

  1. Failure:
    SectionPropertiesTest#test_assign_start_page_number_without_pgNumType_tag [test/section_properties_test.rb:39]:
    Expected: "16"
    Actual: nil

  2. Failure:
    SectionPropertiesTest#test_assign_start_page_number_with_pgNumType_tag [test/section_properties_test.rb:20]:
    Expected: "1"
    Actual: nil

2 runs, 3 assertions, 2 failures, 0 errors, 0 skips
christophs-mbp:sablon-3d38b9668dc5 cboe$ ruby -I ./test test/mail_merge_parser_test.rb
Run options: --seed 8557

Running:

FE.FFE

Finished in 0.005531s, 1084.7948 runs/s, 723.1965 assertions/s.

  1. Failure:
    MailMergeParser::FldCharTest#test_recognizes_expression [test/mail_merge_parser_test.rb:67]:
    Expected: ["=last_name"]
    Actual: []

  2. Error:
    MailMergeParser::FldCharTest#test_replace:
    NoMethodError: undefined method replace' for nil:NilClass test/mail_merge_parser_test.rb:71:intest_replace'

  3. Failure:
    MailMergeParser::FieldWithWhitespaceTest#test_recognizes_expression [test/mail_merge_parser_test.rb:176]:
    Expected: ["=title"]
    Actual: []

  4. Failure:
    MailMergeParser::FldSimpleTest#test_recognizes_expression [test/mail_merge_parser_test.rb:34]:
    Expected: ["=first_name"]
    Actual: []

  5. Error:
    MailMergeParser::FldSimpleTest#test_replace:
    NoMethodError: undefined method replace' for nil:NilClass test/mail_merge_parser_test.rb:38:intest_replace'

6 runs, 4 assertions, 3 failures, 2 errors, 0 skips

from sablon.

senny avatar senny commented on July 20, 2024

@cboe thank you for the output. You can run all tests together by executing bundle exec rake.

I see that the test already fail with test/mail_merge_parser_test.rb. This is the part that parses the sablon fields in the source template. If those fields are not recognized it's clear that the rest of the tests are failing as well.

I'll try to figure out what the cause could be but without a way for me to reproduce the errors it's going to be difficult.

from sablon.

senny avatar senny commented on July 20, 2024

@cboe The errors could be related to the version of nokogiri and libxml2 you are using. Would you mind providing the following information:

$ cd <path to sablon repo>
$ cat Gemfile.lock
$ cd <path to sablon repo>
$ bundle exec irb
irb(main):002:0> require 'nokogiri'
=> true
irb(main):003:0> Nokogiri::VersionInfo.instance.loaded_parser_version
=> "2.9.2"
irb(main):004:0> Nokogiri::VersionInfo.instance.compiled_parser_version
=> "2.9.2"

Did you use system libraries when installing nokogiri?

from sablon.

cboe avatar cboe commented on July 20, 2024

Well that solved that, I had nokogiri v. 1.4.3.1 installed... thank you so much for your quick help!

from sablon.

senny avatar senny commented on July 20, 2024

@cboe thank you for confirming. I added a version requirement for nokogiri to make sure this doesn't happen to other people.

from sablon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.