Is there a way to include source positions in the rendered output of a Twirl template? - twirl

The *.scala files that are generated by Twirl include the information that binds the generated code to the lines in source templates. Is there an option to further include this information in the output of template's render function?
If there isn't such an option what could be the recommended way of implementing this feature? Right know I cannot find where the debugging information from generated *.scala template files is consumed...

Related

Indesign server - generate indesign file based on data & provided template

i want to build a webform to store the values that i want to place in various indesign templates, to generate an indesign file. How do i do it?
How would i generate the indesign file if i have the template and the database of values that need to be placed on correct positions on the template.
Download InDesign Server SDK. It has PHP and JAVA Samples that will help you setting the environment. IDS is also available as a demo for 90days if I recall well.
Basically you write a jsx script which will do the placements and tell IDS to execute that script with specific arguments.

How to render asciidoc filename in asciidoctor template?

I have a asciidoctor template similar to this one:
https://github.com/asciidoctor/asciidoctor-backends/blob/asciidoctor-v0.1.4/erb/html5/document.html.erb
I would like to include a link into my documents which points to the asciidoc file that was used to generate the document.
Is there a way to access the asciidoc filename within my template?
I'm using the asciidoctor-maven-plugin to render my documents.
By looking at the built-in data attributes, I think that you are looking for {docfile} (evaluation depends from how the document is processed and when and where is it processed).
For me it works with the asciidoctor-maven-plugin (I get the absolute path to the file) but not in the chrome preview.

Biztalk template with non-static namespace - Visual Studio

I've exported an orchestration template using Visual Studio 2012, based on one I previously constructed. It generates a .zip with the following .vstemplate file:
<VSTemplate Type="Item" Version="2.0.0"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>TESTOrchestration</Name>
<Description>Custon Orchestration</Description>
<Icon>Icon.ico</Icon>
<ProjectType>Biztalk</ProjectType>
<DefaultName>TESTOrchestration.odx</DefaultName>
</TemplateData>
<TemplateContent>
<ProjectItem TargetFileName="$fileinputname$.odx" ReplaceParameters="true">Orchestration.odx</ProjectItem>
</TemplateContent>
Using this item template in VS2012 creates an orchestration with the properties shown in the fig. below.
Notice the namespace is that of the original project from which the template was exported.
I want to set the default namespace of this item to include the project name (or even better the path leading to this item within the project). After searching I've yet to find a working example of how to accomplish this in a BizTalk item, namely an .odx.
Thank you for taking the time to read my question. I really hope you will be able to help me with this.
After searching and tinkering around I found out how to accomplish this.
When you export a template from Visual Studio two files are created, a .vstemplate and a template of the exported item, in this case a .odx. In order to alter the namespace, and other attributes, you need to edit this second file and add the information you want.
It is also possible to pass dynamic values by using template parameters in the form of $parameter$, which are documented in Microsoft's library.
So, for example, if you wanted to modify the namespace to include the project name, you would have to edit the exported .odx file and add the parameter $safeprojectname$ or $rootnamespace$ to dynamically set the namespace uppon creation of a new item based on the template.

Style tags and Javascript in Template files

I'm looking through a project built by a foreign team. I am looking through some of the template files ending in ".ejs" and ".tmp", but from my limited knowledge, there is some bad convention here, can some of you confirm? Here are a few things I see on each template file:
1) The doctype, html tags and head are re-defined in each template file (stylesheet and JS files are linked on every one, but a different number of stylesheets and JS files linked depending on which template file it is).
2) there are Style Tags with a bunch of CSS in it, and Script tags with Javascript in it. So I'm guessing they did that because they only need those styles/JS in that particular template, but isn't it bad convention?
This is a node/express app I'm talking about. Is this a sign of bad convention/organization, or is it some sort of performance enhancement/convention I do not understand? Please advise me on this!

Must include files in nanoc always be in the layouts folder?

We would like to use server side includes (SSI) in the content of our nanoc site. This would allow us to chunk shared information and include it in multiple pages. It would also allow us to only maintain one source file of this shared information.
I figured out how to add an SSI (partial) in nanoc. As you know in nanoc we have the following root level folders, among others:
/content/
/layouts/
According to the instructions I found (https://nanoc.ws/doc/items-and-layouts/#partials), it seems the “partials” or include files need to be in the /layouts/ folder (outside of the /content/ folder).
For example:
The following code is used to insert the include file /layouts/partials/shared/test.html
<%= render 'partials/shared/test/' %>
In other words, the code assumes the include file will be placed in the layouts folder. Do you know of a way to change the default path for SSIs to /content/? This way we won’t mix content with layouts?
Thank you in advance.
Partials by default are in the layouts/ directory, and are used through the rendering helper using the #render helper method.
However, you can also put content to include (“partials”) in the content/ directory, too, although the approach then is different.
For example, create content/partials/foo.txt:
I am included!
Make sure the partial files are not routed nor compiled, so edit Rules and ensure these rules are executed first:
compile '/partials/*' do
write nil
end
Now in any item or layout you can include this partial:
<%= #items['/partials/foo.*'].compiled_content %>
This assumes the includer item/layout is filtered using ERB, but you could also use Haml or so.
You can let the compile rule do some processing, e.g. perform Markdown filtering, and then the HTML output from the filter will be included.

Resources