aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2023-12-21 15:26:28 +0000
committerLouis Pilfold <louis@lpil.uk>2023-12-21 15:26:28 +0000
commit9f224236b56a7e812f099c3409dc64ab69385806 (patch)
tree63bebd3eb83454d915b3288ce873f7b0e6beac1d
parent4efb34bd728732101432843ed0bfbeb971272287 (diff)
downloadtour-9f224236b56a7e812f099c3409dc64ab69385806.tar.gz
tour-9f224236b56a7e812f099c3409dc64ab69385806.zip
Do not run on CI yet
-rw-r--r--.github/workflows/test.yml3
-rw-r--r--src/try_gleam.gleam17
2 files changed, 8 insertions, 12 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d52406f..916850a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -20,4 +20,5 @@ jobs:
# elixir-version: "1.15.4"
- run: gleam deps download
- run: gleam format --check src test
- - run: gleam run
+ # - run: gleam run
+ - run: gleam test
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(