aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-21 17:32:26 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-21 17:32:26 -0800
commit20e52ed1947f17bdd1ae94b3c655404ef145324a (patch)
tree086a0c607757d401b63cb9a4152175c0f3f2c309 /fatcat_scholar
parentf0cf8d3391bd4b2282630f5b926ec9de2c8e038d (diff)
downloadfatcat-scholar-20e52ed1947f17bdd1ae94b3c655404ef145324a.tar.gz
fatcat-scholar-20e52ed1947f17bdd1ae94b3c655404ef145324a.zip
citation: fixes to generic hack; remove bibtex hack
Diffstat (limited to 'fatcat_scholar')
-rw-r--r--fatcat_scholar/schema.py37
1 files changed, 6 insertions, 31 deletions
diff --git a/fatcat_scholar/schema.py b/fatcat_scholar/schema.py
index 4287d53..d3a91a7 100644
--- a/fatcat_scholar/schema.py
+++ b/fatcat_scholar/schema.py
@@ -112,45 +112,20 @@ class ScholarBiblio(BaseModel):
Urgently, will probably refactor to use a proper citeproc library. Will
need to do something different about author names at the same time.
"""
- if style == "bibtex":
- type_map = {
- "article-journal": "article",
- "conference-paper": "proceedings",
- "thesis": "phdthesis",
- "book": "book",
- None: "unpublished",
- }
- val = f"@{type_map.get(self.release_type, 'unpublished')}{{{self.release_ident},\n"
- val += f" title = {{{self.title}}}\n"
- for name in self.contrib_names:
- val += f" author = {{{name}}}\n"
- if self.pages:
- val += f" pages = {{{self.pages}}}\n"
- if self.volume:
- val += f" volume = {{{self.volume}}}\n"
- if self.issue:
- val += f" number = {{{self.issue}}}\n"
- if self.release_year:
- val += f" year = {self.release_year}\n"
- if self.container_name:
- val += f" journal = {{{self.container_name}}}\n"
- if self.publisher:
- val += f" publisher = {{{self.publisher}}}\n"
- val += "}"
- return val
- elif style == "default":
+ if style == "default":
val = ", ".join(self.contrib_names)
if val:
val += ". "
- val += f' "{self.title}." '
+ if self.title:
+ val += f'"{self.title}." '
if self.container_name:
- val += self.container_name
+ val += f" {self.container_name}"
if self.volume and self.issue:
- val += f"{self.volume}.{self.issue} "
+ val += f" {self.volume}.{self.issue} "
if self.release_year:
val += f" ({self.release_year})"
if self.pages:
- val += f": {self.pages}"
+ val += f" {self.pages}"
return val
return None