-
Notifications
You must be signed in to change notification settings - Fork 6
/
make.jl
executable file
·164 lines (141 loc) · 4.6 KB
/
make.jl
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/env julia
using Compat
using DataStructures
using Dates
using EnglishText
using Glob
using JSON
using Logging
using SExpressions
using SchemeSyntax
using Remarkable.Articles
using Remarkable.Common
using Remarkable.Talks
using Remarkable.Tags
using Remarkable.StaticSites
for line in SExpressions.parsefile("remark/definitions.rkt")
eval(SchemeSyntax.tojulia(line))
end
const site = StaticSite(default_modules=[
Dates, Tags, Common, UWSeminars, EnglishText, Articles])
const GITHUB = "https://github.com/wumss/seminar/edit/master"
# Make needed directories and copy static files
prepare(site)
# Make simple static pages
publics = Dict(
"write-markdown" => "Markdown Guide",
"important-information" => "Important Information for Speakers",
"thanks" => "Thank You for Your Feedback")
for page in readdir("pages")
root, ext = splitext(page)
if ext == ".md" && haskey(publics, root)
generate_page(site, root;
data=Dict(:pagetitle => root,
:page => root,
:pagetype => "page",
:github => "$GITHUB/pages/$page",
:mathjaxplease => true))
end
end
# Make input-less lisp static pages
lisppublics = Dict("faq" => "Frequently Asked Questions",
"submit-talk" => "Talk Submission Form",
"pttool" => "Potential Topics Tool")
for (k, v) in lisppublics
generate_page(site, k;
data=Dict(:pagetitle => v,
:pagetype => k,
:github => "$GITHUB/remark/$k.rem"))
end
function write_summary(t)
generate_page(site, "archive/$(identifier(t))";
data=Dict(:pagetitle => title(t),
:pagetype => "archive",
:mathjaxplease => true,
:talk => t),
modules=[Talks])
end
# tag collection
tagmatrix = TagMatrix()
# Parse the schedule
result = []
for file ∈ glob("data/schedule/*.json")
@info "Read schedule from " file
append!(result,
JSON.parsefile(file, dicttype=Dict{Symbol,Any}))
end
result = [Talks.fromjson(obj, tagmatrix) for obj in result]
sort!(result, by=x -> datetime(x))
talks = []
nexttalks = []
nextdate = Date(9999,12,31)
talkdict = Dict{String,Any}()
for t in result
write_summary(t)
if iscompleted(t)
push!(talks, t)
else
curdate = Date(DateTime(datetime(t)))
if curdate < nextdate
nextdate = curdate
nexttalks = [t]
elseif curdate == nextdate
push!(nexttalks, t)
end
end
talkdict[identifier(t)] = t
end
# suggestion gathering
include("topic-suggestions.jl")
# documents
include("documents.jl")
alltags = popular(tagmatrix)
# Generate poster
generate_page(site, "poster"; data=Dict(
:pagetitle => "Poster",
:pagetype => "poster",
:github => "$GITHUB/remark/poster.rem",
:extracss => ["poster"],
:mathjaxplease => true,
:talks => nexttalks), modules=[Talks])
generate_page(site, "archive"; data=Dict(
:pagetitle => "Archived Talks",
:pagetype => "archived-talks",
:talks => talks,
:mathjaxplease => true), modules=[Talks])
# Index page
generate_page(site, ""; data=Dict(
:pagetitle => "UW Student Seminars",
:pagetype => "home",
:talks => result,
:github => "$GITHUB/remark/home.rem",
:mathjaxplease => true), modules=[Talks])
# Generate tag pages
generate_page(site, "tag"; data=Dict(
:pagetitle => "List of Tags",
:pagetype => "tags",
:tagmatrix => tagmatrix), modules=[])
for t in alltags
active_set = filter(x -> t in tags(x), result)
generate_page(site, "tag/$(urinormalize(tagname(t)))"; data=Dict(
:pagetitle => uppercasefirst(tagname(t)),
:pagetype => "tag",
:tag => t,
:tagmatrix => tagmatrix,
:talkdict => talkdict,
:talks => active_set,
:documents => docs_bytag[t],
:mathjaxplease => true,
:github => "$GITHUB/wiki/tag/$(urinormalize(tagname(t))).md",
:references => get(tagsuggestions, tagname(t),
Dict(:references => []))[:references],
:suggestions => bytag[t]), modules=[Talks])
end
generate_page(site, "potential-topics"; data=Dict(
:pagetitle => "Potential Topics",
:pagetype => "suggested-topics",
:talkdict => talkdict,
:suggestions => suggestions,
:tagsuggestions => tagsuggestions,
:mathjaxplease => true,
:github => "$GITHUB/remark/suggested-topics.rem"), modules=[Talks])