mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
chore: replace_doc_links now doesn't mess up source urls
chore: replace_doc_links now links to spark generated dsl cheat sheets
This commit is contained in:
parent
b0115f5116
commit
df2102501c
1 changed files with 8 additions and 9 deletions
|
@ -37,16 +37,15 @@ defmodule Mix.Tasks.Ash.ReplaceDocLinks do
|
|||
end
|
||||
end
|
||||
|
||||
">#{contents}<"
|
||||
end)
|
||||
|> String.replace(~r</documentation/.*/.*.md>, fn "/documentation/" <> type_and_name ->
|
||||
case String.split(type_and_name, "/") do
|
||||
[_, filename] ->
|
||||
filename |> String.trim_trailing(".md") |> Kernel.<>(".html")
|
||||
name =
|
||||
module_name
|
||||
|> String.trim_trailing(".Dsl")
|
||||
|> String.split(".")
|
||||
|> Enum.map_join("-", &String.downcase/1)
|
||||
|
||||
_ ->
|
||||
"/documentation/" <> type_and_name
|
||||
end
|
||||
rest = contents |> String.trim_leading(module_name <> ".") |> String.replace(".", "-")
|
||||
|
||||
"><a href=\"dsl-#{name}.html##{rest}\">#{contents}</a><"
|
||||
end)
|
||||
|
||||
File.write!(file, new_contents)
|
||||
|
|
Loading…
Reference in a new issue