summaryrefslogtreecommitdiff
path: root/rakelib/doc.rake
diff options
context:
space:
mode:
Diffstat (limited to 'rakelib/doc.rake')
-rw-r--r--rakelib/doc.rake23
1 files changed, 23 insertions, 0 deletions
diff --git a/rakelib/doc.rake b/rakelib/doc.rake
new file mode 100644
index 0000000..d719c80
--- /dev/null
+++ b/rakelib/doc.rake
@@ -0,0 +1,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'