Skip to content
Open
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
7 changes: 5 additions & 2 deletions src/article_cli/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,13 @@ def _filter_empty_entries(self, content: str) -> Tuple[str, int]:
import re

# Pattern to match BibTeX entries
entry_pattern = r"@\w+\{[^,]*,\s*\}"
entry_pattern_empty = r"@\w+\{[^,]*,\s*\}"
entry_pattern_keywords = r"@\w+\{[^,]*,\s*keywords\s*=\s*\{[^}]*\},*\s*\}"

# Find all empty entries (those with just the citation key and closing brace)
empty_entries = re.findall(entry_pattern, content)
empty_entries = re.findall(entry_pattern_empty, content)
# Find all entries that only have a keywords field
empty_entries += re.findall(entry_pattern_keywords, content)

if not empty_entries:
return content, 0
Expand Down
Loading