1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

rewrite: disable one 'top' rewriting rule (should move to seperate mixin)

views: add urlsplit jinja2 filter
This commit is contained in:
Ilya Kreymer 2014-04-27 01:04:20 -07:00
parent 09653cf77e
commit 53ad67eb9c
2 changed files with 10 additions and 4 deletions

View File

@ -128,12 +128,11 @@ class JSLinkAndLocationRewriter(JSLinkOnlyRewriter):
(r'(?<=document\.)domain', RegexRewriter.add_prefix(prefix), 0),
(r'(?<=document\.)referrer', RegexRewriter.add_prefix(prefix), 0),
#todo: move to mixin?
(r'(?<=window\.)top', RegexRewriter.add_prefix(prefix), 0),
(r'\b(top)\b[!=\W]+(?:self|window)', RegexRewriter.add_prefix(prefix), 1),
(r'(?:self|window)[!=\W]+\b(top)\b', RegexRewriter.add_prefix(prefix), 1),
#(r'\b(?:self|window)\b[!=\W]+\b(top)\b', RegexRewriter.add_prefix(prefix), 1),
]
#import sys
#sys.stderr.write('\n\n*** RULES:' + str(rules) + '\n\n')
super(JSLinkAndLocationRewriter, self).__init__(rewriter, rules)

View File

@ -48,7 +48,14 @@ def format_ts(value, format_='%a, %b %d %Y %H:%M:%S'):
@template_filter('host')
def get_hostname(url):
return urlparse.urlsplit(url).netloc
split = urlparse.urlsplit(url)
return split.netloc
@template_filter('urlsplit')
def get_urlsplit(url):
split = urlparse.urlsplit(url)
return split
@template_filter()