Skip to content

Commit

Permalink
chore: simplify doc selection
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 12, 2024
1 parent 717a630 commit 55d319c
Showing 1 changed file with 18 additions and 48 deletions.
66 changes: 18 additions & 48 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -66,58 +66,11 @@ defmodule AshPostgres.MixProject do
]
end

defp extras() do
"documentation/**/*.{md,livemd,cheatmd}"
|> Path.wildcard()
|> Enum.map(fn path ->
title =
path
|> Path.basename(".md")
|> Path.basename(".livemd")
|> Path.basename(".cheatmd")
|> String.split(~r/[-_]/)
|> Enum.map_join(" ", &capitalize/1)
|> case do
"F A Q" ->
"FAQ"

other ->
other
end

{String.to_atom(path),
[
title: title
]}
end)
end

defp capitalize(string) do
string
|> String.split(" ")
|> Enum.map(fn string ->
[hd | tail] = String.graphemes(string)
String.capitalize(hd) <> Enum.join(tail)
end)
end

defp groups_for_extras() do
[
Tutorials: [
~r'documentation/tutorials'
],
"How To": ~r'documentation/how_to',
Topics: ~r'documentation/topics',
DSLs: ~r'documentation/dsls'
]
end

defp docs do
[
main: "get-started-with-postgres",
source_ref: "v#{@version}",
logo: "logos/small-logo.png",
extras: extras(),
before_closing_head_tag: fn type ->
if type == :html do
"""
Expand All @@ -133,7 +86,24 @@ defmodule AshPostgres.MixProject do
"""
end
end,
groups_for_extras: groups_for_extras(),
extras: [
"documentation/tutorials/get-started-with-postgres.md",
"documentation/how_to/join-manual-relationships.md",
"documentation/how_to/test-with-postgres.md",
"documentation/how_to/using-fragments.md",
"documentation/topics/migrations_and_tasks.md",
"documentation/topics/polymorphic_resources.md",
"documentation/topics/postgres-expressions.md",
"documentation/topics/references.md",
"documentation/topics/schema-based-multitenancy.md",
"documentation/dsls/DSL:-AshPostgres.DataLayer.md"
],
groups_for_extras: [
Tutorials: ~r'documentation/tutorials',
"How To": ~r'documentation/how_to',
Topics: ~r'documentation/topics',
DSLs: ~r'documentation/dsls'
],
nest_modules_by_prefix: [
AshPostgres.Functions
],
Expand Down

0 comments on commit 55d319c

Please sign in to comment.