Added code to export to PDF (#861)
This commit is contained in:

committed by
Waldir Pimenta

parent
5cc6ae001d
commit
17f0b9a1ca
29
scripts/generate-pdf.sh
Executable file
29
scripts/generate-pdf.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
src=../pages
|
||||
target=../tldr-book.pdf
|
||||
template=template.tex
|
||||
|
||||
function getContent {
|
||||
|
||||
cd $src
|
||||
|
||||
pages=$(ls -d */ | # list directories
|
||||
tr -d '/' | # remove trailing slash
|
||||
tr '[:lower:]' '[:upper:]') # transform to uppercase
|
||||
|
||||
for page in $pages; do
|
||||
|
||||
echo "\n\n# $page" >&1 # add a new chapter
|
||||
|
||||
for file in $(ls $page); do
|
||||
|
||||
echo "\n\n" | # add some line breaks for latex
|
||||
cat - $page/$file | # get the content of the tldr file
|
||||
sed 's/^#/##/g' >&1 # transform h1 (chapter) to h2 (section)
|
||||
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
getContent | pandoc -o $target --template $template --latex-engine xelatex --listings
|
Reference in New Issue
Block a user