Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: abp/filters/parser.py

Issue 29845767: Issue 6685 - Offer incremental filter list downloads (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Remove metadata_keys, yield deletions first Created Aug. 27, 2018, 10:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | abp/filters/renderer.py » ('j') | abp/filters/renderer.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: abp/filters/parser.py
===================================================================
--- a/abp/filters/parser.py
+++ b/abp/filters/parser.py
@@ -140,9 +140,7 @@
Include = _line_type('Include', 'target', '%include {0.target}%')
-METADATA_REGEXP = re.compile(r'!\s*(\w+)\s*:\s*(.*)')
-METADATA_KEYS = {'Homepage', 'Title', 'Expires', 'Checksum', 'Redirect',
- 'Version'}
+METADATA_REGEXP = re.compile(r'!\s*([\w-]+)\s*:(?!//)\s*(.*)')
INCLUDE_REGEXP = re.compile(r'%include\s+(.+)%')
HEADER_REGEXP = re.compile(r'\[(Adblock(?:\s*Plus\s*[\d\.]+?)?)\]', flags=re.I)
HIDING_FILTER_REGEXP = re.compile(r'^([^/*|@"!]*?)#([@?])?#(.+)$')
@@ -153,7 +151,7 @@
def _parse_comment(text):
match = METADATA_REGEXP.match(text)
- if match and match.group(1) in METADATA_KEYS:
+ if match:
return Metadata(match.group(1), match.group(2))
return Comment(text[1:].strip())
« no previous file with comments | « no previous file | abp/filters/renderer.py » ('j') | abp/filters/renderer.py » ('J')

Powered by Google App Engine
This is Rietveld