forked from AkkomaGang/akkoma
some changes
This commit is contained in:
parent
aa7fb22008
commit
5ff12e7df1
1 changed files with 16 additions and 17 deletions
|
@ -4,24 +4,24 @@ defmodule Pleroma.Docs.Markdown do
|
||||||
@spec process(keyword()) :: {:ok, String.t()}
|
@spec process(keyword()) :: {:ok, String.t()}
|
||||||
def process(descriptions) do
|
def process(descriptions) do
|
||||||
config_path = "docs/config.md"
|
config_path = "docs/config.md"
|
||||||
{:ok, file} = File.open(config_path, [:write])
|
{:ok, file} = File.open(config_path, [:utf8, :write])
|
||||||
IO.write(file, "# Configuration\r\n\r\n")
|
IO.write(file, "# Configuration\n")
|
||||||
IO.write(file, "Date of generation: #{Date.utc_today()}\r\n\r\n")
|
IO.write(file, "Date of generation: #{Date.utc_today()}\n\n")
|
||||||
|
|
||||||
IO.write(
|
IO.write(
|
||||||
file,
|
file,
|
||||||
"This file describe the configuration, it is recommended to edit the relevant `*.secret.exs` file instead of the others founds in the ``config`` directory. \r\n\r\n" <>
|
"This file describe the configuration, it is recommended to edit the relevant `*.secret.exs` file instead of the others founds in the ``config`` directory.\n\n" <>
|
||||||
" If you run Pleroma with ``MIX_ENV=prod`` the file is ``prod.secret.exs``, otherwise it is ``dev.secret.exs``.\r\n\r\n"
|
"If you run Pleroma with ``MIX_ENV=prod`` the file is ``prod.secret.exs``, otherwise it is ``dev.secret.exs``.\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
for group <- descriptions do
|
for group <- descriptions do
|
||||||
if is_nil(group[:key]) do
|
if is_nil(group[:key]) do
|
||||||
IO.write(file, "## #{inspect(group[:group])}\r\n\r\n")
|
IO.write(file, "## #{inspect(group[:group])}\n")
|
||||||
else
|
else
|
||||||
IO.write(file, "## #{inspect(group[:key])}\r\n\r\n")
|
IO.write(file, "## #{inspect(group[:key])}\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
IO.write(file, "#{group[:description]} \r\n\r\n")
|
IO.write(file, "#{group[:description]}\n")
|
||||||
|
|
||||||
for child <- group[:children] do
|
for child <- group[:children] do
|
||||||
print_child_header(file, child)
|
print_child_header(file, child)
|
||||||
|
@ -37,7 +37,7 @@ def process(descriptions) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
IO.write(file, "\r\n")
|
IO.write(file, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
:ok = File.close(file)
|
:ok = File.close(file)
|
||||||
|
@ -45,22 +45,22 @@ def process(descriptions) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp print_suggestion(file, suggestion) when is_list(suggestion) do
|
defp print_suggestion(file, suggestion) when is_list(suggestion) do
|
||||||
IO.write(file, " `#{inspect(suggestion)}`\r\n")
|
IO.write(file, " `#{inspect(suggestion)}`\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp print_suggestion(file, suggestion) when is_function(suggestion) do
|
defp print_suggestion(file, suggestion) when is_function(suggestion) do
|
||||||
IO.write(file, " `#{inspect(suggestion.())}`\r\n")
|
IO.write(file, " `#{inspect(suggestion.())}`\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp print_suggestion(file, suggestion, as_list \\ false) do
|
defp print_suggestion(file, suggestion, as_list \\ false) do
|
||||||
list_mark = if as_list, do: "*", else: ""
|
list_mark = if as_list, do: "- ", else: ""
|
||||||
IO.write(file, " #{list_mark} `#{inspect(suggestion)}`\r\n")
|
IO.write(file, " #{list_mark}`#{inspect(suggestion)}`\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp print_suggestions(_file, nil), do: nil
|
defp print_suggestions(_file, nil), do: nil
|
||||||
|
|
||||||
defp print_suggestions(file, suggestions) do
|
defp print_suggestions(file, suggestions) do
|
||||||
IO.write(file, " Suggestions: \r\n")
|
IO.write(file, "Suggestions:\n")
|
||||||
|
|
||||||
if length(suggestions) > 1 do
|
if length(suggestions) > 1 do
|
||||||
for suggestion <- suggestions do
|
for suggestion <- suggestions do
|
||||||
|
@ -72,8 +72,7 @@ defp print_suggestions(file, suggestions) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp print_child_header(file, child) do
|
defp print_child_header(file, child) do
|
||||||
IO.write(file, "* `#{inspect(child[:key])}` \r\n")
|
IO.write(file, "- `#{inspect(child[:key])}` -`#{inspect(child[:type])}` \n")
|
||||||
IO.write(file, " #{child[:description]} \r\n")
|
IO.write(file, "#{child[:description]} \n")
|
||||||
IO.write(file, " Type: `#{inspect(child[:type])}` \r\n")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue