Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 25a2f397 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

display results and status in param.sh + generalising set_link_labels

parent c5b83d0c
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,13 @@ def get_parameter( params, key, default='' ):
return value.replace( '___', '\n' )
def set_link_labels( text ):
return set_link_labels_gen( text, True )
def set_html_link_labels( text ):
return set_link_labels_gen( text, False )
# mkdn=True: markdown, otherwise HTML
def set_link_labels_gen( text, mkdn ):
regExp = '^(.*?)(\[?\[?[0-9]{8}(a|b)?-NOOR\]?\]?)(.*)$'
lookForLabels = True;
newText = ''
......@@ -52,12 +59,30 @@ def set_link_labels( text ):
newText += text[:pos]
text = text[pos+len(label):]
if label.startswith('['):
label = label[1:-1]
if label.startswith('['):
label = label[1:-1]
newText += "["+label+"](../"+label+")"
label = label[1:]
if label.endswith(']'):
label = label[:-1]
if mkdn:
newText += "[["+label+"](../"+label+")]"
else:
newText += '[<a href="../'+label+'">'+label+'</a>]'
else:
newText += text
lookForLabels = False
return newText
def htmlResultAndStatus( result, status, desc, ref ):
line1 = '<b>'+result+'</b>'
if ref:
line1 += ' ['+ref+']' # Hypertext too complex (moex/exmo)
if status == "VALID":
line2 = "" # lightgreen
elif status == "INVALID":
line2 = '<span style="background-color: red;">' + set_html_link_labels( desc ) + '</span>'
elif status == "UNCERTAIN":
line2 = '<span style="background-color: orange;">' + set_html_link_labels( desc ) + '</span>'
elif status == "SUBSUMED":
line2 = '<span style="background-color: lightblue;">Repeated in '+ set_html_link_labels( desc ) +'</span>'
if line2:
line1 += '<br />'+line2
return line1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment