child template extension crashes with basic test



  • With a vanilla installation, I added a parent template called "test-parent" with the following contents:

    TEST PARENT TEMPLATE

    {#child test-child}

    And a child template called "test-child" with the following contents:

    TEST CHILD TEMPLATE

    When I try to run test-parent, I get:

    2017-06-22T22:14:22.187Z - info: Starting rendering request 35 (user: null) requestId=35
    2017-06-22T22:14:22.188Z - info: Rendering template {shortid:S1fRkTtXb, recipe:phantom-pdf,engine:handlebars} requestId=35
    2017-06-22T22:14:22.189Z - debug: Data item not defined for this template. requestId=35
    2017-06-22T22:14:22.190Z - debug: Resources not defined for this template. requestId=35
    2017-06-22T22:14:22.194Z - debug: Rendering child template test-child
    2017-06-22T22:14:22.195Z - info: Starting rendering request 36 (user: null) requestId=36
    2017-06-22T22:14:22.195Z - info: Rendering template {shortid:SknRJpKmW, recipe:phantom-pdf,engine:handlebars} requestId=36
    2017-06-22T22:14:22.196Z - debug: Inline data specified. requestId=36
    2017-06-22T22:14:22.200Z - debug: Resources not defined for this template. requestId=36
    2017-06-22T22:14:22.201Z - debug: Rendering engine handlebars requestId=36
    2017-06-22T22:14:22.407Z - debug: Compiled template not found in the cache, compiling timestamp=Thu Jun 22 2017 16:14:22 GMT-0600 (MDT), requestId=36
    2017-06-22T22:14:22.408Z - debug: Replaced images [] requestId=36
    2017-06-22T22:14:22.408Z - debug: Executing recipe phantom-pdf requestId=36
    2017-06-22T22:14:24.253Z - debug: Converting in dedicated phantomjs 1.9.8 timestamp=Thu Jun 22 2017 16:14:23 GMT-0600 (MDT), requestId=36
    2017-06-22T22:14:24.254Z - debug: Request file:///%2Fvar%2Ffolders%2F9j%2F526ljypd2fn8gs759gc_qbyw0000gn%2FT%2Fjsreport-temp%2F24ea9b90-5798-11e7-9ee8-d7865700aac6html.html timestamp=Thu Jun 22 2017 16:14:24 GMT-0600 (MDT), requestId=36
    2017-06-22T22:14:24.255Z - debug: phantom-pdf recipe finished with 1 pages generated requestId=36
    2017-06-22T22:14:24.255Z - debug: Skipping storing report. requestId=36
    2017-06-22T22:14:24.256Z - info: Rendering request 36 finished in 2062 ms requestId=36
    2017-06-22T22:14:24.257Z - debug: Rendering engine handlebars requestId=35
    2017-06-22T22:14:24.459Z - error: Error when processing render request Error during rendering report: Lexical error on line 8. Unrecognized text.
    ...r (��)/Producer (��Qt 4.8.4 \
    ----------------------^ Error: Lexical error on line 8. Unrecognized text.
    ...r (��)/Producer (��Qt 4.8.4 \
    ----------------------^
    ...
    

    Any ideas?



  • Ah, just noticed the bold text in the child template description. Changing from phantom-pdf to html fixed the problem completely.


  • administrators

    hi! it is also likely that the child template syntax {#child test-child} (jsreport special syntax) is conflicting with handlebars syntax.

    since child templates are resolved after template compilation (in this case handlebars) the best way to apply child templates is doing something like this: https://playground.jsreport.net/studio/workspace/Sk8dEpFmW/11 (note the helper that outputs the child template call)


  • administrators

    my last comment was only for clarification and you only need to do that if you hit any problem between jsreport syntax and handlebars syntax



  • Thanks for that other example as another way to do it.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.