Giter Site home page Giter Site logo

Comments (7)

senny avatar senny commented on August 15, 2024

@Xorg1984 can you please attach your template or a template that reproduces the problem along with the sablon script you are using to render it?

from sablon.

avdovin avatar avdovin commented on August 15, 2024

the error occurs with this template

from sablon.

senny avatar senny commented on August 15, 2024

@Xorg1984 can you attach a script that renders the template as well?

from sablon.

avdovin avatar avdovin commented on August 15, 2024

To reproduce issue try run this test script

#!/usr/bin/env ruby
require "sablon"

template = Sablon.template('KVADREX-36.docx')
context =
{
  client: {
    "id"=>53, "ct_cd"=>0, "fname"=>"Петров", "lname"=>"Тестов",
    "mname"=>"Васильевич", "short_name"=>"Тестов К. А.", "email"=>"[email protected]", "interest_id"=>5,
    "status_id"=>1, "source_id"=>1, "cooparation_stage_id"=>nil,
  },
}
template.render_to_string(context)

if context is empty hash i get another error:
lib/sablon/parser/mail_merge.rb:20:in replace_field_display': undefined methodremove' for nil:NilClass

from sablon.

senny avatar senny commented on August 15, 2024

@Xorg1984 your word document contained traces of invalid merge fields (with the expression =client.lname). While I'd recommend to clean up those broken references, theres no reason for sablon to crash like this. I pushed a fix and will release 0.0.17 shortly.

from sablon.

senny avatar senny commented on August 15, 2024

0.0.17 is out.

@Xorg1984 thank you for reporting.

from sablon.

avdovin avatar avdovin commented on August 15, 2024

@senny thanks you for the quick reply and fixing crash! looks good :)

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.