m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/lib/latex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/latex.rb')
-rw-r--r--lib/latex.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/latex.rb b/lib/latex.rb
new file mode 100644
index 0000000..e17a6ef
--- /dev/null
+++ b/lib/latex.rb
@@ -0,0 +1,17 @@
+def render_latex song
+ template = tex_template 'song'
+ templated = template.result binding
+ File.write(tmp(song_tex song.id), templated)
+end
+
+def render_pdf song
+ render_latex song
+ system "lualatex --shell-escape -output-directory=#{TmpDir}/#{SongsDir} #{tmp (song_tex song.id)}"
+ system "mv #{tmp (song_pdf song.id)} #{build (song_pdf song.id)}"
+end
+
+def make_pdfs songs
+ songs.each_value do |song|
+ render_pdf song
+ end
+end