mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
New 'note' field in commands and options documentation
This commit is contained in:
parent
78c09789f7
commit
999d0af502
@ -51,6 +51,7 @@
|
|||||||
desc = "" :: string() | '_' | '$3',
|
desc = "" :: string() | '_' | '$3',
|
||||||
longdesc = "" :: string() | '_',
|
longdesc = "" :: string() | '_',
|
||||||
version = 0 :: integer(),
|
version = 0 :: integer(),
|
||||||
|
note = "" :: string(),
|
||||||
weight = 1 :: integer(),
|
weight = 1 :: integer(),
|
||||||
module :: atom() | '_',
|
module :: atom() | '_',
|
||||||
function :: atom() | '_',
|
function :: atom() | '_',
|
||||||
|
@ -83,6 +83,8 @@ md_tag(h2, V) ->
|
|||||||
[<<"\n__">>, V, <<"__\n\n">>];
|
[<<"\n__">>, V, <<"__\n\n">>];
|
||||||
md_tag(strong, V) ->
|
md_tag(strong, V) ->
|
||||||
[<<"*">>, V, <<"*">>];
|
[<<"*">>, V, <<"*">>];
|
||||||
|
md_tag('div', V) ->
|
||||||
|
[<<"<div class='note-down'>">>, V, <<"</div>">>];
|
||||||
md_tag(_, V) ->
|
md_tag(_, V) ->
|
||||||
V.
|
V.
|
||||||
|
|
||||||
@ -359,7 +361,7 @@ gen_param(Name, Type, Desc, HTMLOutput) ->
|
|||||||
?TAG(dd, ?RAW(Desc))].
|
?TAG(dd, ?RAW(Desc))].
|
||||||
|
|
||||||
gen_doc(#ejabberd_commands{name=Name, tags=_Tags, desc=Desc, longdesc=LongDesc,
|
gen_doc(#ejabberd_commands{name=Name, tags=_Tags, desc=Desc, longdesc=LongDesc,
|
||||||
args=Args, args_desc=ArgsDesc,
|
args=Args, args_desc=ArgsDesc, note=Note,
|
||||||
result=Result, result_desc=ResultDesc}=Cmd, HTMLOutput, Langs) ->
|
result=Result, result_desc=ResultDesc}=Cmd, HTMLOutput, Langs) ->
|
||||||
try
|
try
|
||||||
ArgsText = case ArgsDesc of
|
ArgsText = case ArgsDesc of
|
||||||
@ -387,8 +389,13 @@ gen_doc(#ejabberd_commands{name=Name, tags=_Tags, desc=Desc, longdesc=LongDesc,
|
|||||||
[?TAG(dl, [gen_param(RName, Type, ResultDesc, HTMLOutput)])]
|
[?TAG(dl, [gen_param(RName, Type, ResultDesc, HTMLOutput)])]
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
NoteEl = case Note of
|
||||||
|
"" -> [];
|
||||||
|
_ -> ?TAG('div', "note-down", ?RAW(Note))
|
||||||
|
end,
|
||||||
|
|
||||||
[?TAG(h1, atom_to_list(Name)),
|
[NoteEl,
|
||||||
|
?TAG(h1, atom_to_list(Name)),
|
||||||
?TAG(p, ?RAW(Desc)),
|
?TAG(p, ?RAW(Desc)),
|
||||||
case LongDesc of
|
case LongDesc of
|
||||||
"" -> [];
|
"" -> [];
|
||||||
|
@ -159,6 +159,10 @@ opt_to_man(Lang, {Option, Options, Children}, Level) ->
|
|||||||
lists:keysort(1, Children))]) ++
|
lists:keysort(1, Children))]) ++
|
||||||
[io_lib:nl()|format_example(Level, Lang, Options)].
|
[io_lib:nl()|format_example(Level, Lang, Options)].
|
||||||
|
|
||||||
|
format_option(Lang, Option, #{note := Note, value := Val}) ->
|
||||||
|
"\n\n_Note_ about the next option: " ++ Note ++ ":\n\n"++
|
||||||
|
"*" ++ atom_to_list(Option) ++ "*: 'pass:[" ++
|
||||||
|
tr(Lang, Val) ++ "]'::";
|
||||||
format_option(Lang, Option, #{value := Val}) ->
|
format_option(Lang, Option, #{value := Val}) ->
|
||||||
"*" ++ atom_to_list(Option) ++ "*: 'pass:[" ++
|
"*" ++ atom_to_list(Option) ++ "*: 'pass:[" ++
|
||||||
tr(Lang, Val) ++ "]'::";
|
tr(Lang, Val) ++ "]'::";
|
||||||
|
Loading…
Reference in New Issue
Block a user