mirror of
https://github.com/greyscalepress/manifestos.git
synced 2024-10-01 05:25:35 -04:00
104 lines
2.4 KiB
Bash
Executable File
104 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
## Purpose of this script
|
||
|
||
## Select all files in the folder /content/fr
|
||
## Save them to the folder /temp/
|
||
|
||
## 1: We declare some variables
|
||
|
||
INPUT="../content/meta.txt" ## ../content/intro.txt
|
||
INPUT="$INPUT ../content/manifestos/*.*"
|
||
|
||
TEMP="../temp/newfile.txt"
|
||
TEMP2="../temp/newfile2.txt"
|
||
|
||
##TIMESTAMP=$(date +"%s")
|
||
TIMESTAMP=$(date -u +%Y%m%d_%H%M%SZ)
|
||
OUTPUT="../output/Manifestos_for_the_Internet_Age-"$TIMESTAMP".pdf"
|
||
OUTPUTEPUB="../output/Manifestos_for_the_Internet_Age-"$TIMESTAMP".epub"
|
||
|
||
## Create the temp and output folder if they does not exist
|
||
if [ ! -d "../temp" ]; then
|
||
mkdir ../temp
|
||
fi
|
||
if [ ! -d "../output" ]; then
|
||
mkdir ../output
|
||
fi
|
||
|
||
if [ ! -d ~/.fonts ]; then
|
||
mkdir ~/.fonts
|
||
fi
|
||
|
||
##cp ../fonts/*.otf ~/.fonts/
|
||
##fc-cache -fv
|
||
|
||
## 2: AWK Method
|
||
|
||
## FNR = the current record number in the current file.
|
||
## NR = "Number of Lines seen so far in the current file"
|
||
|
||
## \\vfill \\columnbreak \\newpage
|
||
|
||
awk '
|
||
BEGIN {
|
||
start = ""; ## \\begin{multicols}{2}
|
||
end = "\\newpage"; ## \\end{multicols}\n
|
||
print start
|
||
}
|
||
FNR == 1 && FNR != NR {
|
||
print end;
|
||
print start
|
||
}
|
||
{print} ## {print $0," "} ## Adds two spaces after each end-of-line, to keep line returns in Markdown.
|
||
END {
|
||
print end
|
||
}
|
||
' $INPUT > $TEMP
|
||
|
||
## awk '{print $0," x"}' $TEMP > $TEMP2
|
||
## mv $TEMP2 $TEMP
|
||
|
||
## PANDOC processing
|
||
|
||
## Consolata
|
||
## Inconsesi
|
||
## "Breite Grotesk"
|
||
## "Work Sans"
|
||
## "Archivo Narrow"
|
||
## "Sophia Nubian"
|
||
## "Limousine" - by OSP Foundry
|
||
## Monoid - by Andreas Larsen
|
||
## HK Grotesk - by Alfredo Marco Pradil, Hanken Design Co.
|
||
|
||
pandoc -f markdown --template=../templates/customV2 $TEMP \
|
||
--pdf-engine=xelatex \
|
||
--variable mainfont="HKGrotesk-Regular" \
|
||
--variable boldfont="LinLibertineOB" \
|
||
--variable italicfont="LinLibertineOI" \
|
||
--variable fontsize=9pt \
|
||
--variable urlcolor=black \
|
||
--variable linkcolor=black \
|
||
--variable documentclass=book \
|
||
--toc --toc-depth=1 \
|
||
--listings \
|
||
--include-before-body=../content/intro.txt \
|
||
-o $OUTPUT
|
||
|
||
pandoc -f markdown --template=../templates/custom $TEMP \
|
||
--pdf-engine=xelatex \
|
||
--variable mainfont="HKGrotesk-Regular" \
|
||
--variable boldfont="LinLibertineOB" \
|
||
--variable italicfont="LinLibertineOI" \
|
||
--variable fontsize=9pt \
|
||
--variable urlcolor=black \
|
||
--variable linkcolor=black \
|
||
--variable documentclass=book \
|
||
--toc --toc-depth=1 \
|
||
--listings \
|
||
--include-before-body=../content/intro.txt \
|
||
--to=epub2 \
|
||
-o $OUTPUTEPUB
|
||
|
||
## End of file
|