Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bruno Chareyre
3sr-biblio
Commits
405c971b
Commit
405c971b
authored
Mar 24, 2021
by
Emmanuel Roubin
Browse files
Externialise CSS
parent
dca1b966
Pipeline
#63283
passed with stages
in 26 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
405c971b
...
...
@@ -11,12 +11,13 @@ build:
artifacts
:
paths
:
-
./*.html
-
./biblio.css
pages
:
stage
:
deploy
script
:
-
mkdir public
-
mv *.html public/
-
mv *.html
biblio.css
public/
artifacts
:
paths
:
-
public
biblio.css
0 → 100644
View file @
405c971b
body
{
color
:
#4c5154
;
word-wrap
:
break-word
;
font
:
normal
100%
/
1.5
"montserratregular"
;
}
body
.structure
{
width
:
650px
;
}
body
.perso
{
width
:
900px
;
}
a
{
color
:
#bf3a8d
;
text-decoration
:
none
;
}
a
:hover
{
color
:
#bf3a8d
!important
;
text-decoration
:
underline
;
}
span
.author
a
{
color
:
#4c5154
;
}
span
.author
i
{
cursor
:
help
;
}
span
.article
a
{
color
:
#bf3a8d
;
font-weight
:
bold
;
}
span
.article
a
:before
{
content
:
"\""
}
span
.article
a
:after
{
content
:
"\""
}
span
.doi
a
{
color
:
#4c5154
;
font
:
normal
100%
/
1.5
"courier"
}
span
.doi
:before
{
content
:
"<"
;
font
:
normal
100%
/
1.5
"courier"
}
span
.doi
:after
{
content
:
">"
;
font
:
normal
100%
/
1.5
"courier"
}
span
.journal
{
color
:
#4c5154
;
font-style
:
oblique
;}
ul
{
list-style
:
none
inside
none
;
padding-left
:
2em
;
text-indent
:
-2em
;
}
li
{
margin-bottom
:
5px
;
line-height
:
1.5
}
h4
{
/* font: lighter 1.063em "montserratregular"; */
margin
:
1.176em
0
0.750em
0
}
create_html.py
View file @
405c971b
...
...
@@ -5,71 +5,56 @@ BRIDGE_TYPES = {"ART": "Articles", "COMM": "Conferences", "COUV": "Books", "THES
SORT_BY
=
"producedDate_s"
# "journalDate_s"
N_PUBLI_MAX
=
100
N_PUBLIS
=
[
3
,
5
,
10
,
15
,
50
,
100
]
MAX_AUTHORS
=
3
def
html_publi
(
publi
):
# for k, v in publi.items():
# print(k, v)
cite
=
[]
# get names and urls
try
:
namesLinked
=
[]
authors
=
[]
authors_title
=
[]
searchUrl
=
"https://hal.archives-ouvertes.fr/search/index/q/*"
for
_
in
publi
[
"authFullNameIdHal_fs"
]:
name
,
id
H
al
=
_
.
split
(
"_FacetSep_"
)
searchType
=
"authIdHal_s"
if
id
H
al
else
"authFullName_s"
searchString
=
id
H
al
if
id
H
al
else
name
.
replace
(
" "
,
"+"
)
url
=
"{
}/{}/{}"
.
format
(
searchUrl
,
searchType
,
searchString
)
namesLinked
.
append
(
'<a href="{}" target="_blank">{
}</a>'
.
format
(
url
,
name
)
)
cite
=
[
', '
.
join
(
namesLinked
)]
for
fullname_idhal
,
name
in
zip
(
publi
[
"authFullNameIdHal_fs"
]
,
publi
[
"authLastName_s"
])
:
full
name
,
id
h
al
=
fullname_idhal
.
split
(
"_FacetSep_"
)
searchType
=
"authIdHal_s"
if
id
h
al
else
"authFullName_s"
searchString
=
id
h
al
if
id
h
al
else
full
name
.
replace
(
" "
,
"+"
)
url
=
f
"
{
searchUrl
}
/
{
searchType
}
/
{
searchString
}
"
authors
.
append
(
f
'<
span class="author"><
a href="
{
url
}
" target="_blank">
{
name
.
title
()
}
</a></span>'
)
authors_title
.
append
(
fullname
)
except
:
cite
=
[
', '
.
join
(
publi
[
"authLastNameFirstName_s"
])]
authors
=
publi
[
"authFullName_s"
]
authors_title
=
publi
[
"authFullName_s"
]
if
len
(
authors
)
>
MAX_AUTHORS
:
authors_displayed
=
authors
[:
MAX_AUTHORS
]
authors_displayed
.
append
(
f
'<span class="author"><i>et. al.</i></span>'
)
else
:
authors_displayed
=
authors
cite
.
append
(
f
'<span class="authors" title="
{
", "
.
join
(
publi
.
get
(
"authFullName_s"
,
[]))
}
">[
{
", "
.
join
(
authors_displayed
)
}
]</span>'
)
# get title and url
try
:
cite
.
append
(
'<b>"<a href="{}" target="_blank">{}</a>"</b>'
.
format
(
publi
[
"uri_s"
],
publi
[
"title_s"
][
0
]))
except
:
# print("uri_s not found in: ", publi["title_s"][0])
pass
if
"uri_s"
in
publi
and
"title_s"
in
publi
:
cite
.
append
(
f
'<span class="article"><a href="
{
publi
[
"uri_s"
]
}
" target="_blank">
{
publi
[
"title_s"
][
0
]
}
</a></span>'
)
# get journal
try
:
cite
.
append
(
'<em>{}</em>'
.
format
(
publi
[
"journalTitle_s"
]))
except
:
# print("journalTitle_s not found in: ", publi["title_s"][0])
pass
# get volume
try
:
cite
.
append
(
'Vol. {}'
.
format
(
publi
[
"volume_s"
]))
except
:
# print("volume_s not found in: ", publi["title_s"][0])
pass
# get pages
try
:
cite
.
append
(
'pp. {}'
.
format
(
publi
[
"page_s"
]))
except
:
# print("page_s not found in: ", publi["title_s"][0])
pass
journal
=
[]
# for k, v in [("journalTitle_s", ""), ("volume_s", "vol."), ("page_s", "pp.")]:
for
k
,
v
in
[(
"journalTitle_s"
,
""
)]:
if
k
in
publi
:
journal
.
append
(
f
'
{
v
}
{
publi
[
k
]
}
'
)
if
len
(
journal
):
cite
.
append
(
f
'<span class="journal">
{
", "
.
join
(
journal
)
}
</span>'
)
# get year
try
:
cite
.
append
(
'{}'
.
format
(
publi
[
"producedDateY_i"
]))
# cite.append('{}'.format(publi["journalDate_s"].split("-")[0]))
except
:
# print("releasedDateY_i not found in: ", publi["title_s"][0])
pass
if
"producedDateY_i"
in
publi
:
cite
.
append
(
f
'<span class="year">
{
publi
[
"producedDateY_i"
]
}
</span>'
)
# get doi
try
:
cite
.
append
(
'<<a href="https://doi.org/{doi}">{doi}</a>>'
.
format
(
doi
=
publi
[
"doiId_s"
]))
# cite.append('{}'.format(publi["journalDate_s"].split("-")[0]))
except
:
# print("doiId_s not found in: ", publi["title_s"][0])
pass
if
"doiId_s"
in
publi
:
cite
.
append
(
f
'<span class="doi"><a href="https://doi.org/
{
publi
[
"doiId_s"
]
}
" >
{
publi
[
"doiId_s"
]
}
</a></span>'
)
return
', '
.
join
(
cite
)
+
'.'
# return render(request, 'publi.html', context)
return
' '
.
join
(
cite
)
def
get_biblio_structure
(
structure_name
,
structure_id
,
n_publi
=
100
):
...
...
@@ -80,22 +65,19 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
file
=
"{}-{}.html"
.
format
(
structure_name
,
n
)
print
(
file
)
with
open
(
file
,
'w'
)
as
f
:
f
.
write
(
'<!DOCTYPE html>
\n
'
)
f
.
write
(
'<html>
\n
'
)
f
.
write
(
'
\t
<head>
\n
'
)
f
.
write
(
'
\t\t
<meta charset="UTF-8">
\n
'
)
f
.
write
(
'
\t\t
<style>
\n
'
)
f
.
write
(
'
\t\t\t
body {color: #4c5154; word-wrap: break-word; width: 650px; font: normal 100%/1.5 "montserratregular";}
\n
'
)
f
.
write
(
'
\t\t\t
a {color: #bf3a8d; text-decoration: none;}
\n
'
)
f
.
write
(
'
\t\t\t
a:hover {text-decoration: underline;}
\n
'
)
f
.
write
(
'
\t\t\t
li {margin-bottom: 5px; line-height: 1.5}
\n
'
)
f
.
write
(
'
\t\t\t
h4 {lighter 1.063em "montserratregular"; margin: 1.176em 0 0.750em 0}
\n
'
)
f
.
write
(
'
\t\t
</style>
\n
'
)
f
.
write
(
'
\t\t
<link rel="stylesheet" href="biblio.css">
\n
'
)
f
.
write
(
'
\t
</head>
\n
'
)
f
.
write
(
'
\t
<body>
\n
'
)
f
.
write
(
'
\t\t
<div id="contenu-encadres"><div class="liste-chevron"><ul>
\n
'
)
f
.
write
(
'
\t
<body class="structure">
\n
'
)
f
.
write
(
'
\t\t
<div class="liste-publi">
\n
'
)
f
.
write
(
'
\t\t\t
<ul>
\n
'
)
for
publi
in
publis
[
"response"
][
"docs"
][:
n
]:
f
.
write
(
'
\t\t\t
<li>{}</li>
\n
'
.
format
(
html_publi
(
publi
)))
f
.
write
(
'
\t\t
</ul></div></div>
\n
'
)
f
.
write
(
'
\t\t\t\t
<li>{}</li>
\n
'
.
format
(
html_publi
(
publi
)))
f
.
write
(
'
\t\t\t
</ul>
\n
'
)
f
.
write
(
'
\t\t
</div>
\n
'
)
f
.
write
(
'
\t
</body>
\n
'
)
f
.
write
(
'</html>'
)
return
file
...
...
@@ -124,26 +106,19 @@ def get_biblio_idhal(idhal):
file
=
"{}.html"
.
format
(
idhal
)
print
(
file
)
with
open
(
file
,
'w'
)
as
f
:
f
.
write
(
'<!DOCTYPE html>
\n
'
)
f
.
write
(
'<html>
\n
'
)
f
.
write
(
'
\t
<head>
\n
'
)
f
.
write
(
'
\t\t
<meta charset="UTF-8">
\n
'
)
f
.
write
(
'
\t\t
<style>
\n
'
)
f
.
write
(
'
\t\t\t
body {color: #4c5154; word-wrap: break-word; width: 900px; font: normal 100%/1.5 "montserratregular";}
\n
'
)
f
.
write
(
'
\t\t\t
a {color: #bf3a8d; text-decoration: none;}
\n
'
)
f
.
write
(
'
\t\t\t
a:hover {text-decoration: underline;}
\n
'
)
f
.
write
(
'
\t\t\t
li {margin-bottom: 5px; line-height: 1.5}
\n
'
)
f
.
write
(
'
\t\t\t
h4 {lighter 1.063em "montserratregular"; margin: 1.176em 0 0.750em 0}
\n
'
)
f
.
write
(
'
\t\t
</style>
\n
'
)
f
.
write
(
'
\t\t
<link rel="stylesheet" href="biblio.css">
\n
'
)
f
.
write
(
'
\t
</head>
\n
'
)
f
.
write
(
'
\t
<body>
\n
'
)
f
.
write
(
'
\t\t
<div id="contenu-encadres">
\n
'
)
f
.
write
(
'
\t
<body class="perso">
\n
'
)
for
type
,
publis
in
publis_by_type
.
items
():
f
.
write
(
'
\t\t
<h4>{}</h4>
\n
'
.
format
(
type
))
f
.
write
(
'
\t\t
<
div><
ul>
\n
'
)
f
.
write
(
'
\t\t
<ul>
\n
'
)
for
publi
in
publis
:
f
.
write
(
'
\t\t\t
<li>{}</li>
\n
'
.
format
(
html_publi
(
publi
)))
f
.
write
(
'
\t\t
</ul></div>
\n
'
)
f
.
write
(
'
\t\t
</div>
\n
'
)
f
.
write
(
'
\t\t
</ul>
\n
'
)
f
.
write
(
'
\t
</body>
\n
'
)
f
.
write
(
'</html>'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment