summaryrefslogtreecommitdiff
path: root/rakelib/doc.rake
blob: d719c80ef66ce356538b1b61c7eb205a19a46ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
# frozen_string_literal: true

require 'pathname'
require 'rake/clean'

CLEAN.include 'build/doc'

directory 'build/doc'

rule /build\/doc\/\w+.pdf/ => lambda { |t|
  [
    Pathname.new(t).relative_path_from('build').sub_ext('.tex').to_path,
    'build/doc'
  ]
} do |t|
  sh 'pdflatex', '--output-directory', 'build/doc', t.prerequisites.first
end

desc 'Generate documentation'
task doc: 'build/doc/language.pdf'