gen_rule_result(Stream,Rule,BState,ProfileList) :-
get_rule_status(BState,Rule,Status,CounterEx,SuccessMsg,FailDep,NotExecDep),
(Status = 'SUCCESS'
-> (length(SuccessMsg,Len), Len > 0
-> format(Stream,' <div class="rule-header pointer green" onclick="openDetails(\'~w\')">~n',[Rule])
; format(Stream,' <div class="rule-header green">~n',[]))
; Status = 'FAIL'
-> format(Stream,' <div class="rule-header pointer red" onclick="openDetails(\'~w\')">~n',[Rule]),
format(Stream,' <span class="icon">⚠</span>~n',[])
; Status = 'DISABLED' -> format(Stream,' <div class="rule-header grey">~n',[])
; Status = 'NOT_CHECKED'
-> ((FailDep \= [] ; NotExecDep \= [])
-> (FailDep \= [] -> C = 'orange' ; C = 'lightgrey'), % FAIL dependencies: orange, else grey
P = 'pointer'
; C = 'white', P = '' % no conflicts with dependencies
),
format(Stream,' <div class="rule-header ~w ~w" onclick="openDetails(\'~w\')">~n',[P,C,Rule]),
(C = 'orange' -> format(Stream,' <span class="icon">⚠</span>~n',[]) ; true)
; format(Stream,' <div class="rule-header">~n',[])
),
format(Stream,' ~w',[Rule]),
(rule_id(Rule,RuleId)
-> format(Stream,' [~w]~n',[RuleId])
; format(Stream,'~n',[])),
(tags(Rule,Tags)
-> format(Stream,' ~n',[]),
forall(member(Tag,Tags), format(Stream,' <div class="tag">~w</div>~n',[Tag])),
format(Stream,' ~n',[])
; true),
format(Stream,' <b>~w</b>~n',[Status]),
(member(list([Rule,_,WT,_,_,_,_]),ProfileList)
-> convert_ms_s(WT,WTPrint),
format(Stream,' <span style="float: right;"><em>(~w)</em></span>~n',[WTPrint])
; true), % ignore if not available
format(Stream,' </div>~n',[]),
gen_rule_content_list(Stream,Rule,CounterEx,SuccessMsg,FailDep,NotExecDep),
fail.
gen_rule_result(_Stream,_,_,_).