m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/lib/latex.rb
blob: e17a6efbdf9dae242de09ef0357658d464d2da0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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