Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bielefeld-CeBiTec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
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
2024 Competition
Bielefeld-CeBiTec
Commits
c0a9d1e6
Commit
c0a9d1e6
authored
5 months ago
by
Liliana Sanfilippo
Browse files
Options
Downloads
Patches
Plain Diff
cit
parent
7cf3f06b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#445556
failed
5 months ago
Stage: build
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
code/cit.py
+18
-12
18 additions, 12 deletions
code/cit.py
code/output.txt
+102
-155
102 additions, 155 deletions
code/output.txt
src/contents/safety.tsx
+102
-155
102 additions, 155 deletions
src/contents/safety.tsx
with
222 additions
and
322 deletions
code/cit.py
+
18
−
12
View file @
c0a9d1e6
...
...
@@ -100,11 +100,15 @@ def main():
def
makeauthors
(
authors
,
out
):
authors
=
authors
.
replace
(
"
and
"
,
"
|
"
)
autlist
=
authors
.
split
(
"
|
"
)
# Maximale Anzahl der anzuzeigenden Autoren
max_authors
=
6
for
i
,
a
in
enumerate
(
autlist
):
try
:
try
:
first
=
None
last
=
None
name
=
None
if
'
,
'
in
a
:
s
=
a
.
split
(
"
,
"
)
if
len
(
s
)
>
1
:
...
...
@@ -122,22 +126,24 @@ def makeauthors(authors, out):
first
=
s
[
0
]
first_sh
=
first
[
0
]
last
=
s
[
1
]
name
=
last
+
"
,
"
+
first_sh
+
"
.
"
else
:
name
=
last
+
"
,
"
+
first_sh
+
"
.
"
else
:
# Falls es mehrere Vornamen gibt, sie in Initialen umwandeln
leng
=
len
(
s
)
last
=
s
[
leng
-
1
]
first
=
'
.
'
.
join
([
n
[
0
]
for
n
in
s
[:
-
1
]])
+
'
.
'
# Nur Initialen der Vornamen
name
=
last
+
"
,
"
+
first
#
Wenn es der letzte Autor ist, kein Semikolon am Ende
if
i
==
len
(
autlist
)
-
1
:
#
Schreibe den Namen in die Ausgabedatei
if
i
<
max_authors
:
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
name
+
"
</span>
"
+
"
\n
"
)
else
:
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
name
+
"
</span>,
"
+
"
\n
"
)
# Wenn wir mehr als 6 Autoren haben, schreibe "et al." nach dem 6. Autor
if
i
==
max_authors
:
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
> et al.</span>
"
+
"
\n
"
)
break
# Stoppe die Schleife, nachdem "et al." hinzugefügt wurde
except
Exception
as
e
:
print
(
f
"
An unexpected error occurred:
{
e
}
see
"
+
a
)
def
articleHTML
(
dictio
,
x
,
out
):
...
...
@@ -164,10 +170,10 @@ def articleHTML(dictio, x, out):
pag
=
re
.
split
(
'
--|-|–
'
,
pages
)
begin
=
pag
[
0
].
strip
()
end
=
pag
[
1
].
strip
()
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:pageBegin
\"
>
"
+
begin
+
"
</span>-<span property=
\"
schema:pageEnd
\"
>
"
+
end
+
"
</span>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:pageBegin
\"
>
"
+
begin
+
"
</span>-<span property=
\"
schema:pageEnd
\"
>
"
+
end
+
"
</span>
"
+
"
\n
"
)
else
:
if
re
.
match
(
r
'
^\d+(-\d+)?$
'
,
pages
):
# Check for typical numeric page ranges
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:pageBegin
\"
>
"
+
pages
+
"
</span>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:pageBegin
\"
>
"
+
pages
+
"
</span>
"
+
"
\n
"
)
else
:
# Seitenangabe ist nicht numerisch, als fehlend behandeln
print
(
f
"
Non-numeric page information detected (
'
{
pages
}
'
). Treating as missing.
"
)
...
...
@@ -181,7 +187,7 @@ def articleHTML(dictio, x, out):
year
=
dictio
[
'
year
'
]
out
.
write
(
"
\t
"
+
"
(<time property=
\"
schema:datePublished
\"
datatype=
\"
xsd:gYear
\"
dateTime=
\"
"
+
year
+
"
\"
>
"
+
year
+
"
</time>).
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
(<time property=
\"
schema:datePublished
\"
datatype=
\"
xsd:gYear
\"
dateTime=
\"
"
+
year
+
"
\"
>
"
+
year
+
"
</time>).
"
+
"
\n
"
)
try
:
doi
=
dictio
[
'
doi
'
]
...
...
This diff is collapsed.
Click to expand it.
code/output.txt
+
102
−
155
View file @
c0a9d1e6
This diff is collapsed.
Click to expand it.
src/contents/safety.tsx
+
102
−
155
View file @
c0a9d1e6
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