gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Wrong formatting for multiline wrapped function in a pipe as function argument

Open Nicd opened this issue 1 month ago • 1 comments

Here's the code:

fn render_month_pages(
  config: Configuration,
  db: Database,
  compiled_posts: Dict(PostID, CompiledPost),
  views: Views,
) {
  let years = database.years(db)

  dict.fold(years, dict.new(), fn(acc, year, year_posts) {
    dict.fold(year_posts, acc, fn(acc2, month, month_posts) {
      let posts = ordered_tree.to_list(month_posts, ordered_tree.Desc)
      dict.insert(
        acc2,
        #(year, month),
        pageify_posts(
          posts,
          config,
          compiled_posts,
          views,
          g_(config.l10n.context, "Archives for {month} {year}")
            |> string.replace(
            "{month}",
            date.month_to_string(month, config.l10n.context),
          )
            |> string.replace("{year}", int.to_string(year)),
          config.paths.month(year, month),
          element.none(),
        ),
      )
    })
  })
}

This formatting is created by both 1.1.0 and 1.2.0-rc1. The wrapped function in the pipe is unindented compared to the surroundings.

Nicd avatar May 23 '24 19:05 Nicd