| OLD | NEW |
| 1 # abp2blocklist | 1 # abp2blocklist |
| 2 | 2 |
| 3 This is a script to convert [Adblock Plus filter lists](https://adblockplus.org/
filters) | 3 This is a script to convert [Adblock Plus filter lists](https://adblockplus.org/
filters) |
| 4 to [WebKit block lists](https://www.webkit.org/blog/3476/content-blockers-first-
look/). | 4 to [WebKit block lists](https://www.webkit.org/blog/3476/content-blockers-first-
look/). |
| 5 | 5 |
| 6 Note that WebKit content blockers are fairly limited. Hence, not all filters | 6 Note that WebKit content blockers are fairly limited. Hence, not all filters |
| 7 can be converted (in a compatible way), and some differences compared to Adblock | 7 can be converted (in a compatible way), and some differences compared to Adblock |
| 8 Plus for other browsers are expected. | 8 Plus for other browsers are expected. |
| 9 | 9 |
| 10 This script is used to convert the filter lists for | 10 This script is used to convert the filter lists for |
| 11 [Adblock Plus for iOS](https://adblockplus.org/releases/adblock-plus-10-for-ios-
released). | 11 [Adblock Plus for iOS](https://adblockplus.org/releases/adblock-plus-10-for-ios-
released). |
| 12 | 12 |
| 13 ## Requirements | 13 ## Requirements |
| 14 | 14 |
| 15 The required packages can be installed via [NPM](https://npmjs.org): | 15 The required packages can be installed via [NPM](https://npmjs.org): |
| 16 | 16 |
| 17 ``` | 17 ``` |
| 18 npm install | 18 npm install |
| 19 ``` | 19 ``` |
| 20 | 20 |
| 21 ### Public Suffix List |
| 22 |
| 23 Before you can run the script, you must download the Public Suffix List using |
| 24 the following command: |
| 25 |
| 26 ``` |
| 27 npm run-script download-public-suffix-list |
| 28 ``` |
| 29 |
| 21 ### filterClasses.js | 30 ### filterClasses.js |
| 22 | 31 |
| 23 The filterClasses module in `node_modules/filterClasses.js` is generated from | 32 The filterClasses module in `node_modules/filterClasses.js` is generated from |
| 24 the module in the `adblockpluscore` repository. It has been generated using | 33 the module in the `adblockpluscore` repository. It has been generated using |
| 25 JS Hydra, and small modifications made. If you need to re-generate the file run | 34 JS Hydra, and small modifications made. If you need to re-generate the file run |
| 26 this command (adjusting the paths as appropriate): | 35 this command (adjusting the paths as appropriate): |
| 27 | 36 |
| 28 ``` | 37 ``` |
| 29 python buildtools/jshydra/abp_rewrite.py adblockpluscore/lib/filterClasses.js |
grep -vi filterNotifier > ../abp2blocklist/node_modules/filterClasses.js | 38 python buildtools/jshydra/abp_rewrite.py adblockpluscore/lib/filterClasses.js |
grep -vi filterNotifier > ../abp2blocklist/node_modules/filterClasses.js |
| 30 ``` | 39 ``` |
| 31 You will then need to remove any references to the `utils` module from the | 40 You will then need to remove any references to the `utils` module from the |
| 32 generated file by hand. | 41 generated file by hand. |
| 33 | 42 |
| 34 | 43 |
| 35 ## Usage | 44 ## Usage |
| 36 | 45 |
| 37 ``` | 46 ``` |
| 38 node abp2blocklist.js < easylist.txt > easylist.json | 47 node abp2blocklist.js < easylist.txt > easylist.json |
| 39 ``` | 48 ``` |
| 40 | 49 |
| 41 ## Tests | 50 ## Tests |
| 42 | 51 |
| 43 Unit tests live in the `tests/` directory. To run the unit tests ensure you have | 52 Unit tests live in the `tests/` directory. To run the unit tests ensure you have |
| 44 already installed the required packages (see above) and then type this command: | 53 already installed the required packages (see above) and then type this command: |
| 45 | 54 |
| 46 ``` | 55 ``` |
| 47 npm test | 56 npm test |
| 48 ``` | 57 ``` |
| OLD | NEW |