Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pySake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
moex
pySake
Commits
25a2f397
Commit
25a2f397
authored
2 years ago
by
Jérôme Euzenat
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebook/params.py
+29
-4
29 additions, 4 deletions
notebook/params.py
with
29 additions
and
4 deletions
notebook/params.py
+
29
−
4
View file @
25a2f397
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment