You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
925 B
Python
32 lines
925 B
Python
9 years ago
|
#! /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
|