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

Side by Side Diff: pages/filters.html

Issue 29767583: Issue 6626 - Document the rewrite filter option (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org/
Patch Set: Created May 1, 2018, 7:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pages/filter-cheatsheet.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 title=Writing Adblock Plus filters 1 title=Writing Adblock Plus filters
2 2
3 3
4 <p>{{s1 Current Adblock Plus versions allow you to "tweak" your filters in many different ways. This document explains the choices that you have and how they ca n be used.}}</p> 4 <p>{{s1 Current Adblock Plus versions allow you to "tweak" your filters in many different ways. This document explains the choices that you have and how they ca n be used.}}</p>
5 5
6 <p>{{s2 <em>Disclaimer</em>: All filter examples given here are really only ex amples and are not meant to be used.}}</p> 6 <p>{{s2 <em>Disclaimer</em>: All filter examples given here are really only ex amples and are not meant to be used.}}</p>
7 7
8 <h2 id="introduction">{{s3 Introduction to Adblock Plus filters}}</h2> 8 <h2 id="introduction">{{s3 Introduction to Adblock Plus filters}}</h2>
9 9
10 <p>{{s4 The options described in this section should be enough for users who h ave to create a filter occasionally.}}</p> 10 <p>{{s4 The options described in this section should be enough for users who h ave to create a filter occasionally.}}</p>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 <li>{{s74 <code><fix>collapse</fix></code> — this option will override the g lobal "Hide placeholders of blocked elements" option and make sure the filter al ways hides the element. Similarly the <code><fix>~collapse</fix></code> option w ill make sure the filter never hides the element.}}</li> 174 <li>{{s74 <code><fix>collapse</fix></code> — this option will override the g lobal "Hide placeholders of blocked elements" option and make sure the filter al ways hides the element. Similarly the <code><fix>~collapse</fix></code> option w ill make sure the filter never hides the element.}}</li>
175 <li> 175 <li>
176 {{s75 <code><fix>donottrack</fix></code> — for any address matching a bloc king rule with 176 {{s75 <code><fix>donottrack</fix></code> — for any address matching a bloc king rule with
177 this option and not matching any exception rules with this option a 177 this option and not matching any exception rules with this option a
178 <a href="http://donottrack.us/">Do-Not-Track header</a> will be sent (requ ires 178 <a href="http://donottrack.us/">Do-Not-Track header</a> will be sent (requ ires
179 Adblock Plus 1.3.5 or higher).}} {{s76 For backwards compatibility it is r ecommended 179 Adblock Plus 1.3.5 or higher).}} {{s76 For backwards compatibility it is r ecommended
180 to use this option in combination with contradicting type options, this wi ll prevent this 180 to use this option in combination with contradicting type options, this wi ll prevent this
181 filter from blocking anything in earlier Adblock Plus versions: 181 filter from blocking anything in earlier Adblock Plus versions:
182 <code><fix>*$donottrack,image,~image</fix></code>}} 182 <code><fix>*$donottrack,image,~image</fix></code>}}
183 </li> 183 </li>
184 <li>
185 {{rewriteoption Rewrite the URL with the option <code><fix>rewrite=</fix>< /code>. You must use a regular expression filter, using <code><fix>$n</fix></cod e> in the rewrite argument, with n an number between 1 and 100, will insert the n-th parenthesis submatch of the filter. Anything not explicitely matched by the regular expression will be added in the rewritten string. For example <code><fi x>/(server.com\/assets\/file.php)\?.*$/$rewrite=$1</fix></code> will rewrite the URL by removing everything that comes after ".php". If there is no query parame ter (i.e. no '?'), this filter won't match. The rewrite parameter us the same sy ntax as JavaScript <code><fix>String.prototype.replace()</fix></code> when using a regular expression instead of a substring.}}
Sebastian Noack 2018/05/05 14:48:37 I rather review larger texts with Google Docs: htt
Sebastian Noack 2018/05/08 06:32:23 The edited version in the Google Doc looks good to
hub 2018/05/08 13:36:11 Done.
186 </li>
184 </ul> 187 </ul>
185 188
186 <h4 id="regexps">{{s77 Using regular expressions}}</h4> 189 <h4 id="regexps">{{s77 Using regular expressions}}</h4>
187 190
188 <p>{{s79 If you want even more control about what your filters match and what they don't match, you can use regular expressions. For example the filter <code> <fix>/banner\d+/</fix></code> will match <code><fix>banner123</fix></code> and < code><fix>banner321</fix></code> but not <code><fix>banners</fix></code>. You ca n check out <a href="{{s79-link https://developer.mozilla.org/en/Core_JavaScript _1.5_Guide/Regular_Expressions#Writing_a_Regular_Expression_Pattern}}">documenta tion on regular expressions</a> to learn how to write them.}}</p> 191 <p>{{s79 If you want even more control about what your filters match and what they don't match, you can use regular expressions. For example the filter <code> <fix>/banner\d+/</fix></code> will match <code><fix>banner123</fix></code> and < code><fix>banner321</fix></code> but not <code><fix>banners</fix></code>. You ca n check out <a href="{{s79-link https://developer.mozilla.org/en/Core_JavaScript _1.5_Guide/Regular_Expressions#Writing_a_Regular_Expression_Pattern}}">documenta tion on regular expressions</a> to learn how to write them.}}</p>
189 192
190 <p>{{s80 <em>Note</em>: For performance reasons it is recommended not to use r egular expressions if they can be avoided.}}</p> 193 <p>{{s80 <em>Note</em>: For performance reasons it is recommended not to use r egular expressions if they can be avoided.}}</p>
191 194
192 <h2 id="elemhide">{{s81 Element hiding}}</h2> 195 <h2 id="elemhide">{{s81 Element hiding}}</h2>
193 196
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 {{s110 The data used for creating the signature is a concatenated list of requ est variables (namely URI, host and user agent) separated by the <code><fix>NUL< /fix></code> character "\0". For example:}} 302 {{s110 The data used for creating the signature is a concatenated list of requ est variables (namely URI, host and user agent) separated by the <code><fix>NUL< /fix></code> character "\0". For example:}}
300 </p> 303 </p>
301 304
302 <pre> 305 <pre>
303 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv :30.0) Gecko/20100101 Firefox/30.0 306 /index.html?q=foo\0www.example.com\0Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv :30.0) Gecko/20100101 Firefox/30.0
304 </pre> 307 </pre>
305 308
306 <p> 309 <p>
307 {{s111 Finally, generate the signature for this string by using the signature algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}} 310 {{s111 Finally, generate the signature for this string by using the signature algorithm SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE (default when using OpenSSL).}}
308 </p> 311 </p>
OLDNEW
« no previous file with comments | « pages/filter-cheatsheet.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld