-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rb~
48 lines (37 loc) · 840 Bytes
/
build.rb~
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
preamble = "% Kompendie \n% TDT4242"
output = preamble
defList = "\n\n\#Definisjoner\n\n"
fileListString = %x[find . -name '*.md']
fileList = fileListString.split(/\n/)
fileList.each do |filename|
# fname = filename.chomp!
file = File.new(filename, "r")
# prevLine = ""
# prevDef = ""
# if line[0] == 58
# if not prevLine[0] == 58
# defList += prevLine + line
# else
# defList += line
# end
# end
# prevLine = line
# end
file = File.new(filename, "r")
file.each do |line|
if line[0] == '!'
puts "bilde!"
replacement = filename.split(/\//)[0]
puts replacement
end
end
file = File.new(filename, "r")
output += "\n\n"
output += file.read
end
# output += defList
f = File.new("output.md", "w")
f.write(output)
f.close
%x[pandoc output.md --output Kompendie.pdf --toc]
%x[rm output.md]