aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorAlex S <alex.strizhakov@gmail.com>2019-08-30 13:21:48 +0300
committerAlex S <alex.strizhakov@gmail.com>2019-09-11 09:25:33 +0300
commit67e430093187c50f307810e88ed0e73afe825b75 (patch)
tree2021d96311344784724cf7cbd1fbb9babe15ba4c /lib/pleroma/docs/json.ex
parent171cefd88972c6ec1f37a2e014a9a484ae91ab9a (diff)
downloadpleroma-67e430093187c50f307810e88ed0e73afe825b75.tar.gz
description formatters
Diffstat (limited to 'lib/pleroma/docs/json.ex')
-rw-r--r--lib/pleroma/docs/json.ex15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/pleroma/docs/json.ex b/lib/pleroma/docs/json.ex
new file mode 100644
index 000000000..38f015017
--- /dev/null
+++ b/lib/pleroma/docs/json.ex
@@ -0,0 +1,15 @@
+defmodule Pleroma.Docs.JSON do
+ @behaviour Pleroma.Docs.Formatter
+ def process(descriptions) do
+ config_path = "docs/generate_config.json"
+ {:ok, file} = File.open(config_path, [:write])
+ json = generate_json(descriptions)
+ IO.write(file, json)
+ :ok = File.close(file)
+ {:ok, config_path}
+ end
+
+ def generate_json(descriptions) do
+ Jason.encode!(descriptions)
+ end
+end