Post Reply 
Correct link targets (site-specific, list-based)
Nov. 03, 2012, 11:11 PM (This post was last modified: Nov. 03, 2012 11:35 PM by duebel13.)
Post: #3
RE: Correct link targets (site-specific, list-based)
Thanks JJoe. Using , instead of @, this is the latest version of the filter:

Code:
Name = "Links: Correct Target (Site-specifc, HTML) [dbl]"
Active = TRUE
Multi = TRUE
URL = "($TYPE(htm)|$TST(CType=xhtml))$LST(CorrectLinkTargets-S)"
Bounds = "$NEST(<a\s,>)"
Limit = 512
Match = "\2( target=$AV(\4)|)(\3)>"
        "&"
        "*href=$AV(([^\?]+)\5(\?*|))&($TST(href=*,$TST(\5),*)|"
        "$TST(href=([^,]+{1,*})\6,*)$TST(\5=$TST(\6)*)|$TST(href=(*,([^,]+{1,*})\6)$TST(\5=*$TST(\6)))
        "&"
        "((^$TST(target=*))($TST(\5=*.(7z|zip|rar|exe|msi|pdf|tgz|gz|rpm|iso))"
        "$SET(1=_self)|$SET(1=_blank))|$SET(1=$GET(target)))"
        "&"
        "(^*\starget="\1")
Replace = "\2\3 target="\1">"

These are working list entries:

Code:
(www|encrypted).google.[^/:]+(:443|)/search\?    $SET(href=http,)
www.heise.de/newsticker/                        $SET(href=/newsticker/meldung,)
(www.ebay.(de|com|co.uk))\0/[^\?]++/(i|m).html    $SET(href=http://\0/itm/,)
*/(viewforum|[Ff]orum(s|)/index).php        $SET(href=,./viewtopic.php,./viewforum.php,./memberlist.php,)

I guess this filter isn't one of the fastest and it still lacks regular expressions in the href match, but it offers some kind of flexibility in this version:

- only characters up to (but not including) a question mark are used for the match so that session ids and other arguments are discarded before matching
- everything between two commas must fully and exactly match
- if the first literal after the equal sign has no leading comma, it will be treated as if it had an asterisk wildcard at the end, i.e. "http," stands for http* (any URL starting with http)
- if the last literal has no trailing comma, it will be treated as if it had an asterisk wildcard at the beginning, i.e ",.php" stands for any URL ending with .php (or .php?var=value&...)

The $TST(CType=xhtml) used here is special to M. Buerschgen's filter set, but I noted that sidki's has a similar notation.

Thanks again.

Regards and <Gn(8)> (it's 8 min. past midnight here...)
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Correct link targets (site-specific, list-based) - duebel13 - Nov. 03, 2012 11:11 PM

Forum Jump: