diff options
Diffstat (limited to 'lib/docbuilder')
-rw-r--r-- | lib/docbuilder/src/docb_edoc_xml_cb.erl | 91 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_html.erl | 27 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_html_util.erl | 17 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_main.erl | 27 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_pretty_format.erl | 4 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_tr_application2html.erl | 12 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_tr_cite2html.erl | 22 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_tr_index2html.erl | 4 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_tr_part2html.erl | 15 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_tr_term2html.erl | 22 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_transform.erl | 4 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_util.erl | 8 | ||||
-rw-r--r-- | lib/docbuilder/src/docb_xmerl_tree_cb.erl | 4 | ||||
-rw-r--r-- | lib/docbuilder/vsn.mk | 13 |
14 files changed, 113 insertions, 157 deletions
diff --git a/lib/docbuilder/src/docb_edoc_xml_cb.erl b/lib/docbuilder/src/docb_edoc_xml_cb.erl index 4dba843341..90491bc007 100644 --- a/lib/docbuilder/src/docb_edoc_xml_cb.erl +++ b/lib/docbuilder/src/docb_edoc_xml_cb.erl @@ -340,9 +340,7 @@ otp_xmlify_e(#xmlElement{name=code} = E) -> % 4) [E#xmlElement{content=Content}] end; otp_xmlify_e(#xmlElement{name=Tag} = E) % 5a - when Tag==h1; Tag==h2; Tag==h3; Tag==h4; Tag==h5; - Tag==center; - Tag==font -> + when Tag==h1; Tag==h2; Tag==h3; Tag==h4; Tag==h5 -> Content = text_only(E#xmlElement.content), [E#xmlElement{name=b, content=Content}]; otp_xmlify_e(#xmlElement{name=Tag} = E) % 5b-c) @@ -354,21 +352,16 @@ otp_xmlify_e(#xmlElement{name=table} = E) -> % 6) module -> otp_xmlify_table(E#xmlElement.content); overview -> - case get_attrval(border, E) of - "" -> % implies border="0" - [{p, otp_xmlify_table(E#xmlElement.content)}]; - "0" -> - [{p, otp_xmlify_table(E#xmlElement.content)}]; - _Val -> - Content0 = otp_xmlify_e(E#xmlElement.content), - Summary = #xmlText{value=get_attrval(summary, E)}, - TCaption = E#xmlElement{name=tcaption, - attributes=[], - content=[Summary]}, - Content = Content0 ++ [TCaption], - [E#xmlElement{attributes=[], content=Content}] - end + Content0 = otp_xmlify_e(E#xmlElement.content), + Summary = #xmlText{value=get_attrval(summary, E)}, + TCaption = E#xmlElement{name=tcaption, + attributes=[], + content=[Summary]}, + Content = Content0 ++ [TCaption], + [E#xmlElement{attributes=[], content=Content}] end; +otp_xmlify_e(#xmlElement{name=tbody} = E) -> + otp_xmlify_e(E#xmlElement.content); otp_xmlify_e(#xmlElement{name=sup} = E) -> % 7) Text = get_text(E), [#xmlText{parents = E#xmlElement.parents, @@ -478,31 +471,29 @@ otp_xmlify_a_href("#"++_ = Marker, Es0) -> % <seealso marker="#what"> otp_xmlify_a_href("http:"++_ = URL, Es0) -> % external URL {URL, Es0}; otp_xmlify_a_href("OTPROOT"++AppRef, Es0) -> % <.. marker="App:FileRef - case split(AppRef, "/") of - [AppS, "doc", FileRef1] -> - FileRef = AppS++":"++otp_xmlify_a_fileref(FileRef1, AppS), - [#xmlText{value=Str0} = T] = Es0, - Str = case split(Str0, "/") of - %% //Application - [AppS2] -> - %% AppS2 can differ from AppS - %% Example: xmerl/XMerL - AppS2; - [_AppS,ModRef] -> - case split(ModRef, ":") of - %% //Application/Module - [Module] -> - Module++"(3)"; - %% //Application/Module:Type() - [_Module,_Type] -> - ModRef - end; - %% //Application/Module:Function/Arity - [_AppS,ModFunc,Arity] -> - ModFunc++"/"++Arity - end, - {FileRef, [T#xmlText{value=Str}]} - end; + [AppS, "doc", FileRef1] = split(AppRef, "/"), + FileRef = AppS++":"++otp_xmlify_a_fileref(FileRef1, AppS), + [#xmlText{value=Str0} = T] = Es0, + Str = case split(Str0, "/") of + %% //Application + [AppS2] -> + %% AppS2 can differ from AppS + %% Example: xmerl/XMerL + AppS2; + [_AppS,ModRef] -> + case split(ModRef, ":") of + %% //Application/Module + [Module] -> + Module++"(3)"; + %% //Application/Module:Type() + [_Module,_Type] -> + ModRef + end; + %% //Application/Module:Function/Arity + [_AppS,ModFunc,Arity] -> + ModFunc++"/"++Arity + end, + {FileRef, [T#xmlText{value=Str}]}; otp_xmlify_a_href("../"++File, Es0) -> %% Special case: This kind of relative path is used on some %% places within i.e. EDoc and refers to a file within the same @@ -639,13 +630,13 @@ otp_xmlify_table([#xmlText{} = E|Es]) -> [E | otp_xmlify_table(Es)]; otp_xmlify_table([#xmlElement{name=tbody} = E|Es]) -> otp_xmlify_table(E#xmlElement.content)++otp_xmlify_table(Es); -otp_xmlify_table([#xmlElement{name=tr} = E|Es]) -> +otp_xmlify_table([#xmlElement{name=tr, content=Content}|Es]) -> %% Insert newlines between table rows - otp_xmlify_table(E#xmlElement.content)++[{br,[]}]++otp_xmlify_table(Es); -otp_xmlify_table([#xmlElement{name=th} = E|Es]) -> - [{em, E#xmlElement.content} | otp_xmlify_table(Es)]; -otp_xmlify_table([#xmlElement{name=td} = E|Es]) -> - otp_xmlify_e(E#xmlElement.content) ++ otp_xmlify_table(Es); + otp_xmlify_table(Content)++[{br,[]}]++otp_xmlify_table(Es); +otp_xmlify_table([#xmlElement{name=th, content=Content}|Es]) -> + [{em, Content} | otp_xmlify_table(Es)]; +otp_xmlify_table([#xmlElement{name=td, content=Content}|Es]) -> + otp_xmlify_e(Content) ++ otp_xmlify_table(Es); otp_xmlify_table([]) -> []. @@ -1155,8 +1146,8 @@ get_text(#xmlElement{content=[E]}) -> %% text_only(Es) -> Ts %% Takes a list of xmlElement and xmlText and return a lists of xmlText. -text_only([#xmlElement{} = E |Es]) -> - text_only(E#xmlElement.content) ++ text_only(Es); +text_only([#xmlElement{content = Content}|Es]) -> + text_only(Content) ++ text_only(Es); text_only([#xmlText{} = E |Es]) -> [E | text_only(Es)]; text_only([]) -> diff --git a/lib/docbuilder/src/docb_html.erl b/lib/docbuilder/src/docb_html.erl index 9aea4c8a66..bdfc5ea876 100644 --- a/lib/docbuilder/src/docb_html.erl +++ b/lib/docbuilder/src/docb_html.erl @@ -283,16 +283,16 @@ rule([term|_], {_, [ID], _}, Opts) -> ID, "</strong></em> "]}, Opts}; TermList -> - case lists:keysearch(ID, 1, TermList) of + case lists:keyfind(ID, 1, TermList) of false -> {{drop, ["<em><strong>", ID, "</strong></em> "]}, Opts}; - {value, {ID, Name, _Description, _Resp}} -> + {ID, Name, _Description, _Resp} -> {{drop, ["<em><strong>", Name, "</strong></em> "]}, Opts}; - {value, {ID, Name, _Description}} -> + {ID, Name, _Description} -> {{drop, [ "<em><strong>", Name, "</strong></em> "]}, Opts} @@ -306,16 +306,16 @@ rule([term|_], {_, [ID], _}, Opts) -> TermList -> PartApplication = docb_util:lookup_option(part_application, Opts), - case lists:keysearch(ID, 1, TermList) of + case lists:keyfind(ID, 1, TermList) of false -> {{drop, ["<a href=\"", PartApplication, "_term.html#", ID, "\">", ID, "</a> "]}, Opts}; - {value, {ID, Name, _Description, _Resp}} -> + {ID, Name, _Description, _Resp} -> {{drop, ["<a href=\"", PartApplication, "_term.html#", ID, "\">", Name, "</a> "]}, Opts}; - {value, {ID, Name, _Description}} -> + {ID, Name, _Description} -> {{drop, ["<a href=\"", PartApplication, "_term.html#", ID, "\">", Name, "</a> "]}, Opts} @@ -331,17 +331,16 @@ rule([cite|_], {_, [ID], _}, Opts) -> {{drop, ["<em><strong>", ID, "</strong></em> "]}, Opts}; CiteList -> - case lists:keysearch(ID, 1, CiteList) of + case lists:keyfind(ID, 1, CiteList) of false -> {{drop, ["<em><strong>", ID, "</strong></em> "]}, Opts}; - - {value, {ID, Name, _Description, _Resp}} -> + {ID, Name, _Description, _Resp} -> {{drop, ["<em><strong>", Name, "</strong></em> "]}, Opts}; - {value, {ID, Name, _Description}} -> + {ID, Name, _Description} -> {{drop, ["<em><strong>", Name, "</strong></em> "]}, Opts} @@ -355,18 +354,18 @@ rule([cite|_], {_, [ID], _}, Opts) -> CiteList -> PartApp = docb_util:lookup_option(part_application, Opts), - case lists:keysearch(ID, 1, CiteList) of + case lists:keyfind(ID, 1, CiteList) of false -> {{drop, ["<a href=\"", PartApp, "_cite.html#", ID, "\">", ID, "</a> "]}, Opts}; - {value, {ID, Name, _Description, _Resp}} -> + {ID, Name, _Description, _Resp} -> {{drop, ["<a href=\"", PartApp, "_cite.html#", ID, "\">", Name, "</a> "]}, Opts}; - {value, {ID, Name, _Description}} -> + {ID, Name, _Description} -> {{drop, ["<a href=\"", PartApp, "_cite.html#", ID, "\">", Name, "</a> "]}, @@ -376,7 +375,7 @@ rule([cite|_], {_, [ID], _}, Opts) -> end; rule([code|_], {_, [Type], [{pcdata, _, Code}]}, Opts) -> - case lists:member(Type,["ERL","C","NONE"]) of + case lists:member(Type, ["ERL","C","NONE"]) of true -> {{drop, ["\n<div class=\"example\"><pre>\n", docb_html_util:element_cdata_to_html(Code), "\n</pre></div>\n"]}, Opts}; diff --git a/lib/docbuilder/src/docb_html_util.erl b/lib/docbuilder/src/docb_html_util.erl index b2951706ea..02ce8b52a7 100644 --- a/lib/docbuilder/src/docb_html_util.erl +++ b/lib/docbuilder/src/docb_html_util.erl @@ -136,7 +136,6 @@ copy_pics(Src, Dest, Opts) -> Dir = code:lib_dir(docbuilder), InFile = filename:join([Dir, "etc", Src]), OutFile = docb_util:outfile(Dest, "", Opts), - case filelib:last_modified(OutFile) of 0 -> % File doesn't exist file:copy(InFile, OutFile); @@ -156,10 +155,10 @@ copy_pics(Src, Dest, Opts) -> %%--Resolve header data------------------------------------------------- extract_header_data(Key, {header, [], List}) -> - case lists:keysearch(Key, 1, List) of - {value, {Key, [], []}} -> + case lists:keyfind(Key, 1, List) of + {Key, [], []} -> ""; - {value, {Key, [], [{pcdata, [], Value}]}} -> + {Key, [], [{pcdata, [], Value}]} -> pcdata_to_html(Value); false -> "" @@ -253,7 +252,7 @@ make_anchor_href(HRef) -> {ok, [HRef]} -> %% No `#' in HRef, i.e. only path make_anchor_href(HRef, ""); - {ok, [Path, Fragment]}-> + {ok, [Path, Fragment]} -> make_anchor_href(Path, Fragment) end. @@ -398,10 +397,10 @@ count_sections([]) -> %%--Make a ToC---------------------------------------------------------- format_toc(Toc) -> - lists:map(fun({Number, Title}) -> - [Number, " <a href = \"#", Number, - "\">", Title, "</a><br/>\n"] - end, Toc). + [format_toc1(T) || T <- Toc]. + +format_toc1({Number, Title}) -> + [Number, " <a href = \"#", Number, "\">", Title, "</a><br/>\n"]. %%--Convert HTML ISO Latin 1 characters to ordinary characters---------- diff --git a/lib/docbuilder/src/docb_main.erl b/lib/docbuilder/src/docb_main.erl index ef21f65557..87a1401a02 100644 --- a/lib/docbuilder/src/docb_main.erl +++ b/lib/docbuilder/src/docb_main.erl @@ -55,7 +55,7 @@ process(File, Opts) -> %% If no target format is specified, assume HTML: Tos = if - Tos0==[] -> [html]; + Tos0 =:= [] -> [html]; true -> Tos0 end, @@ -327,12 +327,8 @@ verify(Tree) -> verify(Tree, [], 1). verify({pcdata, Optional, _}, Path, Level) -> verify_optional(Optional, Path, Level); verify({Tag, Optional, Args}, Path, Level) when is_list(Args) -> - case verify_optional(Optional, Path, Level) of - true -> - verify_list(Args, [Tag|Path], Level); - false -> - false - end; + verify_optional(Optional, Path, Level) + andalso verify_list(Args, [Tag|Path], Level); verify(Other, Path, Level) -> verify_error(Other, Path, Level). @@ -342,12 +338,7 @@ verify_error(X, Path, Level) -> false. verify_list([H|T], Path, Level) -> - case verify(H, Path, Level) of - true -> - verify_list(T, Path, Level +1); - false -> - false - end; + verify(H, Path, Level) andalso verify_list(T, Path, Level + 1); verify_list([], _, _) -> true. @@ -419,7 +410,7 @@ edit1_list(_Tag, [], _Op) -> %% Actual transformation of tree structure to desired format. transform(From, To, Opts, File, Tree) -> Filter = if - To==html; To==kwic -> + To =:= html; To =:= kwic -> list_to_atom("docb_tr_" ++ atom_to_list(From) ++ [$2|atom_to_list(To)]); true -> @@ -427,7 +418,7 @@ transform(From, To, Opts, File, Tree) -> [$2|atom_to_list(To)]) end, - case catch apply(Filter, transform, [File, Tree, Opts]) of + case catch Filter:transform(File, Tree, Opts) of %% R5C {'EXIT', {undef, [{Filter, transform, [File, Tree, Opts]}|_]}}-> @@ -459,9 +450,9 @@ transform(From, To, Opts, File, Tree) -> finish_transform(Tree, File, Opts, Filter) -> {Str, NewOpts} = pp(Tree, [], 1, Filter, Opts), Extension = - case catch apply(Filter, extension, [NewOpts]) of + case catch Filter:extension(NewOpts) of {'EXIT', _} -> - apply(Filter, extension, []); + Filter:extension(); Others -> Others end, @@ -606,7 +597,7 @@ include_all(Fd) -> eof -> []; ListOfChars -> - lists:append(ListOfChars, include_all(Fd)) + ListOfChars ++ include_all(Fd) end. extract(File, Fd, StartTag, StopTag, State) -> diff --git a/lib/docbuilder/src/docb_pretty_format.erl b/lib/docbuilder/src/docb_pretty_format.erl index 0c4fb0507b..25dcd8987b 100644 --- a/lib/docbuilder/src/docb_pretty_format.erl +++ b/lib/docbuilder/src/docb_pretty_format.erl @@ -47,7 +47,7 @@ term(Term) -> %% the next line to need an "extra" indent!). term([], Indent) -> {Indent, [$[,$]]}; -term(L, Indent) when list(L) -> +term(L, Indent) when is_list(L) -> case is_string(L) of true -> {Indent, io_lib:write_string(L)}; @@ -59,7 +59,7 @@ term(L, Indent) when list(L) -> write_simple_list(L, Indent) end end; -term(T, Indent) when tuple(T) -> +term(T, Indent) when is_tuple(T) -> case complex_tuple(T) of true -> write_complex_tuple(T, Indent); diff --git a/lib/docbuilder/src/docb_tr_application2html.erl b/lib/docbuilder/src/docb_tr_application2html.erl index 4084cfe6ba..d8cb214d0a 100644 --- a/lib/docbuilder/src/docb_tr_application2html.erl +++ b/lib/docbuilder/src/docb_tr_application2html.erl @@ -119,8 +119,8 @@ transform(File, {application, _Attrs, [Header|Rest]}, Opts0) -> case docb_main:parse1("fascicules", Opts0) of {ok, Parse} -> FascData = get_fasc_data(Parse), - case lists:keysearch(File, 1, FascData) of - {value, {_, _, "YES", _}} -> + case lists:keyfind(File, 1, FascData) of + {_, _, "YES", _} -> OrigFile = docb_util:outfile(File++"_frame", ".html", Opts0), @@ -167,7 +167,7 @@ concat_files([File|Rest], Body, Opts) -> %% Remove the reference manual header [{Ref, [], [_Hdr| NewBody]}] = NewParse, RefParse = [{Ref, [], NewBody}], - lists:append(Body, concat_files(Rest, RefParse, Opts)); + Body ++ concat_files(Rest, RefParse, Opts); errors -> errors end; @@ -216,7 +216,7 @@ make_toc([{lib, Attrs, More}|Rest]) -> make_toc([{com, Attrs, More}|Rest]) -> [{com, Attrs, More}|make_toc(Rest)]; make_toc([{_Tag, _Attrs, More}|Rest]) -> - lists:append(make_toc(More), make_toc(Rest)). + make_toc(More) ++ make_toc(Rest). rule([module|_], {_, [File], _}) -> {"<small><a target=\"document\" href=\"" ++ @@ -280,9 +280,7 @@ get_fasc_data({fascicules, _, Fascs}) -> Fascs). get_avals(Atts) -> - lists:map(fun(Tuple) -> - element(3, Tuple) end, - Atts). + [element(3, Tuple) || Tuple <- Atts]. get_pc_text([{pcdata, _, Text}]) -> Text. diff --git a/lib/docbuilder/src/docb_tr_cite2html.erl b/lib/docbuilder/src/docb_tr_cite2html.erl index 4ecbfa4e91..77f1c4e636 100644 --- a/lib/docbuilder/src/docb_tr_cite2html.erl +++ b/lib/docbuilder/src/docb_tr_cite2html.erl @@ -39,24 +39,22 @@ purge_body([], _) -> purge_body([{pcdata,_Attrs,_More}|Rest], CiteList) -> purge_body(Rest, CiteList); purge_body([{cite,[{"ID","CDATA",ID}],More}|Rest], CiteList) -> - case lists:keysearch(ID, 1, CiteList) of + case lists:keyfind(ID, 1, CiteList) of false -> [{cite, [{"NAME","CDATA",ID}, {"ID","CDATA",ID}], More}| purge_body(Rest, CiteList)]; - {value, {ID, Name, _Description, _Responsible}} -> + {ID, Name, _Description, _Responsible} -> [{cite, [{"NAME","CDATA",Name}, {"ID","CDATA",ID}], More}| purge_body(Rest, CiteList)]; - {value, {ID, Name, _Description}} -> + {ID, Name, _Description} -> [{cite, [{"NAME","CDATA",Name}, {"ID","CDATA",ID}], More}| purge_body(Rest, CiteList)] end; purge_body([{_Tag,_Attrs,More}|Rest], CiteList) -> - lists:append(purge_body(More, CiteList), - purge_body(Rest, CiteList)). + purge_body(More, CiteList) ++ purge_body(Rest, CiteList). rule([header|_], _) -> {drop, ""}; - rule(_, _) -> {drop, ""}. @@ -91,19 +89,19 @@ rule([cite|_], {_,[Name,ID], [{citedef,[],[{pcdata,[],Def}]}]}, Opts) -> false -> []; Value -> Value end, - case lists:keysearch(ID, 1, CiteList) of + case lists:keyfind(ID, 1, CiteList) of false -> {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ ID ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Def) ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description, _Responsible}} -> + {ID, Name, Description, _Responsible} -> docb_util:message(warning, "Global cite ~s overriding local", [ID]), {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description}} -> + {ID, Name, Description} -> docb_util:message(warning, "Global cite ~s overriding local", [ID]), {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ @@ -117,19 +115,19 @@ rule([cite|_], {_,[Name,ID],_}, Opts) -> false -> []; Value -> Value end, - case lists:keysearch(ID, 1, CiteList) of + case lists:keyfind(ID, 1, CiteList) of false -> docb_util:message(error, "The cite ~s has no definition", [ID]), {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ ID ++ "</strong></a></dt>\n<dd>" ++ "??" ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description, _Responsible}} -> + {ID, Name, Description, _Responsible} -> {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description}} -> + {ID, Name, Description} -> {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts} diff --git a/lib/docbuilder/src/docb_tr_index2html.erl b/lib/docbuilder/src/docb_tr_index2html.erl index bbf419f3ef..312342add2 100644 --- a/lib/docbuilder/src/docb_tr_index2html.erl +++ b/lib/docbuilder/src/docb_tr_index2html.erl @@ -73,9 +73,7 @@ prune_flat([], _) -> []. keep_pcdata(Trees) -> - lists:filter(fun({pcdata, _, _}) -> true; - (_) -> false - end, Trees). + [T || T = {pcdata, _, _} <- Trees]. new_trees(FileFuncs) -> Files0 = [{File, RefType} || {File, RefType, _} <- FileFuncs], diff --git a/lib/docbuilder/src/docb_tr_part2html.erl b/lib/docbuilder/src/docb_tr_part2html.erl index dd44c4a8df..30befe8432 100644 --- a/lib/docbuilder/src/docb_tr_part2html.erl +++ b/lib/docbuilder/src/docb_tr_part2html.erl @@ -93,8 +93,8 @@ transform(File, {part, _Attrs, [Header| Rest]}, Opts0) -> case docb_main:parse1("fascicules", Opts0) of {ok, Parse} -> FascData = get_fasc_data(Parse), - case lists:keysearch(File, 1, FascData) of - {value, {_, _, "YES", _}} -> + case lists:keyfind(File, 1, FascData) of + {_, _, "YES", _} -> OrigFile = docb_util:outfile(File++"_frame", ".html", Opts0), @@ -137,7 +137,7 @@ concat_files([File | Rest], Body, ChLevel, Opts, TP, TOpts, Ext) -> case docb_main:parse1(File, Opts) of {ok, Parse} -> {TopTag, Attrs, [Header = {header, _, HeaderContents} | More]} = Parse, - {value,{title,_,Title}} = lists:keysearch(title,1,HeaderContents), + {title,_,Title} = lists:keyfind(title,1,HeaderContents), NewMore = [{section, [], [{title, [], Title}| More]}], NewParse = {TopTag, Attrs, [Header| NewMore]}, if @@ -156,9 +156,8 @@ concat_files([File | Rest], Body, ChLevel, Opts, TP, TOpts, Ext) -> docb_html_util:number(NewParse, integer_to_list(ChLevel), File), {_, [], [_| NewBody]} = NumberTree, - lists:append(Body, - concat_files(Rest, NewBody, ChLevel+1, Opts, - TP, TOpts, Ext)); + Body ++ concat_files(Rest, NewBody, ChLevel+1, Opts, + TP, TOpts, Ext); errors -> throw({error,"Parse error when building chapter "++File}) end; @@ -232,9 +231,7 @@ get_fasc_data({fascicules, _, Fascs}) -> Fascs). get_avals(Atts) -> - lists:map(fun(Tuple) -> - element(3, Tuple) end, - Atts). + [element(3, Tuple) || Tuple <- Atts]. get_pc_text([{pcdata, _, Text}]) -> Text. diff --git a/lib/docbuilder/src/docb_tr_term2html.erl b/lib/docbuilder/src/docb_tr_term2html.erl index 0a993cebb1..a3c4a5312a 100644 --- a/lib/docbuilder/src/docb_tr_term2html.erl +++ b/lib/docbuilder/src/docb_tr_term2html.erl @@ -39,24 +39,22 @@ purge_body([], _) -> purge_body([{pcdata,_Attrs,_More}|Rest], TermList) -> purge_body(Rest, TermList); purge_body([{term,[{"ID","CDATA",ID}],More}|Rest], TermList) -> - case lists:keysearch(ID, 1, TermList) of + case lists:keyfind(ID, 1, TermList) of false -> [{term,[{"NAME","CDATA",ID},{"ID","CDATA",ID}],More}| purge_body(Rest, TermList)]; - {value, {ID, Name, _Description, _Responsible}} -> + {ID, Name, _Description, _Responsible} -> [{term,[{"NAME","CDATA",Name},{"ID","CDATA",ID}],More}| purge_body(Rest, TermList)]; - {value, {ID, Name, _Description}} -> + {ID, Name, _Description} -> [{term,[{"NAME","CDATA",Name},{"ID","CDATA",ID}],More}| purge_body(Rest, TermList)] end; purge_body([{_Tag,_Attrs,More}|Rest], TermList) -> - lists:append(purge_body(More, TermList), - purge_body(Rest, TermList)). + purge_body(More, TermList) ++ purge_body(Rest, TermList). rule([header|_], _) -> {drop, ""}; - rule(_, _) -> {drop, ""}. @@ -82,19 +80,19 @@ rule([term|_], {_,[Name,ID],[{termdef,[],[{pcdata,[],Def}]}]}, Opts) -> false -> []; Value -> Value end, - case lists:keysearch(ID, 1, TermList) of + case lists:keyfind(ID, 1, TermList) of false -> {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ ID ++ "</strong></a>\n</dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Def) ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description, _Responsible}} -> + {ID, Name, Description, _Responsible} -> docb_util:message(warning, "Global term ~s overriding local", [ID]), {{drop,"\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description}} -> + {ID, Name, Description} -> docb_util:message(warning, "Global term ~s overriding local", [ID]), {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ @@ -107,19 +105,19 @@ rule([term|_], {_,[Name,ID],_}, Opts) -> false -> []; Value -> Value end, - case lists:keysearch(ID, 1, TermList) of + case lists:keyfind(ID, 1, TermList) of false -> docb_util:message(error, "The term ~s has no definition", [ID]), {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ ID ++ "</strong></a></dt>\n<dd>" ++ "??" ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description, _Responsible}} -> + {ID, Name, Description, _Responsible} -> {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts}; - {value, {ID, Name, Description}} -> + {ID, Name, Description} -> {{drop, "\n<dt><a name=\"" ++ ID ++ "\">" ++ "<strong>" ++ Name ++ "</strong></a></dt>\n<dd>" ++ docb_html_util:pcdata_to_html(Description) ++ "\n</dd>\n"}, Opts} diff --git a/lib/docbuilder/src/docb_transform.erl b/lib/docbuilder/src/docb_transform.erl index a432038adf..9c7561b07b 100644 --- a/lib/docbuilder/src/docb_transform.erl +++ b/lib/docbuilder/src/docb_transform.erl @@ -135,8 +135,8 @@ parse([Opt | _RawOpts], _Opts) -> get_defs(Type, File, Opts) -> Key = {defs,Type}, {PrevDefs, Opts2} = - case lists:keysearch(Key, 1, Opts) of - {value, {_, Defs0}} -> + case lists:keyfind(Key, 1, Opts) of + {_, Defs0} -> {Defs0, lists:keydelete(Key, 1, Opts)}; false -> {[], Opts} diff --git a/lib/docbuilder/src/docb_util.erl b/lib/docbuilder/src/docb_util.erl index 59673ef3a4..9b2eec7733 100644 --- a/lib/docbuilder/src/docb_util.erl +++ b/lib/docbuilder/src/docb_util.erl @@ -61,7 +61,7 @@ html_snippet(What, Opts) -> case lookup_option(html_mod, Opts) of false -> ""; Module -> - case catch apply(Module, What, []) of + case catch Module:What() of HTML when is_list(HTML) -> HTML; {'EXIT', {undef, _}} -> @@ -82,7 +82,7 @@ html_snippet(What, Arg, Opts) -> case lookup_option(html_mod, Opts) of false -> ""; Module -> - case catch apply(Module, What, [Arg]) of + case catch Module:What(Arg) of HTML when is_list(HTML) -> HTML; {'EXIT', {undef, _}} -> @@ -106,8 +106,8 @@ html_snippet(What, Arg, Opts) -> %% lookup_option(Opt, Opts) -> Value | false lookup_option(Opt, Opts) -> - case lists:keysearch(Opt, 1, Opts) of - {value, {Opt,Value}} -> Value; + case lists:keyfind(Opt, 1, Opts) of + {Opt,Value} -> Value; false -> false end. diff --git a/lib/docbuilder/src/docb_xmerl_tree_cb.erl b/lib/docbuilder/src/docb_xmerl_tree_cb.erl index d57f55bff8..bc62069230 100644 --- a/lib/docbuilder/src/docb_xmerl_tree_cb.erl +++ b/lib/docbuilder/src/docb_xmerl_tree_cb.erl @@ -188,8 +188,8 @@ attrs(DTD, Tag, GivenAttrs) -> merge_attrs(Tag, default_attrs(DTD, Tag), GivenAttrs). merge_attrs(Tag, [{NameA, Type, DefVal}|Default], GivenAttrs) -> - Val = case lists:keysearch(NameA, #xmlAttribute.name, GivenAttrs) of - {value, #xmlAttribute{value=Val0}} -> Val0; + Val = case lists:keyfind(NameA, #xmlAttribute.name, GivenAttrs) of + #xmlAttribute{value=Val0} -> Val0; false -> DefVal end, Attr = {attr_name(NameA), Type, attr_val(Type, Val)}, diff --git a/lib/docbuilder/vsn.mk b/lib/docbuilder/vsn.mk index 2852ebcc8b..5bb92fd209 100644 --- a/lib/docbuilder/vsn.mk +++ b/lib/docbuilder/vsn.mk @@ -1,14 +1 @@ DOCB_VSN = 0.9.8.7 - -TICKETS = OTP-8343 - -TICKETS_0.9.8.6 = OTP-8201 - -TICKETS_0.9.8.5 = OTP-7851 - -TICKETS_0.9.8.4 = OTP-7236 - -TICKETS_0.9.8.1 = OTP-7236 - - - |