Rmarkdown and Pandoc templates - specifying paths to assets - rstudio

I am attempting to create my own pandoc template for use with RStudio/Rmarkdown and HTML output. After some code snooping, google searches and trial/error I have a functional template that works as expected. I have included the template within an R package as well as my own custom function for calling html_document().
However, I am unable to determine the appropriate way to specify/reference local assets (e.g. images) I would like included within my pandoc HTML template. I have tried specifying the path relative to the pandoc template with no luck. I'm surmising that I need to provide an absolute path and I can get that from System.file(). For assets such as css files that are specified within the header, I can handle that as part of my custom call to html_document. In this case, however, I'm trying to specify a path within the HTML body and not sure how to elegantly include that within the pandoc template.

Related

How to generate html documentation with a prefix?

I want to generate documentation to put on the web with a certain path prefix. But I can't figure out how to generate the documentation so that the links are absolute instead of relative. The html_baseurl parameter doesn't work at all.
Let's say I want to place documentation in the /docs prefix when deploying to the production. How can I do that?

Valid output types for play twirl template

What are the valid types that can be generated by a Twirl template in play framework? I know that I can generate HTML. I would like to generate an svg. Is that possible?
If I have a file named foo.scala.html, then I do get a generated class. foo.scala.svg does not result in a class.
Are the options documented anywhere?
I am currently using PlayFramework 2.5.2, but upgrading should be possible.
What are the valid types that can be generated by a Twirl template in play framework?
https://github.com/playframework/twirl#template-files:
Template files must be named {name}.scala.{ext} where ext can be html, js, xml, or txt.
I would like to generate an svg. Is that possible?
Not out of the box. You can implement a custom format yourself though. See https://www.playframework.com/documentation/2.5.x/ScalaCustomTemplateFormat

Dropwizard View includes several Freemarker templates

I use the Views with Freemarker to Display HTML info pages. Now I want to add a "footer" for all templates, but I dont want to copy same code to every *.ftl file.
Is it possible to create one footer.ftl and add it to all other *.ftl files? Searching web, i found freemarker macros, but I dont know how to use it in DW. How can I use freemarker macros with DW?
This doesn't help -> How can I embed one DropWizard (with freemarker) View in another one?
I added just this line to the original ftl:
<p><#include "footer.ftl"> </p>
This file is in the same folder (I havent tried other locations) and contains the footer text like:
Copyright 2001-2002<br>
All rights reserved.

What is the best practice for placing template views and backbone view code

I am creating a ASP.Net MVC 3 application using Backbone.js. I am also using the jQuery templates for the views.
My question is how do I organize the files in an efficient way?
Currently I have a XXX.js file for the backbone application and inlined templates stored in the page that shows the backbone application, Index.cshtml. How can I move the templates into a different file that I can include like I include XXX.js?
App/
Scripts/
backbone.js
underscore.js
jquery-1.6.4.js
jquery.tmpl.js
myBackboneApplication.js
Views/
Home/
Index.cshtml
Controllers/
HomeController.cs
I would like to move the templates out of Index.cshtml and into something related to myBackboneApplication.js. Something that I can include as a file inside Index.cshtml instead of inlined.
You might check out this related question. The two basic options are:
Create your templates as strings and include the Javascript file in your index file.
Create your templates as HTML in separate files, and insert them into the index file at build time, most likely within <script type="text/template"> tags.
In my current Backbone.js project, I'm using the second option - I keep all my templates in a separate folder, and I insert them into my index file during my ant build. Each template (e.g. my-view-template.html) is inserted into a <script> tag with id="my-view-template", and then I use jQuery to create the templates using $("#my-view-template").html() as the template string.

How can I override the URL writing mechanism for .script <include-script> tags in Tapestry 4?

Previously on StackOverflow, I wrote this question where I asked how to append a build number parameter to the generated URLs for Tapestry assets to solve caching problems. I ultimately answered my own question: replace Tapestry's default asset source with a custom one which wraps the generated assets to tack on the build number. But I've found out that .js files imported by the <include-script> tag in .script files are not using this mechanism and are therefore not getting the build number on them. So I'd like to accomplish the same objective with them. How?

Resources