From 2cacf6885cafa276985324924a038618b0bb10fd Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Tue, 8 Nov 2011 08:55:08 +0100 Subject: Add CSS stylesheet for the text and tables in Common Test and Test Server Also make general improvements of presentation of results. OTP-9706 --- lib/test_server/src/erl2html2.erl | 49 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'lib/test_server/src/erl2html2.erl') diff --git a/lib/test_server/src/erl2html2.erl b/lib/test_server/src/erl2html2.erl index c94d4627f9..0520f05df7 100644 --- a/lib/test_server/src/erl2html2.erl +++ b/lib/test_server/src/erl2html2.erl @@ -32,32 +32,34 @@ %-------------------------------------------------------------------- -module(erl2html2). --export([convert/2]). +-export([convert/2, convert/3]). convert([], _Dest) -> % Fake clause. ok; convert(File, Dest) -> + %% The generated code uses the BGCOLOR attribute in the + %% BODY tag, which wasn't valid until HTML 3.2. Also, + %% good HTML should either override all colour attributes + %% or none of them -- *never* just a few. + %% + %% FIXME: The colours should *really* be set with + %% stylesheets... + Header = ["\n" + "\n" + "\n" + "", File, "\n\n" + "\n"], + convert(File, Dest, Header). + +convert(File, Dest, Header) -> case file:read_file(File) of {ok, Bin} -> Code=binary_to_list(Bin), statistics(runtime), - %% The generated code uses the BGCOLOR attribute in the - %% BODY tag, which wasn't valid until HTML 3.2. Also, - %% good HTML should either override all colour attributes - %% or none of them -- *never* just a few. - %% - %% FIXME: The colours should *really* be set with - %% stylesheets... - Html0 - = ["\n" - "\n" - "\n" - "", File, "\n\n" - "\n"], {Html1, Lines} = root(Code, [], 1), - Html = [Html0, + Html = [Header, "
\n", Html1, "
\n", footer(Lines),"\n\n"], file:write_file(Dest, Html); @@ -174,9 +176,10 @@ linenum(Line) -> [A,Pred,integer_to_list(Line),":"]. footer(Lines) -> - {_, Time} = statistics(runtime), -% io:format("Converted ~p lines in ~.2f Seconds.~n", -% [Lines, Time/1000]), - S = "The transformation of this file (~p lines) took ~.2f seconds", - F = lists:flatten(io_lib:format(S, [Lines, Time/1000])), - ["
",F,"
\n"]. + "". +%% {_, Time} = statistics(runtime), +%% io:format("Converted ~p lines in ~.2f Seconds.~n", +%% [Lines, Time/1000]), +%% S = "The transformation of this file (~p lines) took ~.2f seconds", +%% F = lists:flatten(io_lib:format(S, [Lines, Time/1000])), +%% ["
",F,"
\n"]. -- cgit v1.2.3