-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rb
More file actions
25 lines (17 loc) · 811 Bytes
/
build.rb
File metadata and controls
25 lines (17 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true
require 'fileutils'
@target = 'src'
chapters = []
File.readlines('lectures/SUMMARY.md').each do |line|
next unless m = line.strip.match(%r{\[.*\]\((lectures/.+\.md)\)})
chapters.push m.captures[0]
end
FileUtils.rm_r @target if Dir.exist?(@target)
FileUtils.mkdir_p "#{@target}/lectures"
FileUtils.mkdir_p "#{@target}/practicals"
FileUtils.cp('lectures/SUMMARY.md', "#{@target}/")
chapters.each do |x|
`pandoc #{x} -f markdown+tex_math_double_backslash -t commonmark+tex_math_dollars --mathjax -o #{@target}/#{x} -L assets/exclude_elements.lua --citeproc --csl assets/apa.csl --bibliography lectures/references.bib --bibliography lectures/wikipedia.bib`
end
FileUtils.cp_r "lectures/figures/.", "#{@target}/lectures/figures/"
FileUtils.cp_r "resources", "#{@target}/"