diff --git a/autotests/folding/adblock.txt.fold b/autotests/folding/adblock.txt.fold new file mode 100644 index 0000000..7ad85dd --- /dev/null +++ b/autotests/folding/adblock.txt.fold @@ -0,0 +1,53 @@ +[Adblock Plus 2.0] +! Checksum: OBK3kgyECgXJtrF4BTO3Fg +! Version: 201709021630 +! Title: Test Adblock List +! Last modified: 02 Sep 2017 16:30 UTC +! Expires: 2 days (update frequency) +! Homepage: https://www.kde.org/ +! Licence: MIT +! +! Some more text +! + +! basic rules +http://example.com/ads/banner123.gif +http://example.com/ads/banner*.gif +http://example.com/ads/* +http://example.com/* + +! exception rules +@@advice +@@||example.com^$document + +! begin/end matches +swf| +||example.com/banner.gif + +! separator characters +http://example.com^ +^example.com^ +^%D1%82%D0%B5%D1%81%D1%82^ + +! filter options +*/ads/*$script,match-case +*$donottrack,image,~image +*$domain=example.com|example.net +*/BannerAd.gif$match-case + +! regular expressions +/banner\d+/ +/\.bla\/[0-9]{2,9}\/$/$script,stylesheet,third-party,xmlhttprequest + +! element selectors +##.textad. +###sponsorad +example.com##.sponsor +~foo.example.com##.sponsor + +! attribute selectors +##table[width="80%"] +##div[title^="adv"][title$="ert"] + +! element selector exceptions +exmaple.com#@#.adwords diff --git a/autotests/html/adblock.txt.html b/autotests/html/adblock.txt.html new file mode 100644 index 0000000..04dc5d1 --- /dev/null +++ b/autotests/html/adblock.txt.html @@ -0,0 +1,60 @@ + + + +adblock.txt + +
+[Adblock Plus 2.0]
+! Checksum: OBK3kgyECgXJtrF4BTO3Fg
+! Version: 201709021630
+! Title: Test Adblock List
+! Last modified: 02 Sep 2017 16:30 UTC
+! Expires: 2 days (update frequency)
+! Homepage: https://www.kde.org/
+! Licence: MIT
+!
+! Some more text
+!
+
+! basic rules
+http://example.com/ads/banner123.gif
+http://example.com/ads/banner*.gif
+http://example.com/ads/*
+http://example.com/*
+
+! exception rules
+@@advice
+@@||example.com^$document
+
+! begin/end matches
+swf|
+||example.com/banner.gif
+
+! separator characters
+http://example.com^
+^example.com^
+^%D1%82%D0%B5%D1%81%D1%82^
+
+! filter options
+*/ads/*$script,match-case
+*$donottrack,image,~image
+*$domain=example.com|example.net
+*/BannerAd.gif$match-case
+
+! regular expressions
+/banner\d+/
+/\.bla\/[0-9]{2,9}\/$/$script,stylesheet,third-party,xmlhttprequest
+
+! element selectors
+##.textad.
+###sponsorad
+example.com##.sponsor
+~foo.example.com##.sponsor
+
+! attribute selectors
+##table[width="80%"]
+##div[title^="adv"][title$="ert"]
+
+! element selector exceptions
+exmaple.com#@#.adwords
+
diff --git a/autotests/input/adblock.txt b/autotests/input/adblock.txt new file mode 100644 index 0000000..7ad85dd --- /dev/null +++ b/autotests/input/adblock.txt @@ -0,0 +1,53 @@ +[Adblock Plus 2.0] +! Checksum: OBK3kgyECgXJtrF4BTO3Fg +! Version: 201709021630 +! Title: Test Adblock List +! Last modified: 02 Sep 2017 16:30 UTC +! Expires: 2 days (update frequency) +! Homepage: https://www.kde.org/ +! Licence: MIT +! +! Some more text +! + +! basic rules +http://example.com/ads/banner123.gif +http://example.com/ads/banner*.gif +http://example.com/ads/* +http://example.com/* + +! exception rules +@@advice +@@||example.com^$document + +! begin/end matches +swf| +||example.com/banner.gif + +! separator characters +http://example.com^ +^example.com^ +^%D1%82%D0%B5%D1%81%D1%82^ + +! filter options +*/ads/*$script,match-case +*$donottrack,image,~image +*$domain=example.com|example.net +*/BannerAd.gif$match-case + +! regular expressions +/banner\d+/ +/\.bla\/[0-9]{2,9}\/$/$script,stylesheet,third-party,xmlhttprequest + +! element selectors +##.textad. +###sponsorad +example.com##.sponsor +~foo.example.com##.sponsor + +! attribute selectors +##table[width="80%"] +##div[title^="adv"][title$="ert"] + +! element selector exceptions +exmaple.com#@#.adwords diff --git a/autotests/input/adblock.txt.syntax b/autotests/input/adblock.txt.syntax new file mode 100644 index 0000000..0ce0446 --- /dev/null +++ b/autotests/input/adblock.txt.syntax @@ -0,0 +1 @@ +Adblock Plus diff --git a/autotests/reference/adblock.txt.ref b/autotests/reference/adblock.txt.ref new file mode 100644 index 0000000..925dd7d --- /dev/null +++ b/autotests/reference/adblock.txt.ref @@ -0,0 +1,53 @@ +
[Adblock Plus 2.0]

+! Checksum: OBK3kgyECgXJtrF4BTO3Fg
+! Version: 201709021630
+! Title: Test Adblock List
+! Last modified: 02 Sep 2017 16:30 UTC
+! Expires: 2 days (update frequency)
+! Homepage: https://www.kde.org/
+! Licence: MIT
+!
+! Some more text
+!
+
+! basic rules
+http://example.com/ads/banner123.gif
+http://example.com/ads/banner*.gif
+http://example.com/ads/*
+http://example.com/*
+
+! exception rules
+@@advice
+@@||example.com^$document
+
+! begin/end matches
+swf|
+||example.com/banner.gif
+
+! separator characters
+http://example.com^
+^example.com^
+^%D1%82%D0%B5%D1%81%D1%82^
+
+! filter options
+*/ads/*$script,match-case
+*$donottrack,image,~image
+*$domain=example.com|example.net
+*/BannerAd.gif$match-case
+
+! regular expressions
+/banner\d+/
+/\.bla\/[0-9]{2,9}\/$/$script,stylesheet,third-party,xmlhttprequest
+
+! element selectors
+##.textad.
+###sponsorad
+example.com##.sponsor
+~foo.example.com##.sponsor
+
+! attribute selectors
+##table[width="80%"]
+##div[title^="adv"][title$="ert"]
+
+! element selector exceptions
+exmaple.com#@#.adwords
diff --git a/data/syntax/adblock.xml b/data/syntax/adblock.xml new file mode 100644 index 0000000..796b299 --- /dev/null +++ b/data/syntax/adblock.xml @@ -0,0 +1,87 @@ + + + + + + + Homepage + Title + Expires + Checksum + Redirect + Version + + + script + image + stylesheet + object + xmlhttprequest + object-subrequest + subdocument + ping + websocket + webrtc + document + elemhide + generichide + genericblock + popup + other + third-party + domain + sitekey + match-case + collapse + donottrack + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +