flashcard-tools

Tools for working with LaTeX flashcards
git clone git://lumidify.org/flashcard-tools.git (fast, but not encrypted)
git clone https://lumidify.org/flashcard-tools.git (encrypted, but very slow)
git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/flashcard-tools.git (over tor)
Log | Files | Refs | README

tmp_compile.sh (769B)


      1 # Compiles the flashcard with the given ID to PDF,
      2 # adding the necessary frontmatter beforehand.
      3 
      4 if [ $# -eq 0 ]
      5 then
      6 	echo "USAGE: ./tmp_compile.sh <flashcard_id>"
      7 	exit 1
      8 fi
      9 
     10 if [ ! -e "flashcards/$1" ]
     11 then
     12 	echo "File doesn't exist: flashcards/$1"
     13 	exit 1
     14 fi
     15 
     16 meta1=`head -n 1 "flashcards/$1" | tr -d '\n' | sed 's/\|.*$//'`
     17 meta2=`sed '2!d' "flashcards/$1" | tr -d '\n'`
     18 body=`tail -n +3 "flashcards/$1"`
     19 printf '\\documentclass[grid,avery5371]{flashcards}\n' > tmp_compile.tex
     20 cat defs.tex >> tmp_compile.tex
     21 printf '\\cardfrontstyle{headings}\n' >> tmp_compile.tex
     22 printf '\\begin{document}\n\\begin{flashcard}[%s]{%s}\n%s\n\\end{flashcard}\n\\end{document}\n' "$meta1" "$meta2" "$body" >> tmp_compile.tex
     23 pdflatex tmp_compile.tex
     24 rm tmp_compile.{aux,log,tex}