From fe63f7705b5feef0a5eb67a4c3ed47c38301788b Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 14 Jun 2016 17:54:40 +0200 Subject: Present OTP base version on top html documentation page --- system/doc/top/Makefile | 5 +++-- system/doc/top/src/erl_html_tools.erl | 28 ++++++++++++++-------------- system/doc/top/templates/index.html.src | 4 ++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/system/doc/top/Makefile b/system/doc/top/Makefile index 6aa9d8d340..7f9cec540b 100644 --- a/system/doc/top/Makefile +++ b/system/doc/top/Makefile @@ -121,10 +121,11 @@ $(HTMLDIR)/index.html + $(HTMLDIR)/applications.html: $(INDEX_SCRIPT) $(TEMPLATE # Check if we are building the index from source or an installed release if test "$$RELEASE_ROOT" = "" ; then \ $(ERL) -noshell -pa $(EBIN) -s erl_html_tools top_index src $(ERL_TOP) \ - $(HTMLDIR) $(SYSTEM_VSN) -s erlang halt ;\ + $(HTMLDIR) `cat "$(ERL_TOP)/OTP_VERSION"` -s erlang halt ;\ else \ $(ERL) -noshell -pa $(EBIN) -s erl_html_tools top_index rel $(RELEASE_ROOT) \ - $(HTMLDIR) $(SYSTEM_VSN) -s erlang halt ;\ + $(HTMLDIR) `cat "$(RELEASE_ROOT)/releases/$(SYSTEM_VSN)/OTP_VERSION"` \ + -s erlang halt ;\ fi diff --git a/system/doc/top/src/erl_html_tools.erl b/system/doc/top/src/erl_html_tools.erl index ab58fdf666..d55c2e1164 100644 --- a/system/doc/top/src/erl_html_tools.erl +++ b/system/doc/top/src/erl_html_tools.erl @@ -54,24 +54,24 @@ top_index() -> top_index(src, Value, filename:join(Value, "doc"), RelName) end. -top_index([src, RootDir, DestDir, OtpRel]) - when is_atom(RootDir), is_atom(DestDir), is_atom(OtpRel) -> - top_index(src, atom_to_list(RootDir), atom_to_list(DestDir), atom_to_list(OtpRel)); -top_index([rel, RootDir, DestDir, OtpRel]) - when is_atom(RootDir), is_atom(DestDir), is_atom(OtpRel) -> - top_index(rel, atom_to_list(RootDir), atom_to_list(DestDir), atom_to_list(OtpRel)); +top_index([src, RootDir, DestDir, OtpBaseVsn]) + when is_atom(RootDir), is_atom(DestDir), is_atom(OtpBaseVsn) -> + top_index(src, atom_to_list(RootDir), atom_to_list(DestDir), atom_to_list(OtpBaseVsn)); +top_index([rel, RootDir, DestDir, OtpBaseVsn]) + when is_atom(RootDir), is_atom(DestDir), is_atom(OtpBaseVsn) -> + top_index(rel, atom_to_list(RootDir), atom_to_list(DestDir), atom_to_list(OtpBaseVsn)); top_index(RootDir) when is_atom(RootDir) -> {_,RelName} = init:script_id(), top_index(rel, RootDir, filename:join(RootDir, "doc"), RelName). -top_index(Source, RootDir, DestDir, OtpRel) -> +top_index(Source, RootDir, DestDir, OtpBaseVsn) -> report("****\nRootDir: ~p", [RootDir]), report("****\nDestDir: ~p", [DestDir]), - report("****\nOtpRel: ~p", [OtpRel]), + report("****\nOtpBaseVsn: ~p", [OtpBaseVsn]), - put(otp_release, OtpRel), + put(otp_base_vsn, OtpBaseVsn), Templates = find_templates(["","templates",DestDir]), report("****\nTemplates: ~p", [Templates]), @@ -81,9 +81,9 @@ top_index(Source, RootDir, DestDir, OtpRel) -> report("****\nGroups: ~p", [Groups]), process_templates(Templates, DestDir, Groups). -top_index_silent(RootDir, DestDir, OtpRel) -> +top_index_silent(RootDir, DestDir, OtpBaseVsn) -> put(silent,true), - Result = top_index(rel, RootDir, DestDir, OtpRel), + Result = top_index(rel, RootDir, DestDir, OtpBaseVsn), erase(silent), Result. @@ -361,7 +361,7 @@ subst_template_1(Group, Stream, Info) -> case file:read(Stream, 100000) of {ok, Template} -> Fun = fun(Match, _) -> {subst(Match, Info, Group),Info} end, - gsub(Template, "#[A-Za-z0-9]+#", Fun, Info); + gsub(Template, "#[A-Za-z_0-9]+#", Fun, Info); {error, Reason} -> {error, Reason} end. @@ -379,8 +379,8 @@ get_version(Info) -> "" end. -subst("#release#", _Info, _Group) -> - get(otp_release); +subst("#otp_base_vsn#", _Info, _Group) -> + get(otp_base_vsn); subst("#version#", Info, _Group) -> get_version(Info); subst("#copyright#", _Info, _Group) -> diff --git a/system/doc/top/templates/index.html.src b/system/doc/top/templates/index.html.src index 9637685946..ffda92f45f 100644 --- a/system/doc/top/templates/index.html.src +++ b/system/doc/top/templates/index.html.src @@ -22,7 +22,7 @@ limitations under the License. - Erlang/OTP #release# + Erlang/OTP #otp_base_vsn#