Is it possible to get template back from REST API where all asset references are resolved?



  • I am using assets to modularize, for example...

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />        
            {#asset /partials/google-font-links.jsr}
            <style>
                {#asset /partials/styles/base.css}
                {#asset /partials/styles/base-fonts-compact.css}
            </style>
        </head>
        <body>
            {#asset /partials/header.jsr}
            <div class="columns5">
                {{for children}}
                    {{if !suppressPrint}}
                        {#asset /partials/break-before.jsr} 
                        <div class="list" {#asset /partials/break-avoid.jsr}>
                            {#asset /partials/level1-title-compact.jsr}
                            {{for children ~myIndex=#getIndex() ~listname=name}}
                                {{if !suppressPrint}}
                                    {#asset /partials/break-before.jsr} 
                                    <div class="section" {#asset /partials/break-avoid.jsr}>
                                        {#asset /partials/level2-title-compact.jsr}
                                        {{for children}}
                                            {{if !suppressPrint && type === "item"}}
                                                {#asset /partials/break-before.jsr} 
                                                <div class="item" {#asset /partials/break-avoid.jsr}>
                                                    {#asset /partials/item-compact.jsr}
                                                    {{if comments && !suppressPrintComments}}
                                                        {#asset /partials/comments.jsr}
                                                    {{/if}}       
                                                </div>
                                                {#asset /partials/break-after.jsr}
                                            {{/if}}    
                                        {{/for}}
                                    </div>
                                    {#asset /partials/break-after.jsr}
                                {{/if}}    
                            {{/for}}
                        </div>    
                        {#asset /partials/break-after.jsr}
                    {{/if}}    
                {{/for}}
            </div>
        </body>
    </html>
    

    Is it possible to use the REST API to get the template back where all the assets are resolved so I get the templates right before it would be sent to the print engine?



  • You can use html recipe and do normal render request through the API.
    Some problem with that?



  • That's creative. I will try that. Thanks!



  • Sorry, I may not have explained it properly and I may not be following completely. It seems like if do render, it will be traversing the for loops, etc. I am just wanting the template back as if the assets are filled in, but it still has the templating tags like {{for children}}. Basically, I imagine there is some internal processing on your end that is resolving all assets and then end result is a template that you would send to a print engine. Wanted to see if there is a way to capture that resolved template.



  • You can use none templating engine to avoid templating engines evaluation.



  • Will try. Thanks for quick response!



  • Worked perfectly. Thanks for the help!


Log in to reply
 

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