diff options
author | emkael <emkael@tlen.pl> | 2015-02-10 13:50:11 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2015-02-10 13:50:11 +0100 |
commit | 0373303d7f3fd4a2be7aa89c6bb87da1004cec58 (patch) | |
tree | 8feeff0b6d7ea2c974a7be1e60525f4165301204 | |
parent | 80ce42da73d139fd5d55c1ebca0fdc2497028c51 (diff) |
* credits + markup fixes
-rw-r--r-- | http/index.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/http/index.py b/http/index.py index 4bccde5..9ba0371 100644 --- a/http/index.py +++ b/http/index.py @@ -68,7 +68,7 @@ def handler(req): return apache.OK # we need to sanitize line breaks and double-closed anchors manually - remote_content = bs4('<body>' + ' '.join(remote_content[delimiters[0]+1:delimiters[1]]).replace('<BR>', '<br />').replace('</a></a>', '</a>') + '</body>', 'html.parser') + remote_content = bs4('<div>' + ' '.join(remote_content[delimiters[0]+1:delimiters[1]]).replace('<BR>', '<br />').replace('</a></a>', '</a>') + '</div>', 'html.parser') # stub template for output page page_content = bs4(''' <html><head> @@ -80,7 +80,7 @@ def handler(req): </style> </head><body></body></html> ''', 'html.parser') - page_content.html.body.append(remote_content.body) + page_content.html.body.append(remote_content.div) # internal links being rewritten to application links for link in page_content.select('a[href^="?p=21&pid="]'): @@ -119,6 +119,10 @@ def handler(req): for element in page_content.select(selector): link = element.wrap(page_content.new_tag('a')) link['href'] = search_url + + # credits info + credits_div = bs4('<div style="position:absolute;top:250px;width:130px;left:460px;opacity:0.02">Pomysł Ivana,<br />Ivan jest zajebisty.</div>', 'html.parser', from_encoding='utf-8') + page_content.html.body.div.append(credits_div.div) req.content_type = 'text/html' req.write(page_content.prettify('utf-8')) |