Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional information on bibtex file #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions findpapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
from findpapers.tools.refiner_tool import refine
from findpapers.tools.downloader_tool import download

try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata

__version__ = importlib_metadata.version(__name__)
## 09/17/2022 Disable importlib metadata check. This module is used as a relative import in the main package.
## try:
## import importlib.metadata as importlib_metadata
## except ModuleNotFoundError:
## import importlib_metadata
##
## __version__ = importlib_metadata.version(__name__)
10 changes: 8 additions & 2 deletions findpapers/tools/bibtex_generator_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def generate_bibtex(search_path: str, outputpath: str, only_selected_papers: Opt
if paper.publication_date is not None:
bibtex_output += f'{default_tab}year = {{{paper.publication_date.year}}},\n'

if paper.doi is not None:
bibtex_output += f'{default_tab}doi = {{{paper.doi}}},\n'

if paper.abstract is not None:
bibtex_output += f'{default_tab}abstract = {{{paper.abstract}}},\n'

if paper.pages is not None:
bibtex_output += f'{default_tab}pages = {{{paper.pages}}},\n'

Expand All @@ -112,5 +118,5 @@ def generate_bibtex(search_path: str, outputpath: str, only_selected_papers: Opt
except Exception as e:
logging.debug(e, exc_info=True)

with open(outputpath, 'w') as fp:
fp.write(bibtex_output)
with open(outputpath, 'w', encoding='utf-8') as fp:
fp.write(bibtex_output)