forked from uwiger/edown
-
Notifications
You must be signed in to change notification settings - Fork 7
/
make_doc
executable file
·49 lines (46 loc) · 1.27 KB
/
make_doc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env escript
%% -*- erlang -*-
%% edown is designed to work well with rebar, but in order to use edown
%% to document itself, we need to explicitly set the path to ebin/, so
%% that we pick up the newly built edown doclet. I haven't found a way
%% to do this with 'rebar doc'.
%%
main([]) ->
code:add_patha("ebin"),
Default = "esl",
U = case os:getenv("TGT") of
[] -> Default;
false -> Default;
Str -> Str
end,
TopURL = top_url(U),
io:fwrite("Making edown docs for [~s]...~n", [TopURL]),
R = edoc:application(edown, ".",
[{doclet, edown_doclet},
{source_path, ["src"]},
{app_default,"http://www.erlang.org/doc/man"},
{stylesheet, ""}, % don't copy stylesheet.css
{image, ""}, % don't copy erlang.png
{edown_target, target()},
{top_level_readme,
{"./README.md", TopURL}}]),
case R of
ok ->
halt();
Err ->
io:fwrite("~p~n", [Err]),
halt(1)
end.
top_url(User) ->
case os:getenv("EDOWN_TOP_URL") of
false ->
"http://github.com/" ++ User ++ "/edown";
URL ->
URL
end.
target() ->
case os:getenv("EDOWN_TARGET") of
false -> github;
"github" -> github;
"stash" -> stash
end.