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

Delta Between Two Patch Sets: README.md

Issue 29884571: Issue 6945 - Add script to make filter list diffs (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Left Patch Set: Address comments on PS4 Created Sept. 25, 2018, 1:52 a.m.
Right Patch Set: Fix docstring Created Sept. 26, 2018, 6:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | abp/filters/diff_script.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # python-abp 1 # python-abp
2 2
3 This repository contains a library for working with Adblock Plus filter lists 3 This repository contains a library for working with Adblock Plus filter lists
4 and the script that is used for building Adblock Plus filter lists from the 4 and the script that is used for building Adblock Plus filter lists from the
5 form in which they are authored into the format suitable for consumption by the 5 form in which they are authored into the format suitable for consumption by the
6 adblocking software. 6 adblocking software.
7 7
8 ## Installation 8 ## Installation
9 9
10 Prerequisites: 10 Prerequisites:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 This will produce a diff that shows how a client may get from `base.txt` to 102 This will produce a diff that shows how a client may get from `base.txt` to
103 `latest.txt`, and write the output to `output.txt`. The output argument is 103 `latest.txt`, and write the output to `output.txt`. The output argument is
104 optional. If ommitted, the data will be written to `stdout`. 104 optional. If ommitted, the data will be written to `stdout`.
105 105
106 The script produces three types of lines, as specified in the [technical specifi cation][5]: 106 The script produces three types of lines, as specified in the [technical specifi cation][5]:
107 * Special comments of the form `! <name>:[ <value>]` 107 * Special comments of the form `! <name>:[ <value>]`
108 * Added filters of the form `+ <filter-text>` 108 * Added filters of the form `+ <filter-text>`
109 * Removed filter of the form `- <filter-text>` 109 * Removed filter of the form `- <filter-text>`
110 110
111 The diff is generated such that the removed filters are listed before the added
Sebastian Noack 2018/09/25 17:00:39 Maybe this is a bit too much detail, if we refer t
rhowell 2018/09/25 23:01:45 Yeah, I see your point. Maybe it would be better t
112 filters. This covers the case where a filter is both removed and added. The
113 client should process the diffs in order, so if this conflict happens, the rule
114 will be added.
115
116 ## Library API 111 ## Library API
117 112
118 Python-abp can also be used as a library for parsing filter lists. For example 113 Python-abp can also be used as a library for parsing filter lists. For example
119 to read a filter list (we use Python 3 syntax here but the API is the same): 114 to read a filter list (we use Python 3 syntax here but the API is the same):
120 115
121 from abp.filters import parse_filterlist 116 from abp.filters import parse_filterlist
122 117
123 with open('filterlist.txt') as filterlist: 118 with open('filterlist.txt') as filterlist:
124 for line in parse_filterlist(filterlist): 119 for line in parse_filterlist(filterlist):
125 print(line) 120 print(line)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 198
204 Now you can use the functions with `abp$functionname`, e.g. 199 Now you can use the functions with `abp$functionname`, e.g.
205 `abp.line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")` 200 `abp.line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")`
206 201
207 202
208 [1]: https://adblockplus.org/filters#special-comments 203 [1]: https://adblockplus.org/filters#special-comments
209 [2]: http://pytest.org/ 204 [2]: http://pytest.org/
210 [3]: https://tox.readthedocs.org/ 205 [3]: https://tox.readthedocs.org/
211 [4]: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt 206 [4]: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
212 [5]: https://docs.google.com/document/d/1SoEqaOBZRCfkh1s5Kds5A5RwUC_nqbYYlGH72s bsSgQ/ 207 [5]: https://docs.google.com/document/d/1SoEqaOBZRCfkh1s5Kds5A5RwUC_nqbYYlGH72s bsSgQ/
LEFTRIGHT

Powered by Google App Engine
This is Rietveld