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

Delta Between Two Patch Sets: README.md

Issue 29922555: Issue 7059 - Modify fldiff so it can handle multiple files (Closed) Base URL: https://hg.adblockplus.org/python-abp
Left Patch Set: Created Oct. 24, 2018, 2:27 a.m.
Right Patch Set: Address comments on PS4 Created Oct. 31, 2018, 7:11 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 $ flrender easylist.txt output/easylist.txt 82 $ flrender easylist.txt output/easylist.txt
83 Unknown source: 'easylist' when including 'easylist:easylist/easylist_gener 83 Unknown source: 'easylist' when including 'easylist:easylist/easylist_gener
84 al_block.txt' from 'easylist.txt' 84 al_block.txt' from 'easylist.txt'
85 85
86 You can clone the necessary repositories to a local directory and add `-i` 86 You can clone the necessary repositories to a local directory and add `-i`
87 options accordingly. 87 options accordingly.
88 88
89 ## Rendering diffs 89 ## Rendering diffs
90 90
91 A diff allows a client running ad blocking software such as Adblock Plus to upda te 91 A diff allows a client running ad blocking software such as Adblock Plus to
92 the filter lists incrementally, instead of downloading a new copy of a full list 92 update the filter lists incrementally, instead of downloading a new copy of a
93 during each update. This is meant to lessen the amount of resources used when up dating 93 full list during each update. This is meant to lessen the amount of resources
94 filter lists (e.g. network data, memory usage, battery consumption, etc.), allow ing 94 used when updating filter lists (e.g. network data, memory usage, battery
95 clients to update their lists more frequently using less resources. 95 consumption, etc.), allowing clients to update their lists more frequently using
Vasily Kuznetsov 2018/10/24 11:30:08 We normally try to limit line length to <80 charac
96 96 less resources.
97 Python-abp contains a script called `fldiff` that will find the diff between the lastest 97
Vasily Kuznetsov 2018/10/24 11:30:08 Nit: should it be "latest"?
98 filter list, and any number of previous filter lists: 98 Python-abp contains a script called `fldiff` that will find the diff between the
99 99 latest filter list, and any number of previous filter lists:
100 $ fldiff -o diffs/easylist -l last-easylist.txt archive/* 100
101 where `-o diffs/easylist` is the (optional) directory where the diffs should be written, 101 $ fldiff -o diffs/easylist easylist.txt archive/*
102 `-l last-easylist.txt` is the most recent version of the filter list, and 102
103 `archive/*` is the directory where all the the archived filter lists are. When c alled 103 where `-o diffs/easylist` is the (optional) output directory where the diffs
104 like this, the shell should automatically expand the `archive/*` directory, givi ng the script 104 should be written, `easylist.txt` is the most recent version of the filter list,
105 each of the files separately. 105 and `archive/*` is the directory where all the archived filter lists are. When
106 106 called like this, the shell should automatically expand the `archive/*`
107 The output of each `list[version].txt` will be written to `diffs/diff[version].t xt`. 107 directory, giving the script each of the filenames separately.
108 The output argument is optional. If ommitted, the data will be written to `stdou t`. 108
109 109 In the above example, the output of each archived `list[version].txt` will be
110 The script produces three types of lines, as specified in the [technical specifi cation][5]: 110 written to `diffs/diff[version].txt`. If the output argument is omitted, the
111 diffs will be written to the current directory.
112
113 The script produces three types of lines, as specified in the [technical
114 specification][5]:
115
111 * Special comments of the form `! <name>:[ <value>]` 116 * Special comments of the form `! <name>:[ <value>]`
112 * Added filters of the form `+ <filter-text>` 117 * Added filters of the form `+ <filter-text>`
113 * Removed filter of the form `- <filter-text>` 118 * Removed filters of the form `- <filter-text>`
119
114 120
115 ## Library API 121 ## Library API
116 122
117 Python-abp can also be used as a library for parsing filter lists. For example 123 Python-abp can also be used as a library for parsing filter lists. For example
118 to read a filter list (we use Python 3 syntax here but the API is the same): 124 to read a filter list (we use Python 3 syntax here but the API is the same):
119 125
120 from abp.filters import parse_filterlist 126 from abp.filters import parse_filterlist
121 127
122 with open('filterlist.txt') as filterlist: 128 with open('filterlist.txt') as filterlist:
123 for line in parse_filterlist(filterlist): 129 for line in parse_filterlist(filterlist):
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 208
203 Now you can use the functions with `abp$functionname`, e.g. 209 Now you can use the functions with `abp$functionname`, e.g.
204 `abp.line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")` 210 `abp.line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")`
205 211
206 212
207 [1]: https://adblockplus.org/filters#special-comments 213 [1]: https://adblockplus.org/filters#special-comments
208 [2]: http://pytest.org/ 214 [2]: http://pytest.org/
209 [3]: https://tox.readthedocs.org/ 215 [3]: https://tox.readthedocs.org/
210 [4]: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt 216 [4]: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
211 [5]: https://docs.google.com/document/d/1SoEqaOBZRCfkh1s5Kds5A5RwUC_nqbYYlGH72s bsSgQ/ 217 [5]: https://docs.google.com/document/d/1SoEqaOBZRCfkh1s5Kds5A5RwUC_nqbYYlGH72s bsSgQ/
LEFTRIGHT

Powered by Google App Engine
This is Rietveld