From 20e52ed1947f17bdd1ae94b3c655404ef145324a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 21 Jan 2021 17:32:26 -0800 Subject: citation: fixes to generic hack; remove bibtex hack --- fatcat_scholar/schema.py | 37 ++++++------------------------------- 1 file 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 -- cgit v1.2.3