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
1686695d
Commit
1686695d
authored
Mar 23, 2021
by
Kivou
Browse files
create index.html
parent
30e93eda
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
1686695d
biblio_
*.html
*.html
.gitlab-ci.yml
View file @
1686695d
...
...
@@ -11,13 +11,13 @@ build:
-
python ./create_html.py
artifacts
:
paths
:
-
./
biblio_
*.html
-
./*.html
pages
:
stage
:
deploy
script
:
-
mkdir public
-
mv
biblio
*.html public/
-
mv *.html public/
artifacts
:
paths
:
-
public
create_html.py
View file @
1686695d
...
...
@@ -4,6 +4,7 @@ REQ_DOC_TYPE = "(docType_s:ART OR docType_s:OUV OR docType_s:COUV)"
BRIDGE_TYPES
=
{
"ART"
:
"Articles"
,
"COMM"
:
"Conferences"
,
"COUV"
:
"Books"
,
"THESE"
:
"These"
}
SORT_BY
=
"producedDate_s"
# "journalDate_s"
N_PUBLI_MAX
=
100
N_PUBLIS
=
[
3
,
5
,
10
,
15
,
50
,
100
]
def
html_publi
(
publi
):
# for k, v in publi.items():
...
...
@@ -68,6 +69,7 @@ def html_publi(publi):
pass
return
', '
.
join
(
cite
)
+
'.'
# return render(request, 'publi.html', context)
def
get_biblio_structure
(
structure_name
,
structure_id
,
n_publi
=
100
):
...
...
@@ -75,8 +77,9 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
publis
=
requests
.
get
(
req
).
json
()
def
write_from_publi
(
publis
,
n
):
with
open
(
"biblio_{}-{}.html"
,
'w'
.
format
(
structure_name
,
n
))
as
f
:
print
(
"write {} {}"
.
format
(
structure_name
,
n
))
file
=
"{}-{}.html"
.
format
(
structure_name
,
n
)
print
(
file
)
with
open
(
file
,
'w'
)
as
f
:
f
.
write
(
'<html>
\n
'
)
f
.
write
(
'
\t
<head>
\n
'
)
f
.
write
(
'
\t\t
<meta charset="UTF-8">
\n
'
)
...
...
@@ -93,16 +96,15 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
f
.
write
(
'
\t\t
</ul></div></div>
\n
'
)
f
.
write
(
'
\t
</body>
\n
'
)
f
.
write
(
'</html>'
)
return
file
write_from_publi
(
publis
,
3
)
write_from_publi
(
publis
,
5
)
write_from_publi
(
publis
,
10
)
write_from_publi
(
publis
,
15
)
write_from_publi
(
publis
,
50
)
write_from_publi
(
publis
,
100
)
files
=
[]
for
n
in
N_PUBLIS
:
files
.
append
(
write_from_publi
(
publis
,
n
))
return
files
def
get_biblio_idhal
(
idhal
,
n_publi
=
100
):
def
get_biblio_idhal
(
idhal
):
req
=
"http://api.archives-ouvertes.fr/search/?q=(authIdHal_s:{s})&sort={so} desc&rows={n}&fl=*"
.
format
(
s
=
idhal
,
n
=
N_PUBLI_MAX
,
so
=
SORT_BY
)
publis_by_type
=
dict
()
api_error
=
dict
()
...
...
@@ -117,9 +119,9 @@ def get_biblio_idhal(idhal, n_publi=100):
else
:
publis_by_type
[
type
]
=
[
publi
]
# return render(request, 'publi.html', context
)
with
open
(
"biblio_{}.html"
.
format
(
idhal
),
'w'
)
as
f
:
print
(
"write {}"
.
format
(
idhal
))
file
=
"{}.html"
.
format
(
idhal
)
print
(
file
)
with
open
(
file
,
'w'
)
as
f
:
f
.
write
(
'<html>
\n
'
)
f
.
write
(
'
\t
<head>
\n
'
)
f
.
write
(
'
\t\t
<meta charset="UTF-8">
\n
'
)
...
...
@@ -134,16 +136,26 @@ def get_biblio_idhal(idhal, n_publi=100):
for
type
,
publis
in
publis_by_type
.
items
():
f
.
write
(
'
\t\t
<h2>{}</h2>
\n
'
.
format
(
type
))
f
.
write
(
'
\t\t
<div><ul>
\n
'
)
for
publi
in
publis
[:
n_publi
]
:
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
</body>
\n
'
)
f
.
write
(
'</html>'
)
get_biblio_structure
(
"geo"
,
545340
)
get_biblio_structure
(
"comhet"
,
545341
)
get_biblio_structure
(
"rv"
,
545342
)
get_biblio_structure
(
"labo"
,
706
)
get_biblio_idhal
(
"eroubin"
,
n_publi
=
50
)
return
[
file
]
all_files
=
[]
all_files
.
append
(
get_biblio_structure
(
"geo"
,
545340
))
all_files
.
append
(
get_biblio_structure
(
"comhet"
,
545341
))
all_files
.
append
(
get_biblio_structure
(
"rv"
,
545342
))
all_files
.
append
(
get_biblio_structure
(
"labo"
,
706
))
all_files
.
append
(
get_biblio_idhal
(
"eroubin"
))
with
open
(
"index.html"
,
"w"
)
as
f
:
print
(
"index.html"
)
f
.
write
(
"<html><body><ul>"
)
for
files
in
all_files
:
for
file
in
files
:
f
.
write
(
'<li><a href="{file}">{file}</a></li>'
.
format
(
file
=
file
))
f
.
write
(
"</ul></body></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