Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Nov 22, 2024
1 parent cc9d13b commit 16b6aa1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
8 changes: 4 additions & 4 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# You typically do not need to edit this file

packages = [
{ name = "filepath", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "EFB6FF65C98B2A16378ABC3EE2B14124168C0CE5201553DE652E2644DCFDB594" },
{ name = "gleam_stdlib", version = "0.38.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "663CF11861179AF415A625307447775C09404E752FF99A24E2057C835319F1BE" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
{ name = "filepath", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "67A6D15FB39EEB69DD31F8C145BB5A421790581BD6AA14B33D64D5A55DBD6587" },
{ name = "gleam_stdlib", version = "0.43.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "69EF22E78FDCA9097CBE7DF91C05B2A8B5436826D9F66680D879182C0860A747" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "htmb", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "htmb", source = "hex", outer_checksum = "915186FE1759EB8B78CBDC01228D0B7ED74DA2E64B08B4115525E293B036C428" },
{ name = "simplifile", version = "2.0.1", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "5FFEBD0CAB39BDD343C3E1CCA6438B2848847DC170BA2386DF9D7064F34DF000" },
{ name = "simplifile", version = "2.2.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0DFABEF7DC7A9E2FF4BB27B108034E60C81BEBFCB7AB816B9E7E18ED4503ACD8" },
{ name = "snag", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "54D32E16E33655346AA3E66CBA7E191DE0A8793D2C05284E3EFB90AD2CE92BCC" },
]

Expand Down
8 changes: 4 additions & 4 deletions src/content/chapter0_basics/lesson14_type_imports/code.gleam
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import gleam/bytes_builder
import gleam/string_builder.{type StringBuilder}
import gleam/bytes_tree
import gleam/string_tree.{type StringTree}

pub fn main() {
// Referring to a type in a qualified way
let _bytes: bytes_builder.BytesBuilder = bytes_builder.new()
let _bytes: bytes_tree.BytesTree = bytes_tree.new()

// Refering to a type in an unqualified way
let _text: StringBuilder = string_builder.new()
let _text: StringTree = string_tree.new()
}
6 changes: 3 additions & 3 deletions src/content/chapter1_functions/lesson07_pipelines/code.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import gleam/string

pub fn main() {
// Without the pipe operator
io.debug(string.drop_left(string.drop_right("Hello, Joe!", 1), 7))
io.debug(string.drop_start(string.drop_end("Hello, Joe!", 1), 7))

// With the pipe operator
"Hello, Mike!"
|> string.drop_right(1)
|> string.drop_left(7)
|> string.drop_end(1)
|> string.drop_start(7)
|> io.debug

// Changing order with function capturing
Expand Down
25 changes: 10 additions & 15 deletions src/tour.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import gleam/list
import gleam/option.{type Option, None, Some}
import gleam/result
import gleam/string
import gleam/string_builder
import gleam/string_tree
import htmb.{type Html, h, text}
import simplifile
import snag
Expand Down Expand Up @@ -303,7 +303,7 @@ fn contents_list_html(chapters: List(Chapter)) -> String {
fn render_html(html: Html) -> String {
html
|> htmb.render
|> string_builder.to_string
|> string_tree.to_string
}

fn ensure_directory(path: String) -> snag.Result(Nil) {
Expand Down Expand Up @@ -486,9 +486,6 @@ fn generate_stdlib_bundle(modules: List(String)) -> snag.Result(Nil) {
|> string.replace("$", "\\$")
|> string.split("\n")
|> list.filter(fn(line) { !string.starts_with(string.trim(line), "//") })
|> list.filter(fn(line) {
!string.starts_with(line, "@external(erlang")
})
|> list.filter(fn(line) { line != "" })
|> string.join("\n")

Expand Down Expand Up @@ -666,7 +663,7 @@ fn lesson_page_render(lesson: Lesson) -> String {
h("section", [#("id", "left"), #("class", "content-nav")], [
h("div", [], [
h("h2", [], [text(lesson.name)]),
htmb.dangerous_unescaped_fragment(string_builder.from_string(
htmb.dangerous_unescaped_fragment(string_tree.from_string(
lesson.text,
)),
]),
Expand All @@ -691,9 +688,7 @@ fn lesson_page_render(lesson: Lesson) -> String {
theme_picker_script(),
arrow_keys_navigation_script(lesson.next, lesson.previous),
h("script", [#("type", "gleam"), #("id", "code")], [
htmb.dangerous_unescaped_fragment(string_builder.from_string(
lesson.code,
)),
htmb.dangerous_unescaped_fragment(string_tree.from_string(lesson.code)),
]),
html_script("/index.js", ScriptOptions(module: True, defer: False), []),
],
Expand All @@ -705,7 +700,7 @@ fn lesson_page_render(lesson: Lesson) -> String {
/// Transform a path into a slug
fn slugify_path(path: String) -> String {
string.replace(path, "/", "-")
|> string.drop_left(up_to: 1)
|> string.drop_start(up_to: 1)
}

/// Renders a lesson item in the everyting page's list
Expand All @@ -717,7 +712,7 @@ fn everything_page_lesson_html(lesson: Lesson, index: Int, end_index: Int) {
h("a", [#("href", "#" <> slugify_path(lesson.path)), #("class", "link")], [
h("h2", [#("class", "lesson-title")], [text(lesson.name)]),
]),
htmb.dangerous_unescaped_fragment(string_builder.from_string(lesson.text)),
htmb.dangerous_unescaped_fragment(string_tree.from_string(lesson.text)),
h("pre", [#("class", "lesson-snippet hljs gleam language-gleam")], [
h("code", [], [text(lesson.code)]),
h(
Expand Down Expand Up @@ -770,7 +765,7 @@ fn everything_page_chapters_html(chapters: List(Chapter)) -> List(Html) {
]
}

list.concat([chapter_header, ..lessons])
list.flatten([chapter_header, ..lessons])
}

/// Renders a link to a lesson in the table of contents
Expand Down Expand Up @@ -897,7 +892,7 @@ pub fn html_dangerous_inline_script(
])
}
h("script", attrs, [
htmb.dangerous_unescaped_fragment(string_builder.from_string(content)),
htmb.dangerous_unescaped_fragment(string_tree.from_string(content)),
])
}

Expand Down Expand Up @@ -971,7 +966,7 @@ fn head(with config: HeadConfig) -> htmb.Html {
..list.map(config.stylesheets, html_stylesheet)
]

let head_content = list.concat([head_meta, head_links, config.scripts])
let head_content = list.flatten([head_meta, head_links, config.scripts])

h("head", [], head_content)
}
Expand Down Expand Up @@ -1064,5 +1059,5 @@ pub fn render_page(page config: PageConfig) -> String {
config
|> render_page_html
|> htmb.render_page()
|> string_builder.to_string
|> string_tree.to_string
}
2 changes: 0 additions & 2 deletions static/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import CodeFlask from "https://cdn.jsdelivr.net/npm/[email protected]/+esm";

console.log(CodeFlask);
globalThis.CodeFlask = CodeFlask;

const output = document.querySelector("#output");
Expand Down

0 comments on commit 16b6aa1

Please sign in to comment.