forked from Lukc/alsace.netlib.re
/
index.moon
342 lines (274 loc) · 8.63 KB
/
index.moon
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
#!/usr/bin/env moon
template = require "template"
DESCRIPTION_HERO = [[
alsace.netlib.re est une fédération d’associations de défense et de promotion du logiciel libre et des éthiques hackers à Strasbourg et en Alsace.
]]
-- Plus de paragraphes de description ? Ça s’ajoute ici ! o/
DESCRIPTION = [[
Nous organisons l'édition 2018 des Rencontres Mondiales du Logiciel Libre à Strasbourg, du 7 au 12 juillet.
]]
local associations, events, lists
{:render_html} = require "lapis.html"
https = require "ssl.https"
date = require "date"
{decode: parse_json} = require "json"
Class = require "class"
Association = Class
__init: (arg) =>
-- Generic storage, uh~.
for k,v in pairs arg
@[k] = v
@otherLinks or= {}
if @lists
@\addLink "#mail-#{@name}", "Listes de discussion", "envelope-o"
addLink: (url, text, icon) =>
table.insert @otherLinks,
:url
:text
icon: icon or switch text
when "Github"
"github-alt"
when "Mail"
"envelope-o"
when "Facebook"
"facebook"
__call: =>
render_html ->
div class: "is-one-third", ->
div class: "card is-spaced", ->
header class: "card-header", ->
h3 class: "card-header-title hero is-light", @name
div class: "card-image", ->
if @image
figure class: "image", style: "overflow:hidden; margin: auto;", ->
img
style: "max-height: 128px; width: auto; margin: auto;"
src: @image
alt: @imageText or ("Logo de " .. @name)
else
figure!
div class: "card-content", ->
p ->
raw @description
if @url
div class: "card-footer", ->
a href: @url, class: "card-footer-item", "Site web"
if @otherLinks
div class: "card-footer", ->
for link in *@otherLinks
a class: "card-footer-item", href: link.url, ->
span class: "fa fa-" .. (link.icon or "warning")
span class: "screen-reader", link.text or "???"
br!
List = Class
__init: (arg) =>
for k,v in pairs arg
@[k] = v
__call: =>
render_html ->
div class: "card", ->
header class: "card-header", ->
span class: "card-header-icon", ->
a href: @url, ->
span class: "icon", ->
span class: "fa fa-envelope-o", ->
div class: "card-header-title", ->
h3 ->
a href: @url, @name
if @domainName
span class: "domainName", ->
span class: "at", "@"
text "#{@domainName}"
div class: "card-content", ->
p ->
raw @description or "???"
div class: "card-footer", ->
a class: "button is-inverted is-primary", href: @subscribe, "Inscription"
if @archives
a class: "button is-inverted is-primary", href: @archives, "Archives"
Event = do Class
__init: (arg) =>
for k,v in pairs arg
@[k] = v
if @date
@date = date @date
@tags or= {}
__class:
fromAgendaDuLibre: (tag using nil) ->
events = {}
httpContent = https.request "https://www.agendadulibre.org/maps.json?tag=#{tag}"
unless httpContent
return nil
json = parse_json httpContent
for data in *json
table.insert events, Event
name: data.properties.name
date: date(data.properties.start_time)
url: "https://www.agendadulibre.org/events/" .. tostring(data.properties.id)
description: data.properties.place_name .. ", " .. data.properties.address
id: data.properties.id
tags: data.properties.tags
events
__call: =>
render_html ->
_class = "media" .. if @future
" future"
else
""
article class: _class, ->
figure class: "media-left image is-96x96", ->
-- FIXME: Actual images or something?
if @image
figure class: "image", ->
img src: @image, alt: "Illustration"
elseif @icon
span class: "icon is-large", ->
span class: "fa fa-" .. @icon
else
span class: "icon is-large", ->
span class: "fa fa-calendar"
div class: "media-content", ->
h4 ->
if @url
a href: @url, @name
else
text @name
p ->
raw @description
div class: "tags", ->
for tag in *@tags
associationTag = false
for association in *associations
if tag == association.tag
associationTag = true
break
_class = if associationTag
"tag is-primary"
else
"tag"
div class: _class, tag
div class: "media-right", @date\fmt "%d/%m/%Y"
associations = {
with Association
name: "Hackstub"
description: "Groupe d'enthousiastes des technologies qui se reconnaissent dans <a href=\"https://fr.wikipedia.org/wiki/L'%C3%89thique_des_hackers\">l’éthique et la culture</a> <a href=\"https://fr.wikipedia.org/wiki/Hacker_(programmation)\">hacker</a>."
url: "https://hackstub.netlib.re/landpage/"
tag: "hackstub"
image: "logo-Hackstub.png"
lists: {
List
name: "discussion"
domainName: "hackstub.netlib.re"
description: "Liste de discussion du Hackstub."
url: "https://hackstub.netlib.re/mailman/listinfo/discussions"
}
\addLink "https://github.com/hackstub", "Github"
Association
name: "ARN"
url: "http://arn-fai.net/"
description: "Fournisseur d’accès à Internet associatif."
tag: "arn"
image: "logo-ARN.png"
Association
name: "LUG"
description: "Groupe d’utilisateurs de Linux et de logiciels Libres (<cite>Linux User Group</cite>) à Strasbourg."
image: "lug.png"
url: "https://strasbourg.linuxfr.org"
Association
name: "Seeraiwer"
tag: "seeraiwer"
image: "seeraiwer.png"
url: "http://www.seeraiwer.org/"
description: "« Brigands des mer »"
Association
name:"Desclicks"
tag: "desclicks"
image: "desclicks.png"
url: "http://desclicks.net/"
description: "Association de promotion du Libre et du numérique auprès du plus grand nombre."
Association
name: "AIUS"
image: "aius.png"
description: "Association étudiante."
Association
name: "sxb.so"
description: "sxb.so (<cite>Strasbourg Shared Objects</cite>) est un groupe d’entre-aide entre programmeurs."
}
lists = {
List
url: "https://alsace.netlib.re/sympa/info/rmll"
archives: "https://alsace.netlib.re/sympa/arc/rmll"
subscribe: "https://alsace.netlib.re/sympa/subscribe/rmll"
name: "RMLL 2018"
description: "Liste de l'organisation des RMLL 2018"
List
url: "https://alsace.netlib.re/sympa/info/discussions"
archives: "https://alsace.netlib.re/sympa/arc/discussions"
subscribe: "https://alsace.netlib.re/sympa/subscribe/discussions"
name: "discussions"
description: "Liste des discussions internes."
List
url: "https://alsace.netlib.re/sympa/info/annonces"
archives: "https://alsace.netlib.re/sympa/arc/annonces"
subscribe: "https://alsace.netlib.re/sympa/subscribe/annonces"
name: "annonces"
description: "Liste d’annonces de choses."
List
name: IRC
description: "#RMLL_2018 @ irc.freenode.net"
}
events = {
Event
name: "Rencontres Mondiales du Logiciel Libre"
description: "Le plus grand rendez-vous non commercial dans le monde francophone entièrement consacré au logiciel libre et à ses aspects politiques."
date: date "2018-07-07T09:00:00.000Z"
future: true
}
for association in *associations
unless association.tag
continue
eventsFromAgendaDuLibre = Event.fromAgendaDuLibre association.tag
for event in *(eventsFromAgendaDuLibre or {})
duplicate = false
i = 1
while i <= #events
e = events[i]
if e.id and e.id == event.id
duplicate = true
i = #events
i += 1
unless duplicate
table.insert events, event
table.sort events, (a, b) -> a.date < b.date
while #events > 15
table.remove events
template render_html ->
section class: "hero is-primary", id: "description", ->
div class: "container", ->
p class: "hero-body title", DESCRIPTION_HERO
section class: "hero is-success is-small", ->
div class: "container", ->
div class: "hero-body", DESCRIPTION
div class: "container", ->
section class: "section", id: "events", ->
h1 class: "title", "Évènements"
raw table.concat [e! for e in *events]
section class: "section", ->
h1 class: "title", id: "membres", "Associations membres"
div class: "columns is-multiline is-flex-touch", ->
for i in *{1, 2, 0}
div class: "column is-one-third", ->
raw table.concat [associations[j]! for j = 1, #associations when j % 3 == i]
section class: "section", id: "contact", ->
h1 class: "title", "Contact"
h2 class: "subtitle is-4", "… et listes de discussion"
for list in *lists
raw list!
br!
div class: "columns is-multiline", ->
for association in *associations
if association.lists
div class: "column", id: "mail-#{association.name}", ->
for list in *association.lists
raw list!
br!