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
1c78d8a7
Commit
1c78d8a7
authored
Mar 23, 2021
by
Kivou
Browse files
python3.5
parent
3c891de1
Changes
1
Hide whitespace changes
Inline
Side-by-side
create_html.py
View file @
1c78d8a7
...
...
@@ -75,8 +75,8 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
publis
=
requests
.
get
(
req
).
json
()
def
write_from_publi
(
publis
,
n
):
with
open
(
f
"biblio_
{
structure_name
}
-
{
n
}
.html"
,
'w'
)
as
f
:
print
(
f
"write
{
structure_name
}
{
n
}
"
)
with
open
(
"biblio_{
}-{}.html"
,
'w'
.
format
(
structure_name
,
n
)
)
as
f
:
print
(
"write {
} {}"
.
format
(
structure_name
,
n
)
)
f
.
write
(
'<html>
\n
'
)
f
.
write
(
'
\t
<head>
\n
'
)
f
.
write
(
'
\t\t
<meta charset="UTF-8">
\n
'
)
...
...
@@ -89,7 +89,7 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
f
.
write
(
'
\t
<body>
\n
'
)
f
.
write
(
'
\t\t
<div id="contenu-encadres"><div class="liste-chevron"><ul>
\n
'
)
for
publi
in
publis
[
"response"
][
"docs"
][:
n
]:
f
.
write
(
f
'
\t\t\t
<li>
{
html_publi
(
publi
)
}
</li>
\n
'
)
f
.
write
(
'
\t\t\t
<li>{
}</li>
\n
'
.
format
(
html_publi
(
publi
)
)
)
f
.
write
(
'
\t\t
</ul></div></div>
\n
'
)
f
.
write
(
'
\t
</body>
\n
'
)
f
.
write
(
'</html>'
)
...
...
@@ -118,8 +118,8 @@ def get_biblio_idhal(idhal, n_publi=100):
publis_by_type
[
type
]
=
[
publi
]
# return render(request, 'publi.html', context)
with
open
(
f
"biblio_
{
idhal
}
.html"
,
'w'
)
as
f
:
print
(
f
"write
{
idhal
}
"
)
with
open
(
"biblio_{}.html"
.
format
(
idhal
)
,
'w'
)
as
f
:
print
(
"write {
}"
.
format
(
idhal
)
)
f
.
write
(
'<html>
\n
'
)
f
.
write
(
'
\t
<head>
\n
'
)
f
.
write
(
'
\t\t
<meta charset="UTF-8">
\n
'
)
...
...
@@ -132,13 +132,12 @@ def get_biblio_idhal(idhal, n_publi=100):
f
.
write
(
'
\t
<body>
\n
'
)
f
.
write
(
'
\t\t
<div id="contenu-encadres">
\n
'
)
for
type
,
publis
in
publis_by_type
.
items
():
f
.
write
(
f
'
\t\t
<h2>
{
type
}
</h2>
\n
'
)
f
.
write
(
'
\t\t
<h2>{}</h2>
\n
'
.
format
(
type
)
)
f
.
write
(
'
\t\t
<div><ul>
\n
'
)
for
publi
in
publis
[:
n_publi
]:
f
.
write
(
f
'
\t\t\t
<li>
{
html_publi
(
publi
)
}
</li>
\n
'
)
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>'
)
...
...
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