-
Notifications
You must be signed in to change notification settings - Fork 123
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
base: master
Are you sure you want to change the base?
Conversation
First implementation, might need some cleanup.
403e8a5
to
12b1e6e
Compare
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" |
There was a problem hiding this comment.
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?
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 |
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
First implementation, might need some cleanup.
I thought, I will already start the PR, so feedback can be given.
Fixes #295