Skip to content
New issue

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

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

Already on GitHub? # to your account

Split the start/end of the current entry #45

Merged
merged 1 commit into from
Nov 9, 2019
Merged
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
28 changes: 18 additions & 10 deletions biblatex_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,25 @@ def open(file, mode='r', buffering=-1, encoding=None,

for (lineNumber, line) in enumerate(fIn):
line = line.strip("\n")

# Staring a new entry
if line.startswith("@"):
fields = []
subproblems = []

currentId = line.split("{")[1].rstrip(",\n")
if currentId in ids:
subproblems.append("non-unique id: '" + currentId + "'")
counterNonUniqueId += 1
else:
ids.append(currentId)
currentType = line.split("{")[0].strip("@ ")
completeEntry = line + "<br />"

# Closing out the current entry
elif line.startswith("}"):
completeEntry += line + "<br />"

if currentId in usedIds or not usedIds:
for fieldName, requiredFieldsType in requiredFields.items():
if fieldName == currentType.lower():
Expand Down Expand Up @@ -227,16 +245,6 @@ def open(file, mode='r', buffering=-1, encoding=None,
problem += "<div class='bibtex'>" + completeEntry + "</div>"
problem += "</div>"
problems.append(problem)
fields = []
subproblems = []
currentId = line.split("{")[1].rstrip(",\n")
if currentId in ids:
subproblems.append("non-unique id: '" + currentId + "'")
counterNonUniqueId += 1
else:
ids.append(currentId)
currentType = line.split("{")[0].strip("@ ")
completeEntry = line + "<br />"
else:
if line != "":
completeEntry += line + "<br />"
Expand Down
2 changes: 1 addition & 1 deletion tests/input.bib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% This file should fail with the commented errors
% 7 errors expected
% 9 errors expected

% "misc": ["author/editor", "title", "year/date"]
% year/date missing
Expand Down