Added yaml file to instruct pandoc. Added color links inside the PDF.

pull/127/head
Francesco Urbani 3 years ago
parent e199043b2d
commit 26e457ea41

@ -6,7 +6,7 @@
# -------------------- Utility Methods --------------------
# Check for binaries
function checkEnvironment(){
type pandoc >/dev/null 2>&1 || { echo "Install 'pandoc' first (e.g. via 'brew install pandoc')." >&2 && exit 1 ; }
type pandoc >/dev/null 2>&1 || { echo "Install 'pandoc' first (e.g. via 'brew install pandoc' or 'apt-get install pandoc')." >&2 && exit 1 ; }
type xelatex >/dev/null 2>&1 || { echo "Install 'xelatex' first" >&2 && exit 1 ; }
}
@ -20,15 +20,26 @@ function cleanupBeforeStarting(){
# Creates the summary from the generated chapters
function convertToLatex(){
cd ./latex
cp ../*.png .
cp ../*.png . # copy Easy_Rust_sample_image.png in the current folder in order to be found.
# Step 1: run pandoc on README.md which generates the `.tex` file.
# Commands used previously (didn't require metadata.yaml). Left here for reference...
# pandoc ../README.md -V geometry:margin=0.7in -V colorlinks=true -V linkcolor=blue -V urlcolor=blue -V toccolor=gray --standalone --from markdown --to latex > easy_rust.tex
# pandoc ../README.md --standalone --from markdown --to latex > easy_rust.tex
pandoc ../README.md -V geometry:margin=0.7in --standalone --from markdown --to latex > easy_rust.tex
# generates `easy_rust.tex` in the current folder using the instructions given inside `../pdf_metadata.yaml`.
pandoc ../README.md ../pdf_metadata.yaml -s -o easy_rust.tex # --toc # The `toc` flag can be added or not depending on personal preferences.
# If added, the `xelatex` command right below needs to be run twice (the first time.)
echo "Generated easy_rust.tex file."
xelatex --interaction=nonstopmode easy_rust.tex
echo "Generated PDF file easy_rust.pdf"
# Step 2: run `xelatex` on the `.tex` file to geneate the PDF.
xelatex --interaction=nonstopmode easy_rust.tex
# to generate the TOC you need to run this twice
# xelatex --interaction=nonstopmode easy_rust.tex
echo "Generated PDF file easy_rust.pdf"
cd ..
}

@ -0,0 +1,16 @@
---
title: 'Easy Rust'
author:
- https://github.com/Dhghomon/easy_rust
keywords: [rust, easy-rust]
# abstract: |
# Rust explained using easy English
geometry: margin=0.7in #left=1cm,right=1cm,top=2cm,bottom=2cm
colorlinks: true
linkcolor: blue
urlcolor: blue
toccolor: gray
...
Loading…
Cancel
Save