aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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