***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Invenio Theme TUW
Manage
Activity
Members
Labels
Plan
Issues
11
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Center for Research Data Management
Invenio Theme TUW
Commits
e1bb35e7
Commit
e1bb35e7
authored
4 years ago
by
Moser, Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
Gracefully handle identifiers not being set
parent
e426e32a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
invenio_theme_tuw/views.py
+10
-7
10 additions, 7 deletions
invenio_theme_tuw/views.py
with
10 additions
and
7 deletions
invenio_theme_tuw/views.py
+
10
−
7
View file @
e1bb35e7
...
...
@@ -20,9 +20,10 @@ blueprint = Blueprint(
@blueprint.app_template_filter
(
"
tuw_doi_identifier
"
)
def
tuw_doi_identifier
(
identifiers
):
"""
Extract DOI from sequence of identifiers.
"""
for
identifier
in
identifiers
:
if
identifier
.
get
(
"
scheme
"
)
==
"
doi
"
:
return
identifier
.
get
(
"
identifier
"
)
if
identifiers
is
not
None
:
for
identifier
in
identifiers
:
if
identifier
.
get
(
"
scheme
"
)
==
"
doi
"
:
return
identifier
.
get
(
"
identifier
"
)
@blueprint.app_template_global
(
"
tuw_cite_as
"
)
...
...
@@ -47,9 +48,11 @@ def tuw_cite_as(record_metadata):
version
if
version
.
lower
().
startswith
(
"
v
"
)
else
"
Version {}
"
.
format
(
version
)
)
fmt_resource_type
=
vocabulary
.
get_title_by_dict
(
resource_type
)
fmt_doi
=
(
doi
if
doi
.
lower
().
startswith
(
"
http
"
)
else
"
https://doi.org/{}
"
.
format
(
doi
)
)
fmt_doi
=
""
if
doi
is
not
None
:
fmt_doi
=
(
doi
if
doi
.
lower
().
startswith
(
"
http
"
)
else
"
https://doi.org/{}
"
.
format
(
doi
)
)
# format the author names roughly according to the APA logic:
# https://research.moreheadstate.edu/c.php?g=107001&p=695202
...
...
@@ -69,5 +72,5 @@ def tuw_cite_as(record_metadata):
fmt_resource_type
,
publisher
,
fmt_doi
,
)
)
.
strip
()
return
text
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