aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/try_gleam.gleam17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/try_gleam.gleam b/src/try_gleam.gleam
index c788a71..63432b8 100644
--- a/src/try_gleam.gleam
+++ b/src/try_gleam.gleam
@@ -139,10 +139,15 @@ fn write_content(chapters: List(Chapter)) -> snag.Result(Nil) {
let lessons = list.flat_map(chapters, fn(c) { c.lessons })
use _ <- result.try(list.try_map(lessons, write_lesson))
+ let html =
+ chapters
+ |> list.map(index_chapter_html)
+ |> string.join("\n")
+
let lesson =
Lesson(
name: "Index",
- text: index_list_html(chapters),
+ text: html,
code: hello_joe,
path: "/index",
previous: None,
@@ -177,16 +182,6 @@ fn render_html(html: htmb.Html) -> String {
|> string_builder.to_string
}
-fn index_list_html(chapters: List(Chapter)) -> String {
- h("h2", [], [text("Table of contents")])
- |> render_html
- |> string.append(
- chapters
- |> list.map(index_chapter_html)
- |> string.join("\n"),
- )
-}
-
fn write_lesson(lesson: Lesson) -> snag.Result(Nil) {
let path = public <> lesson.path
use _ <- result.try(