Updated testpage script.

This commit is contained in:
Bastian Kleineidam 2012-12-18 23:39:55 +01:00
parent 43af9dbda4
commit 328d0eae87
2 changed files with 13 additions and 2838 deletions

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@ from __future__ import print_function
import sys import sys
import os import os
import time import time
import cgi
sys.path.append(os.path.join(os.path.dirname(__file__), "..")) sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from dosagelib.scraper import get_scrapers from dosagelib.scraper import get_scrapers
@ -13,11 +14,11 @@ extends: base.j2
title: Dosage by Bastian Kleineidam title: Dosage by Bastian Kleineidam
description: a commandline webcomic downloader and archiver description: a commandline webcomic downloader and archiver
--- ---
{% block js %} {%% block js %%}
<script src="media/js/masonry.min.js"></script> <script src="media/js/masonry.min.js"></script>
{% endblock js %} {%% endblock js %%}
{% block content %} {%% block content %%}
<div class="inner clearfix"> <div class="inner clearfix">
<section id="main-content"> <section id="main-content">
@ -34,7 +35,7 @@ window.onload = function() {
}); });
}; };
</script> </script>
{% endblock content %} {%% endblock content %%}
""" """
@ -89,16 +90,20 @@ def get_content(filename):
res = [] res = []
for name, url, result, reason in tests: for name, url, result, reason in tests:
css = result.lower() css = result.lower()
if len(name) > 25 and '/' in name: if len(name) > 40:
name = name.replace('/', '/ ') name = name[:37] + "..."
if url: if url:
inner = '<a href="%s" title="%s" class="%s">%s %s</a>' % (url, reason, css, name, result) inner = '<a href="%s" title="%s" class="%s">%s</a>' % quote_all(url, reason, css, name)
else: else:
inner = '<span title="%s" class="%s">%s %s</span>' % (reason, css, name, result) inner = '<span title="%s" class="%s">%s</span>' % quote_all(reason, css, name)
res.append(' <div class="item">%s</div>' % inner) res.append(' <div class="item">%s</div>' % inner)
return os.linesep.join(res) return os.linesep.join(res)
def quote_all(*args):
return tuple(cgi.escape(x, quote=True) for x in args)
def main(args): def main(args):
filename = args[0] filename = args[0]
modified = get_mtime(filename) modified = get_mtime(filename)