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

Add BibTeX export for ScopusSearch #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

claell
Copy link

@claell claell commented Oct 17, 2023

First implementation, might need some cleanup.

I thought, I will already start the PR, so feedback can be given.

Fixes #295

First implementation, might need some cleanup.
Comment on lines +227 to +255
type_conference_paper = "Conference Paper"
type_conference_review = "Conference Review"
type_article = "Article"
type_review = "Review"
type_short_survey = "Short Survey"
type_editorial = "Editorial"
type_note = "Note"
type_letter = "Letter"
type_data_paper = "Data Paper"
type_erratum = "Erratum"
type_book_chapter = "Book Chapter"
type_book = "Book"
type_report = "Report"
type_retracted = "Retracted"
type_none = None

aggregation_type_conference_proceedings = "Conference Proceeding"
aggregation_type_journal = "Journal"
aggregation_type_trade_journal = "Trade Journal"
aggregation_type_book_series = "Book Series"
aggregation_type_book = "Book"
aggregation_type_report = "Report"
aggregation_type_none = None

bib_tex_type_article = "Article"
bib_tex_type_in_proceedings = "InProceedings"
bib_tex_type_in_collection = "InCollection"
bib_tex_type_book = "Book"
bib_tex_type_techreport = "TechReport"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these variables just contain one string. Isn't it easier to just use the strings instead of the variables?

Comment on lines +308 to +313
if (document_type in [type_article, type_review, type_short_survey, type_editorial, type_note, type_letter, type_data_paper, type_erratum, type_conference_review, type_conference_paper, type_retracted, type_none] and aggregation_type == aggregation_type_journal) or (document_type in [type_article, type_review, type_short_survey, type_note] and aggregation_type == aggregation_type_trade_journal) or (document_type == type_article and aggregation_type == aggregation_type_none):
bib_tex_type = bib_tex_type_article
if aggregation_type == aggregation_type_conference_proceedings or (document_type == type_conference_paper and aggregation_type in [aggregation_type_book, aggregation_type_none]):
bib_tex_type = bib_tex_type_in_proceedings
elif aggregation_type == aggregation_type_book_series or (document_type in [type_book_chapter, type_article, type_editorial] and aggregation_type == aggregation_type_book):
bib_tex_type = bib_tex_type_in_collection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more readable to define suitable doctypes as a set beforehand:

in_collection = {"ed", "ar", "ch"}

etc.

Comment on lines +324 to +326
fields = self.add_bibtex_field(fields, "author", authors)
fields = self.add_bibtex_field(fields, "title", result.title)
fields = self.add_bibtex_field(fields, "date", result.coverDate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you turn this and the following statements into a loop of tuples?

[("author", authors), ("title", result.title), ...]

bib_library.add(entry)

# Check whether the addition was successful or resulted in a duplicate block that needs fixing.
for i in range(26):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the 26 come from?

# Check whether the addition was successful or resulted in a duplicate block that needs fixing.
for i in range(26):
failed_blocks = bib_library.failed_blocks
if failed_blocks:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is happening here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proper export (to bibtex)
2 participants