I need the TOC to be on the 3rd page. Apparently, if there is a way to control this, it has to be through the XSL stylesheet. All my search attempts didn't give me a clue though. Is it possible at all?
I can't use cover option since I need the header to show on both first and second pages.
OK I've found a way to do it using wkhtmltopdf 0.11. I've extracted the first two pages into a separate HTML document and then run it like this
wkhtmltopdf [options] page cover.html toc --xsl-style-sheet ... input_file.html out.pdf
Unfortunately it took a lot more effort than I expected, since I'm using it in a Rails application through wicked_pdf, and it doesn't play nice with the new options format, so I had to fork it and make the necessary changes as well.
The command line generated by wicked_pdf looks like this (long paths omitted):
"c:/program files (x86)/wkhtmltopdf/wkhtmltopdf.exe"
--header-html "file:///path/to/header" --footer-html "file:///path/to/footer"
--margin-top 20 --margin-bottom 15 --margin-left 5 --margin-right 40 page "file:///path/to/cover/page" --disable-javascript toc --xsl-style-sheet "path/to/style/sheet" - -
Related
My problem is with use of relative links and "compiling" (knitting).
I'm writing a book using RMarkdown. Since the file will be relatively large, I need to split into subfiles and directories.
I have a masterfile which only includes links to chapters(chap1, chap2, ...). There is a file for each chapter and each needs references to some figures (fig1,...).
I would like to be able to knit masterfile.Rmd and chap1.Rmd independently from each others so to get one file for chapters, and one file for the whole book.
Here is how my files are organized (MVE). Directories are displayed in upper case.
ROOT
masterfile.Rmd
FIGURES
fig1.pdf
fig2.pdf
CHAPTERS
chap1.Rmd
chap2.Rmd
...
The code of masterfile.Rmd is as follows:
{r child = '/chapters/chap1.Rmd'}
The code of chap1.Rmd is as follows:
![](../figures/fig1.pdf)
As I knit from chap1.Rmd, everything is fine. As I knit from masterfile, I get the following message:
[WARNING] Could not fetch resource '../figures/fig1.pdf': PandocResourceNotFound "../figures/fig1.pdf"
It seems that fig1.pdf cannot be found. I guess that this is because the include statement in master file only "copies" the code of chap1.Rmd and "executes" it in the ROOT directory (not in the CHAPTERS directory) so ".." drives to location that does not exist (before ROOT) when knitted from masterfile.
I could change the setting and write ![](/figures/fig1.pdf) in chap1.Rmd file. It would work fine when knitting from masterfile but no longer from chap1.Rmd.
Do you know how to have both?
Welcome to the RMarkdown community!
Due to KnitR, Rmd, and pandoc inter-workings, this is not as easy of a solution as you'd think, but a directory restructure would almost be easier.
Even if you look at Rmarkdown author's newest book RMarkdown CookbookHERE. They have all the chapters in the ROOT directory, and only sub directories for images(and possibly figures).
resources:
1. Other SO similar question
2. Github options knitr question
3. similar question from Rstudio community
You can make use of the Lua filter feature to rewrite image paths when knitting the main file. E.g.
function Image (img)
img.src = img.src:gsub('^%.%./', './')
return img
end
This will replace a path like ../figures/fig1.pdf with ./figures/fig1.pdf.
Use the code writing it to a file and calling adding it via pandoc_args (in the main file only).
---
output:
html_document:
pandoc_args: ["--lua-filter=filter.lua"]
---
I am currently in the process of designing and refining a landing page. Over the time, many things have been added and handling the amount of sections and modals is not as it easy as it used to be.
Coming straight to my question: Is there a simple solution to use templates in your normal web design flow to create static web sites. I do not need the advantages of a static site generator, like also compiling my sass or minifying my js files. Interpolation and a config file are also not needed nor wanted. Do you know any system that only allows me to split my html file into multiple components which will then be saved in different html files?
P.S. I am not looking for a Javascript template engine. The creation should happen once and produce a normal html file.
You can use a template engine like pug with client tool.
Example with pug:
Step 1: Install pug-cli
npm install -g pug-cli
Step 2: Code html using pug syntax (very easy to learn). Ex: Split home page file into multiple components (header, footer in folder template_parts):
<!DOCTYPE html>
html(lang="en")
head
meta(charset="UTF-8")
title Document
body
include template-parts/header.pug
h1 Home page
include template-parts/footer.pug
Step 3: Run pug-cli to auto convert html code
$ pug -w ./ -o ./html -P
Change ./ after -w by location of pug files, ./html after -o by location of html files after convert.
Without using PHP includes, I'm not sure if this can be accomplished without using some form of JS Templating engine as:
The majority of the web's content has a simple and declarative way to load itself. Not so for HTML
You should check out:
Metalsmith
An extremely simple, pluggable static site generator.
Handlebars
Handlebars provides the power necessary to let you build semantic templates effectively with no frustration.
If you're using GULP/GRUNT in your workflow anyway there are include plugins:
npmjs search for 'gulp include'
npmjs search for 'grunt include'
Best solution for that is to use server side rendering as the previous answare said.
But checkout this attaribute powered by w3schools it might help you.
I know this answare is to late. but it might help others.
Thanks.
I've found several ways to automate folder comparison using scripts in Beyond Compare, but none that produce the pretty html report created from Session>Folder Compare Report>View in browser.
Here is an example of what that looks like.
I would love to be able to find the script that gives me that html difference report.
Thanks!
This is what I am currently getting
load "C:\Users\UIDQ5763\Desktop\Enviornment.cpp" &
"C:\Users\UIDQ5763\Desktop\GreetingsConsoleApp"
folder-report layout:side-by-side options:display-all &
output-to:C:\Users\UIDQ5763\Report.html output-options:html-color
The documentation for Beyond Compare's scripting language is here. You were probably missing either layout:side-by-side, which gives the general display, or output-options:html-color which is required to get the correct HTML stylized output. You may want to change options:display-all to options:display-mismatches if you only want to see the differences, and you might want to add an expand all command immediately before the folder-report line if you want to see the subfolders recursively.'
The & characters shown in the sample are line continuation characters. Remove them if you don't need to wrap your lines.
i got serious problems with doxygen generatin pdf file. First of all i got blank/empty pages I don`t know why i unchecked the option SEPARATE_MEMBER_PAGES (set to 0). I looked through the files and found 2 lines with /cleandoublepages or something like this i deleted this. The result was that only the first blank page dissapeard. I got also problems with marign, every even page have weird marign. I eclosed a link to package with pdf and other files which doxygen generates + config.
File
You can set COMPACT_LATEX to YES to avoid empty pages.
I'm not sure what you mean with weird margins.
I'm writing a Django app to serve some documentation written in RestructuredText.
I have many documents written in *.rst, each of them is quite long with many section, subsection and so on.
Display the whole document in a single page is not a problem using Django filters, but I'd rather have just the topic index on a first page, whit links to an URL where I can display a single section / subsection (which will need some 'previous | up | home | next' link I guess...). In a way similar to a 'multiple HTML page output' as in a docbook / XML to HTML conversion.
Can anyone point me to some direction to build a document tree of a *.rst document an parse a single section of it, or suggest a clever way to obtain a similar result?
Choice 1. Include URL links to the other parts of the document.
You write an index.rst, part1.rst, part2.rst, etc. And your index.rst has links to the other parts. This requires almost no work, except careful planning to make sure that your RST HTML links are correct.
There's no "parse". You just break your document into sections. Manually.
[This seems so obvious, I'm afraid to mention it.]
Choice 2. Use Sphinx. It manages table-of-contents and inter-document connections very nicely.
However, the Sphinx extensions to RST aren't handled directly by Django, so you'd need to save the Sphinx output and then display that in Django. We use the JSON HTML Builder (http://sphinx.pocoo.org/builders.html?highlight=json#sphinx.builders.html.JSONHTMLBuilder) output from Sphinx. Then we render these documents through a template.