rewriting all mechanism from scrath - w/out json
parent
63e8313370
commit
4fbfd6b88a
File diff suppressed because one or more lines are too long
@ -0,0 +1,31 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
###########
|
||||
# Testing downloading and converting mw page content to html
|
||||
###########
|
||||
from mmdc_modules import api_request, api_page, api_thumb_url, pandoc2html, parse_work_page, parse_work
|
||||
|
||||
template = open("web/page-template.html", "r")
|
||||
template = template.read()
|
||||
template = template.format(title="This is My Title", creator='', date='', website='', thumbnail='', bio='',description='', extra='' )
|
||||
# download
|
||||
pageid='15965'
|
||||
article = api_page(pageid, 'content')
|
||||
#print article
|
||||
#print '----------- article -----'
|
||||
|
||||
# parsing article
|
||||
extra, description = parse_work('Qq', article)
|
||||
|
||||
# placing mw content inside dict makes it non convertable. Why?
|
||||
#print extra #work_dict['Extra']
|
||||
|
||||
html_extra = pandoc2html(extra.encode('utf-8'))
|
||||
html_description = pandoc2html(description.encode('utf-8'))
|
||||
|
||||
print '----------- html -----'
|
||||
print html_description
|
||||
#print html_extra
|
||||
|
||||
print template
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{title}</title> <!-- Work title will go to here -->
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<div id="title"><h1>{title}</h1></div>
|
||||
<div id="creator"><h2>{creator}</h2></div>
|
||||
<div id="date">{date}</div>
|
||||
<div id="website"><a href="{website}">{website}</a></div>
|
||||
<div id="thumbnail"><img src="{thumbnail}" class="" alt="" /></div>
|
||||
<div id="bio">{bio}</div>
|
||||
</div>
|
||||
<div id="body">
|
||||
<div id="description">{description}</div>
|
||||
<div id="extra">{extra}</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue