diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..930756d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build +.elixir_ls +2017-09-21-talk-materials diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..650e1ea --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +gleam 0.27.0 +erlang 25.2.2 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a2abf22 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "[html]": { + "editor.defaultFormatter": null, + }, + "files.associations": { + "*.html.glemp": "html" + } +} diff --git a/event-2017-09-21.html b/event-2017-09-21.html index f5ad418..702f176 100644 --- a/event-2017-09-21.html +++ b/event-2017-09-21.html @@ -1,44 +1,56 @@ - - - - TRElixir @ Vincit 21.9.2017 + + + + Event 21.9.2017 – + TRElixir + + + + + + + + - - - - -
-
- TRElixir -
-
+
+ + ⬅ TRElixir + + + +
+ + +
+ +
-
-
-

1st event 21.9.2017

- +

Event 21.9.2017

+

- The first TRElixir event is on the 21st of September at Vincit premises in Hervanta, Tampere. The evening will start at 18.00. Free attendance, food and drinks will be provided. After the talks there will be time to hang around and get to know other Elixir devs. -

+ The first TRElixir event was on the 21st of September at Vincit premises in Hervanta, Tampere. +

+

- The event is graciously hosted by Vincit. + The event is graciously hosted by Vincit.

-
@@ -47,39 +59,48 @@

Talks

-
-

Why Elixir matters

+ +
+ +

Why Elixir matters

- Mikko Ahlroth + Mikko Ahlroth -

Mikko Ahlroth, Vincit

+

+ Mikko Ahlroth, Vincit Oyj +

-

- Mikko works primarily as a Django + AngularJS developer at Vincit, but on his free time has dabbled with Elixir since 2013. He has published a simple buildtool on hex.pm and runs Code::Stats on Phoenix. His dream is to get to use Elixir at work some day. -

+

+ Mikko works primarily as a full stack developer at Vincit, but on his free time has dabbled with Elixir since 2013. He has published some packages on hex.pm and runs Code::Stats on Phoenix. -

- Mikko's slides -

-
+

+ +
+ +
+ +

GenServer & Agent

-
-

GenServer & Agent

+ Janne Tenhovirta - Janne Tenhovirta +

+ Janne Tenhovirta, Cybersoft +

-

Janne Tenhovirta, Cybersoft

+

+ Janne mainly gets his hands dirty in .NET backend development at his job with Cybersoft, a subsidiary of Headpower. He feels they get dirtier when fiddling with the frontend. He first learned of Elixir's existence in 2015 and started to fool around with it in 2016. -

- Janne mainly gets his hands dirty in .NET backend development at his job with Cybersoft, a subsidiary of Headpower. He feels they get dirtier when fiddling with the frontend. He first learned of Elixir's existence in 2015 and started to fool around with it in 2016. -

-
+

+ +
+
+ Tampere background © Tampereen kaupunki, licensed under CC-BY-NC. + +
diff --git a/event-2023-03-16.html b/event-2023-03-16.html index 96cd6e1..c3d9c5c 100644 --- a/event-2023-03-16.html +++ b/event-2023-03-16.html @@ -1,49 +1,62 @@ - - - - TRElixir @ Vincit Tampere, 16.3.2023 + + + + Event 16.3.2023 – + TRElixir + + + + + + + + - - - - -
-
- ⬅ TRElixir -
-
+
+ + ⬅ TRElixir + + + +
+ + +
+ +
-
-

Event 16.3.2023

- +

Event 16.3.2023

+

- The next TRElixir event is on the 16th of March at the Vincit city centre office, Technopolis Yliopistonrinne, Kalevantie 2, Tampere. The evening will start at 18.00. Free attendance. Between and after the talks there will be time to hang around and get to know other devs. -

+ The next TRElixir event is on the 16th of March at the Vincit city centre office, Technopolis Yliopistonrinne, Kalevantie 2, Tampere. The evening will start at 18.00. Free attendance. Between and after the talks there will be time to hang around and get to know other devs. +

+ +

+ There is no food provided. There will be snacks and sodas, but if you need to eat properly, then please do that beforehand or bring some takeout with you. The aim here is to make arranging the event simpler and reduce food waste. +

+

- There is no food provided. There will be snacks and sodas, but if you need to eat properly, then please do that beforehand or bring some takeout with you. The aim here is to make arranging the event simpler and reduce food waste. -

- -

- The event is graciously hosted by Vincit. + The event is graciously hosted by Vincit.

No signup is necessary for this event. You just show up!

-

The Vincit office is on the south end of the building, just walk to the end of the main corridor and take the elevator up.

+

The Vincit office is on the south end of the building, just walk to the end of the main corridor and take the elevator up.

+
@@ -52,27 +65,37 @@

Talks

-
-

Gleam – Type Safe BEAM

+ +
+ +

Gleam – Type Safe BEAM

- Mikko Ahlroth + Mikko Ahlroth -

Mikko Ahlroth, Vincit

+

+ Mikko Ahlroth, Vincit Oyj +

-

- Mikko works primarily as a full stack developer at Vincit, but on his free time has dabbled with Elixir since 2013. He has published some packages on hex.pm and runs Code::Stats on Phoenix. -

-
+

+ Mikko works primarily as a full stack developer at Vincit, but on his free time has dabbled with Elixir since 2013. He has published some packages on hex.pm and runs Code::Stats on Phoenix. -

-

More talks TBA

-
+

+ +
+ +
+ +

More talks TBA

+ +
+
+ Tampere background © Tampereen kaupunki, licensed under CC-BY-NC. + +
diff --git a/feed.xml b/feed.xml index ed5f14d..9c05e6f 100644 --- a/feed.xml +++ b/feed.xml @@ -4,10 +4,10 @@ TRElixir https://trelixir.fi/ TRElixir newsletter feed. - My hands + Glemplate © Mikko Ahlroth - + <![CDATA[Upcoming event: 16.3.2023]]> @@ -15,20 +15,30 @@ <dc:creator>Mikko Ahlroth</dc:creator> - <link>https://trelixir.fi/event-2023-03-16.html</link> - <guid>https://trelixir.fi/event-2023-03-16.html</guid> + <link> + https://trelixir.fi/event-2023-03-16.html + </link> + <guid> + cfc19ed7-f46d-45b6-a134-e11df93a864d + </guid> + <description> <![CDATA[ <p> - TRElixir will be next held on the 16th of March, 2023, at Vincit office in central Tampere, starting at 18.00 o'clock. - </p> + TRElixir will be next held on the 16th of March, 2023, at Vincit office in central Tampere, starting at 18.00 o'clock. +</p> + +<p> + <a href="https://trelixir.fi/event-2023-03-16.html">Go to event page.</a> +</p> - <p> - <a href="https://trelixir.fi/event-2023-03-16.html">Go to event page.</a> - </p> ]]> </description> - <pubDate>Tue, 21 Feb 2023 21:30:00 +0200</pubDate> + + <pubDate> + Tue, 21 Feb 2023 21:30:00 +0200 + </pubDate> </item> + </channel> </rss> diff --git a/gleam.toml b/gleam.toml new file mode 100644 index 0000000..1c67f2e --- /dev/null +++ b/gleam.toml @@ -0,0 +1,15 @@ +name = "trelixir" +version = "1.0.0" +description = "trelixir.fi site generator" + +# Fill out these fields if you intend to generate HTML documentation or publish +# your project to the Hex package manager. +# +# licences = ["MIT"] +# repository = { type = "gitlab", user = "Nicd", repo = "glemplate" } +# links = [] + +[dependencies] +gleam_stdlib = "~> 0.27.0" +glemplate = "~> 2.0" +gleam_erlang = "~> 0.18" diff --git a/index.html b/index.html index cb1dcaf..83a4dd4 100644 --- a/index.html +++ b/index.html @@ -1,86 +1,137 @@ - <!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>TRElixir + + + + + TRElixir + + + + + + + + - - - - - -
-
- TRElixir +
+ + TRElixir + - -
+ + + +
+
+ +
+ +
+

TRElixir

+

+ Tampere 💜 BEAM! +

+

+ TRElixir is a developer meetup focusing on the BEAM ecosystem. +

+ +
-
-
-

TRElixir

-

- Tampere 💜 BEAM! -

-

- TRElixir is a developer meetup focusing on the BEAM ecosystem. -

-
-

Upcoming event

+

Thursday, 16.3.2023, 18.00

-

Thursday, 16.3.2023, 18.00

+
+
+ +

+ TRElixir will be next held on the 16th of March, 2023, at Vincit office in central Tampere, starting at 18.00 o'clock. +

-
-
-

- TRElixir will be next held on the 16th of March, 2023, at Vincit office in central Tampere, starting at 18.00 o'clock. -

-

- Planned presentations: -

+ +

+ Presentations: +

-
    -
  • Gleam – Type Safe BEAM (Mikko Ahlroth)
  • -
  • More talks TBA
  • -
-
+
    + +
  • + + Gleam – Type Safe BEAM (Mikko Ahlroth) + +
  • + +
  • + + More talks TBA + +
  • + +
+ +
+ + +
- -

Past events

+ +

21.9.2017

-

1st event 21.9.2017

+
+
+ +

+ The first TRElixir event was on the 21st of September at Vincit premises in Hervanta, Tampere. +

-
-
-

- The first TRElixir event was on the 21st of September at Vincit premises in Hervanta, Tampere. -

-
- -
+ +

+ Presentations: +

+ +
    + +
  • + + Why Elixir matters (Mikko Ahlroth) + +
  • + +
  • + + GenServer & Agent (Janne Tenhovirta) + +
  • + +
+ +
+ + +
+ +
@@ -120,8 +171,9 @@
- Tampere background © Tampereen kaupunki, licensed under CC-BY-NC. -
+ Tampere background © Tampereen kaupunki, licensed under CC-BY-NC. + +
diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..a4b5364 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,15 @@ +# This file was generated by Gleam +# You typically do not need to edit this file + +packages = [ + { name = "gleam_erlang", version = "0.18.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "C69F59D086AD50B80DE294FB0963550630971C9DC04E92B1F7AEEDD2C0BE226C" }, + { name = "gleam_stdlib", version = "0.27.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "9DBDD21B48C654182CDD8AA15ACF85E8E74A0438583C68BD7EF08BE89F999C6F" }, + { name = "glemplate", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "glentities", "nibble"], otp_app = "glemplate", source = "hex", outer_checksum = "B4A7B0A2FC4721A364124B32E9B25F74BE1413274B0D26CC615271E7EFBC3035" }, + { name = "glentities", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glentities", source = "hex", outer_checksum = "1D102DA9A4C1991019829DE1C3E49589A63CB82994CCB40924862239F5077446" }, + { name = "nibble", version = "0.2.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "nibble", source = "hex", outer_checksum = "B5D0E11DADEB4EC2F4ACD04DEB3CEBE3F0762B0BD9FF37805948FFC17017F791" }, +] + +[requirements] +gleam_erlang = "~> 0.18" +gleam_stdlib = "~> 0.27.0" +glemplate = "~> 2.0" diff --git a/src/trelixir.gleam b/src/trelixir.gleam new file mode 100644 index 0000000..9b72413 --- /dev/null +++ b/src/trelixir.gleam @@ -0,0 +1,44 @@ +import gleam/map +import gleam/string_builder.{StringBuilder} +import gleam/erlang/file +import gleam/list +import trelixir/tpls +import trelixir/index +import trelixir/events/types as event_types +import trelixir/events/utils as event_utils +import trelixir/feed/feed +import trelixir/events/event_2023_03_16 +import trelixir/events/event_2017_09_21 + +pub fn main() { + let assert Ok(templates) = tpls.load_templates() + + let assert Ok(index_tpl) = map.get(templates, index.tpl) + + let assert Ok(index_content) = index.render(index_tpl, templates) + let assert Ok(_) = write_rendered("index.html", index_content) + + let assert Ok(feed_tpl) = map.get(templates, feed.tpl) + let assert Ok(feed_content) = feed.render(feed_tpl, templates) + let assert Ok(_) = write_rendered("feed.xml", feed_content) + + let events = [ + #(event_2023_03_16.file, event_2023_03_16.data()), + #(event_2017_09_21.file, event_2017_09_21.data()), + ] + + let assert Ok(_) = + list.try_map( + events, + fn(event) { + let #(file_name, data) = event + let assert Ok(tpl) = map.get(templates, event_types.tpl) + let assert Ok(event_content) = event_utils.render(tpl, templates, data) + write_rendered(file_name <> ".html", event_content) + }, + ) +} + +fn write_rendered(filename: String, rendered: StringBuilder) { + file.write(string_builder.to_string(rendered), filename) +} diff --git a/src/trelixir/events/event_2017_09_21-tpls/description.html.glemp b/src/trelixir/events/event_2017_09_21-tpls/description.html.glemp new file mode 100644 index 0000000..a886011 --- /dev/null +++ b/src/trelixir/events/event_2017_09_21-tpls/description.html.glemp @@ -0,0 +1,3 @@ +

+ The first TRElixir event was on the 21st of September at Vincit premises in Hervanta, Tampere. +

diff --git a/src/trelixir/events/event_2017_09_21.gleam b/src/trelixir/events/event_2017_09_21.gleam new file mode 100644 index 0000000..2625d60 --- /dev/null +++ b/src/trelixir/events/event_2017_09_21.gleam @@ -0,0 +1,25 @@ +import glemplate/assigns +import trelixir/events/types +import trelixir/events/utils +import trelixir/speakers/mikko_ahlroth +import trelixir/speakers/janne_tenhovirta + +pub const file = "event-2017-09-21" + +pub fn data() { + types.Event( + title: "Event 21.9.2017", + host_name: "Vincit", + host_url: "https://vincit.com/", + description: utils.load_child_tpl( + "event_2017_09_21", + "description", + assigns.new(), + ), + signup_info: utils.load_child_tpl("generic", "signup_closed", assigns.new()), + talks: [ + types.Talk(title: "Why Elixir matters", speaker: mikko_ahlroth.data()), + types.Talk(title: "GenServer & Agent", speaker: janne_tenhovirta.data()), + ], + ) +} diff --git a/src/trelixir/events/event_2023_03_16-tpls/description.html.glemp b/src/trelixir/events/event_2023_03_16-tpls/description.html.glemp new file mode 100644 index 0000000..d284b60 --- /dev/null +++ b/src/trelixir/events/event_2023_03_16-tpls/description.html.glemp @@ -0,0 +1,7 @@ +

+ The next TRElixir event is on the 16th of March at the Vincit city centre office, Technopolis Yliopistonrinne, Kalevantie 2, Tampere. The evening will start at 18.00. Free attendance. Between and after the talks there will be time to hang around and get to know other devs. +

+ +

+ There is no food provided. There will be snacks and sodas, but if you need to eat properly, then please do that beforehand or bring some takeout with you. The aim here is to make arranging the event simpler and reduce food waste. +

diff --git a/src/trelixir/events/event_2023_03_16-tpls/signup_info.html.glemp b/src/trelixir/events/event_2023_03_16-tpls/signup_info.html.glemp new file mode 100644 index 0000000..a833fd4 --- /dev/null +++ b/src/trelixir/events/event_2023_03_16-tpls/signup_info.html.glemp @@ -0,0 +1,3 @@ +

No signup is necessary for this event. You just show up!

+ +

The Vincit office is on the south end of the building, just walk to the end of the main corridor and take the elevator up.

diff --git a/src/trelixir/events/event_2023_03_16.gleam b/src/trelixir/events/event_2023_03_16.gleam new file mode 100644 index 0000000..aa072db --- /dev/null +++ b/src/trelixir/events/event_2023_03_16.gleam @@ -0,0 +1,31 @@ +import glemplate/assigns +import trelixir/events/types +import trelixir/events/utils +import trelixir/speakers/mikko_ahlroth + +pub const file = "event-2023-03-16" + +pub fn data() { + types.Event( + title: "Event 16.3.2023", + host_name: "Vincit", + host_url: "https://vincit.com/", + description: utils.load_child_tpl( + "event_2023_03_16", + "description", + assigns.new(), + ), + signup_info: utils.load_child_tpl( + "event_2023_03_16", + "signup_info", + assigns.new(), + ), + talks: [ + types.Talk( + title: "Gleam – Type Safe BEAM", + speaker: mikko_ahlroth.data(), + ), + types.Placeholder, + ], + ) +} diff --git a/src/trelixir/events/generic-tpls/signup_closed.html.glemp b/src/trelixir/events/generic-tpls/signup_closed.html.glemp new file mode 100644 index 0000000..f70097c --- /dev/null +++ b/src/trelixir/events/generic-tpls/signup_closed.html.glemp @@ -0,0 +1 @@ +Signup is closed diff --git a/src/trelixir/events/types.gleam b/src/trelixir/events/types.gleam new file mode 100644 index 0000000..ea20270 --- /dev/null +++ b/src/trelixir/events/types.gleam @@ -0,0 +1,26 @@ +pub const tpl = "page.html.glemp" + +pub type Company { + NoCompany + Company(name: String) +} + +pub type Speaker { + Speaker(name: String, img: String, company: Company, description: String) +} + +pub type Talk { + Placeholder + Talk(title: String, speaker: Speaker) +} + +pub type Event { + Event( + title: String, + description: String, + host_name: String, + host_url: String, + signup_info: String, + talks: List(Talk), + ) +} diff --git a/src/trelixir/events/utils.gleam b/src/trelixir/events/utils.gleam new file mode 100644 index 0000000..b964bc2 --- /dev/null +++ b/src/trelixir/events/utils.gleam @@ -0,0 +1,71 @@ +import gleam/map +import gleam/list +import gleam/string_builder +import glemplate/assigns +import glemplate/html +import glemplate/ast +import glemplate/renderer +import trelixir/tpls +import trelixir/events/types + +pub fn render( + template: ast.Template, + template_cache: renderer.TemplateCache, + data: types.Event, +) { + html.render(template, event_to_assigns(data), template_cache) +} + +pub fn event_to_assigns(event: types.Event) -> assigns.Assigns { + assigns.from_list([ + #("title", assigns.String(event.title)), + #("description", assigns.String(event.description)), + #("host_name", assigns.String(event.host_name)), + #("host_url", assigns.String(event.host_url)), + #("signup_info", assigns.String(event.signup_info)), + #("talks", assigns.List(list.map(event.talks, talk_to_assigns))), + #("is_index", assigns.Bool(False)), + ]) +} + +pub fn talk_to_assigns(talk: types.Talk) -> assigns.AssignData { + case talk { + types.Talk(title, speaker) -> + assigns.Map(map.from_list([ + #("title", assigns.String(title)), + #("speaker", speaker_to_assigns(speaker)), + #("is_placeholder", assigns.Bool(False)), + ])) + + types.Placeholder -> + assigns.Map(map.from_list([#("is_placeholder", assigns.Bool(True))])) + } +} + +pub fn speaker_to_assigns(speaker: types.Speaker) -> assigns.AssignData { + let company = case speaker.company { + types.NoCompany -> assigns.Bool(False) + types.Company(name) -> assigns.String(name) + } + + assigns.Map(map.from_list([ + #("name", assigns.String(speaker.name)), + #("img", assigns.String(speaker.img)), + #("company", company), + #("description", assigns.String(speaker.description)), + ])) +} + +pub fn load_child_tpl( + event_module: String, + child_tpl: String, + data: assigns.Assigns, +) { + let assert Ok(parsed) = + tpls.load_template( + child_tpl <> ".html.glemp", + "src/trelixir/events/" <> event_module <> "-tpls", + ) + let assert Ok(rendered) = html.render(parsed, data, map.new()) + string_builder.to_string(rendered) +} diff --git a/src/trelixir/feed/cfc19ed7-f46d-45b6-a134-e11df93a864d-description.html.glemp b/src/trelixir/feed/cfc19ed7-f46d-45b6-a134-e11df93a864d-description.html.glemp new file mode 100644 index 0000000..0a5309c --- /dev/null +++ b/src/trelixir/feed/cfc19ed7-f46d-45b6-a134-e11df93a864d-description.html.glemp @@ -0,0 +1,7 @@ +

+ TRElixir will be next held on the 16th of March, 2023, at Vincit office in central Tampere, starting at 18.00 o'clock. +

+ +

+ Go to event page. +

diff --git a/src/trelixir/feed/feed.gleam b/src/trelixir/feed/feed.gleam new file mode 100644 index 0000000..60ab694 --- /dev/null +++ b/src/trelixir/feed/feed.gleam @@ -0,0 +1,75 @@ +import gleam/map +import gleam/string_builder +import gleam/list +import glemplate/html +import glemplate/text +import glemplate/assigns +import glemplate/ast +import glemplate/renderer +import trelixir/tpls +import trelixir/events/event_2023_03_16 + +pub const tpl = "feed.xml.glemp" + +type Item { + Item( + title: String, + link: String, + guid: String, + description: String, + pub_date: String, + ) +} + +pub fn render(template: ast.Template, template_cache: renderer.TemplateCache) { + text.render( + template, + items() + |> items_to_assigns(), + template_cache, + ) +} + +fn items() { + [ + Item( + title: "Upcoming event: 16.3.2023", + link: "https://trelixir.fi/event-2023-03-16.html", + guid: "cfc19ed7-f46d-45b6-a134-e11df93a864d", + description: load_description( + "cfc19ed7-f46d-45b6-a134-e11df93a864d", + assigns.new() + |> assigns.add_string("event_file", event_2023_03_16.file), + ), + pub_date: "Tue, 21 Feb 2023 21:30:00 +0200", + ), + ] +} + +fn items_to_assigns(items: List(Item)) { + let mapped = + list.map( + items, + fn(item) { + let item_map = + assigns.new() + |> assigns.add_string("title", item.title) + |> assigns.add_string("link", item.link) + |> assigns.add_string("guid", item.guid) + |> assigns.add_string("description", item.description) + |> assigns.add_string("pubDate", item.pub_date) + + assigns.Map(item_map) + }, + ) + + assigns.new() + |> assigns.add_list("items", mapped) +} + +fn load_description(item: String, data: assigns.Assigns) { + let assert Ok(parsed) = + tpls.load_template(item <> "-description.html.glemp", "src/trelixir/feed") + let assert Ok(rendered) = html.render(parsed, data, map.new()) + string_builder.to_string(rendered) +} diff --git a/src/trelixir/index.gleam b/src/trelixir/index.gleam new file mode 100644 index 0000000..6bf60ab --- /dev/null +++ b/src/trelixir/index.gleam @@ -0,0 +1,71 @@ +import gleam/map +import gleam/list +import glemplate/assigns +import glemplate/renderer +import glemplate/html +import glemplate/ast +import trelixir/events/utils +import trelixir/events/event_2023_03_16 +import trelixir/events/event_2017_09_21 + +pub const tpl = "index.html.glemp" + +pub fn assigns() { + assigns.from_list([ + #("is_index", assigns.Bool(True)), + #( + "upcoming_event", + assigns.Map(map.from_list([ + #("title", assigns.String("Thursday, 16.3.2023, 18.00")), + #("file", assigns.String(event_2023_03_16.file)), + #( + "description", + assigns.String( + " +

+ TRElixir will be next held on the 16th of March, 2023, at Vincit office in central Tampere, starting at 18.00 o'clock. +

+", + ), + ), + #( + "talks", + assigns.List(list.map( + event_2023_03_16.data().talks, + utils.talk_to_assigns, + )), + ), + ])), + ), + #( + "past_events", + assigns.List([ + assigns.Map(map.from_list([ + #("title", assigns.String("21.9.2017")), + #("file", assigns.String("event-2017-09-21")), + #( + "description", + assigns.String( + " +

+ The first TRElixir event was on the 21st of September at Vincit premises in Hervanta, Tampere. +

+", + ), + ), + #( + "talks", + assigns.List(list.map( + event_2017_09_21.data().talks, + utils.talk_to_assigns, + )), + ), + ])), + ]), + ), + ]) +} + +pub fn render(template: ast.Template, template_cache: renderer.TemplateCache) { + html.render(template, assigns(), template_cache) +} diff --git a/src/trelixir/speakers/janne_tenhovirta-description.html.glemp b/src/trelixir/speakers/janne_tenhovirta-description.html.glemp new file mode 100644 index 0000000..7775cae --- /dev/null +++ b/src/trelixir/speakers/janne_tenhovirta-description.html.glemp @@ -0,0 +1 @@ +Janne mainly gets his hands dirty in .NET backend development at his job with Cybersoft, a subsidiary of Headpower. He feels they get dirtier when fiddling with the frontend. He first learned of Elixir's existence in 2015 and started to fool around with it in 2016. diff --git a/src/trelixir/speakers/janne_tenhovirta.gleam b/src/trelixir/speakers/janne_tenhovirta.gleam new file mode 100644 index 0000000..7d0f09e --- /dev/null +++ b/src/trelixir/speakers/janne_tenhovirta.gleam @@ -0,0 +1,12 @@ +import glemplate/assigns +import trelixir/events/types +import trelixir/speakers/utils + +pub fn data() { + types.Speaker( + name: "Janne Tenhovirta", + img: "jannenaama.jpg", + description: utils.load_description("janne_tenhovirta", assigns.new()), + company: types.Company(name: "Cybersoft"), + ) +} diff --git a/src/trelixir/speakers/mikko_ahlroth-description.html.glemp b/src/trelixir/speakers/mikko_ahlroth-description.html.glemp new file mode 100644 index 0000000..bccf510 --- /dev/null +++ b/src/trelixir/speakers/mikko_ahlroth-description.html.glemp @@ -0,0 +1 @@ +Mikko works primarily as a full stack developer at Vincit, but on his free time has dabbled with Elixir since 2013. He has published some packages on hex.pm and runs Code::Stats on Phoenix. diff --git a/src/trelixir/speakers/mikko_ahlroth.gleam b/src/trelixir/speakers/mikko_ahlroth.gleam new file mode 100644 index 0000000..c5bd4fd --- /dev/null +++ b/src/trelixir/speakers/mikko_ahlroth.gleam @@ -0,0 +1,12 @@ +import glemplate/assigns +import trelixir/events/types +import trelixir/speakers/utils + +pub fn data() { + types.Speaker( + name: "Mikko Ahlroth", + img: "mikkonaama2.webp", + description: utils.load_description("mikko_ahlroth", assigns.new()), + company: types.Company(name: "Vincit Oyj"), + ) +} diff --git a/src/trelixir/speakers/utils.gleam b/src/trelixir/speakers/utils.gleam new file mode 100644 index 0000000..c442726 --- /dev/null +++ b/src/trelixir/speakers/utils.gleam @@ -0,0 +1,15 @@ +import gleam/map +import gleam/string_builder +import glemplate/html +import glemplate/assigns +import trelixir/tpls + +pub fn load_description(speaker_name: String, assigns: assigns.Assigns) { + let assert Ok(parsed) = + tpls.load_template( + speaker_name <> "-description.html.glemp", + "src/trelixir/speakers", + ) + let assert Ok(rendered) = html.render(parsed, assigns, map.new()) + string_builder.to_string(rendered) +} diff --git a/src/trelixir/tpls.gleam b/src/trelixir/tpls.gleam new file mode 100644 index 0000000..0819294 --- /dev/null +++ b/src/trelixir/tpls.gleam @@ -0,0 +1,38 @@ +import gleam/list +import gleam/result +import gleam/string +import gleam/map +import gleam/erlang/file +import glemplate/parser + +const tpl_dir = "tpl" + +pub fn load_templates() { + use tpls <- result.then( + file.list_directory(tpl_dir) + |> result.map_error(fn(err) { "Couldn't list dir: " <> string.inspect(err) }), + ) + list.try_fold( + tpls, + map.new(), + fn(cache, tpl_file) { + use parsed <- result.then(load_template(tpl_file, tpl_dir)) + + Ok(map.insert(cache, tpl_file, parsed)) + }, + ) +} + +pub fn load_template(tpl_file: String, tpl_dir: String) { + let tpl_path = tpl_dir <> "/" <> tpl_file + use tpl <- result.then( + file.read(tpl_path) + |> result.map_error(fn(err) { + "Couldn't read tpl file " <> tpl_path <> ": " <> string.inspect(err) + }), + ) + parser.parse_to_template(tpl, tpl_file) + |> result.map_error(fn(err) { + "Couldn't parse template " <> tpl_file <> ": " <> string.inspect(err) + }) +} diff --git a/tpl/body_top.html.glemp b/tpl/body_top.html.glemp new file mode 100644 index 0000000..5ee0455 --- /dev/null +++ b/tpl/body_top.html.glemp @@ -0,0 +1,32 @@ +
+
+ <% if is_index %> + TRElixir + <% else %> + ⬅ TRElixir + <% end %> + + <% if is_index %> + + <% end %> +
+
+ +
+ <% if is_index %> +
+

TRElixir

+

+ Tampere 💜 BEAM! +

+

+ TRElixir is a developer meetup focusing on the BEAM ecosystem. +

+
+ <% end %> +
diff --git a/tpl/feed.xml.glemp b/tpl/feed.xml.glemp new file mode 100644 index 0000000..252d0b6 --- /dev/null +++ b/tpl/feed.xml.glemp @@ -0,0 +1,37 @@ + + + + TRElixir + https://trelixir.fi/ + TRElixir newsletter feed. + Glemplate + © Mikko Ahlroth + + <% for item in items %> + + + <![CDATA[<%= item.title %>]]> + + + Mikko Ahlroth + + + <%= item.link %> + + + <%= item.guid %> + + + + + ]]> + + + + <%= item.pubDate %> + + + <% end %> + + diff --git a/tpl/foot.html.glemp b/tpl/foot.html.glemp new file mode 100644 index 0000000..c63f4e8 --- /dev/null +++ b/tpl/foot.html.glemp @@ -0,0 +1,3 @@ + diff --git a/tpl/head.html.glemp b/tpl/head.html.glemp new file mode 100644 index 0000000..8c99c9f --- /dev/null +++ b/tpl/head.html.glemp @@ -0,0 +1,14 @@ + + + + + <% if is_index %><% else %><%= title %> –<% end %> + TRElixir + + + + + + + + diff --git a/tpl/index.html.glemp b/tpl/index.html.glemp new file mode 100644 index 0000000..d775fbd --- /dev/null +++ b/tpl/index.html.glemp @@ -0,0 +1,58 @@ + + + <% render head.html.glemp is_index: is_index %> + + + <% render body_top.html.glemp is_index: is_index %> + +
+
+

Upcoming event

+ <% render index_event.html.glemp event: upcoming_event %> + +

Past events

+ <% for event in past_events %> + <% render index_event.html.glemp event: event %> + <% end %> +
+ +
+

Contact

+ +
+
+

RSS

+ +

+ Follow our RSS feed for the latest updates. We will post any upcoming meetups in the RSS feed. +

+
+ +
+

IM

+ +

+ Currently the most relevant discussion can be found on the Koodiklinikka.fi Slack server, on the channel #elixir. +

+ +

+ You can also shoot Mikko Ahlroth a message on Fosstodon, on IRC (Nicd @ Libera.chat), or by email. +

+
+
+
+ +
+

Sponsored by

+ +
+
+ Vincit +
+
+
+ + <% render foot.html.glemp %> +
+ + diff --git a/tpl/index_event.html.glemp b/tpl/index_event.html.glemp new file mode 100644 index 0000000..b663497 --- /dev/null +++ b/tpl/index_event.html.glemp @@ -0,0 +1,29 @@ +

<%= event.title %>

+ +
+
+ <%= raw event.description %> + + <% if event.talks %> +

+ Presentations: +

+ +
    + <% for talk in event.talks %> +
  • + <% if talk.is_placeholder %> + More talks TBA + <% else %> + <%= talk.title %> (<%= talk.speaker.name %>) + <% end %> +
  • + <% end %> +
+ <% end %> +
+ + +
diff --git a/tpl/page.html.glemp b/tpl/page.html.glemp new file mode 100644 index 0000000..c2a2f3e --- /dev/null +++ b/tpl/page.html.glemp @@ -0,0 +1,56 @@ + + + <% render head.html.glemp is_index: is_index, title: title %> + + + <% render body_top.html.glemp is_index: is_index %> + +
+
+

<%= title %>

+ +
+
+ <%= raw description %> + +

+ The event is graciously hosted by <%= host_name %>. +

+
+ +
+ <%= raw signup_info %> +
+
+
+ +
+

Talks

+ +
+ <% for talk in talks %> +
+ <% if talk.is_placeholder %> +

More talks TBA

+ <% else %> +

<%= talk.title %>

+ + <%= talk.speaker.name %> + +

+ <%= talk.speaker.name %><% if talk.speaker.company %>, <%= talk.speaker.company %><% end %> +

+ +

+ <%= raw talk.speaker.description %> +

+ <% end %> +
+ <% end %> +
+
+ + <% render foot.html.glemp %> +
+ +