/** * Convert all bug reports / feature requests to HTML. * Two types of HTML output are supported * * "linear" (default) is simple linear output where reports follow each other * in a linear fashion * * "table" is a sortable HTML-table with columns for bug ID, report date, text, DRS, ... * * Usage: * * swipl -f bugs_and_requests.pl -g main -t halt > report.html * swipl -f bugs_and_requests.pl -g "main(table)" -t halt > report.html * * @author Kaarel Kaljurand * @version 2011-06-22 * * @tbd Escape HTML special symbols (< and &) */ % We point to the directory where APE modules and the lexicons are located. :- assert(user:file_search_path(ape, '../prolog')). % We point to the directory where the regression test set is located. :- assert(user:file_search_path(rt, '.')). :- use_module(ape(utils/drs_to_html), [ drs_to_html_nocontainer/2, footer/1 ]). % Consult the regression test set. :- style_check(-singleton). :- consult(rt(acetexts)). :- style_check(+singleton). :- style_check(-atom). main :- main(linear). main(Type) :- current_stream(1, write, Stream), set_stream(Stream, encoding(utf8)), header('APE bugs and ACE feature requests', Header), footer(Footer), write(Header), write('

APE bugs and ACE feature requests

'), make_another_header(Type), forall( text_drs_eval(1, Id, Text, Drs, _Syntax, Date, Author, Comment), ignore(( drs_to_html_nocontainer(Drs, HtmlDrs), display(Type, Id, Text, Date, Author, Comment, HtmlDrs) )) ), make_another_footer(Type), write(Footer). display(linear, Id, Text, Date, Author, Comment, HtmlDrs) :- format('

Comment: ~w


Submitted: ~w by ~w

~n', [Id, Text, Comment, HtmlDrs, Date, Author]). display(table, Id, Text, Date, Author, Comment, HtmlDrs) :- concat_atom([Year, Month, Day | _], '-', Date), format(' ~d ~w ~w ~w ~w ~w', [Id, Year-Month-Day, Text, Comment, HtmlDrs, Author]). make_another_header(table) :- !, write('

Click on a column header to sort by that column.

'). make_another_header(_). make_another_footer(table) :- !, write('
ID Date ACE text Comment DRS Author
'). make_another_footer(_). %% header(+Title:atom, -Header:atom) is det. % % Generate an HTML-header. % % @param Title is the content for the title-element in the HTML-header % @param Header is an HTML header % header(Title, Header) :- with_output_to(atom(Header), format(' ~w ', [Title])).