From 5f42e7ca6c96a114fe55a6bcbf59647c794e93ba Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Sat, 30 Jan 2016 17:18:32 +0100 Subject: [PATCH] Use journal instead of publisher for page tearing --- libbmc/papers/tearpages.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libbmc/papers/tearpages.py b/libbmc/papers/tearpages.py index 016f00f..24a2f9f 100644 --- a/libbmc/papers/tearpages.py +++ b/libbmc/papers/tearpages.py @@ -10,12 +10,14 @@ from PyPDF2 import PdfFileWriter, PdfFileReader from PyPDF2.utils import PdfReadError -# Dict of bad publishers which adds an extra useless first page, which can be +# Dict of bad journals which adds an extra useless first page, which can be # teared. Please, submit a PR to include new ones which I may not be aware of! -# This dict associates the publisher string to look for and to a list of pages +# This dict associates the journal string to look for and to a list of pages # to tear. -BAD_PUBLISHERS = { - "IOP": [0] +BAD_JOURNALS = { + "epl": [0], + "journal of modern optics": [0], + "new journal of physics": [0] } @@ -87,12 +89,12 @@ def tearpage_needed(bibtex): whether tearing is needed. :returns: A list of pages to tear. """ - for p in BAD_PUBLISHERS: - if p in bibtex.get("publisher", ""): - # Bad publisher is found, add pages to tear - return BAD_PUBLISHERS[p] + for p in BAD_JOURNALS: + if p in bibtex.get("journal", "").lower(): + # Bad journal is found, add pages to tear + return BAD_JOURNALS[p] - # If no bad publishers are found, return an empty list + # If no bad journals are found, return an empty list return []