page creation working

master
Castro0o 9 years ago
parent 818e007157
commit cadc0f7b8c

@ -23,8 +23,8 @@ display: none;
## To Do
* add auxiliar JSON creation
* replace direct API calls for mw library
* remove thumbnail from page_imgs

@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import pprint, re, subprocess, shlex
import pprint, re, subprocess, shlex, urllib
import xml.etree.ElementTree as ET
from mwclient import Site
@ -76,6 +76,29 @@ def write_html_file(html_tree, filename):
edited.write(html)
edited.close()
def parse_work(site, title, content):
# print title, content
workdict = {'Title':title, 'Creator':u'', 'Date':u'', 'Website':u'', 'Thumbnail':u'', 'Bio':u'', 'Description':u'', 'Extra':u''}
if re.match(u'\{\{\Graduation work', content):
template, extra = (re.findall(u'\{\{Graduation work\n(.*?)\}\}(.*)', content, re.DOTALL))[0]
if extra:
workdict['Extra'] = extra
# template's key/value pair
# Note:Extra value is NOT CAPTURED by this regex
keyval = re.findall(u'\|(.*?)\=(.*?\n)', template, re.DOTALL)
for pair in keyval:
key = pair[0]
val = (pair[1]).replace('\n', '')
if 'Creator' in key:
val = val.replace(u', ', u'')
elif 'Thumbnail' in key:
val = mw_img_url(site, val)#api_thumb_url(val)
elif 'Website' in key:
val = urllib.unquote( val)
workdict[key]=val
# pprint.pprint(workdict)
return workdict
def pandoc2html(mw_content):
'''convert individual mw sections to html'''
mw_content = mw_content.encode('utf-8')

@ -5,10 +5,10 @@
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
<title></title>
<link href="./css/style.css" rel="stylesheet">
<link href="./css/style_projectpage.css" rel="stylesheet">
<link href="./fonts/fontstylesheet01.css" rel="stylesheet">
<link href="./css/fixedsticky.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
<link href="../css/style_projectpage.css" rel="stylesheet">
<link href="../fonts/fontstylesheet01.css" rel="stylesheet">
<link href="../css/fixedsticky.css" rel="stylesheet">
</head>
<body>
@ -17,7 +17,7 @@
<div id="sidebarInner">
<div id="sideBarDesc">
<div id="sideBarDescInfo">
<a href="index.html" class="hoverBackA"><img class="template" src="./img/arrowBack.svg"></a><p>Tempted by Tomorrow</p>
<a href="index.html" class="hoverBackA"><img class="template" src="../img/arrowBack.svg"></a><p>Tempted by Tomorrow</p>
</div>
<div id="sideBarDescInner">
@ -42,17 +42,17 @@
</div>
</div>
<div id="logoWrap"><img class="template" id="logo" src="./img/black_PZI_logo_p.svg"></div>
<div id="logoWrap"><img class="template" id="logo" src="../img/black_PZI_logo_p.svg"></div>
</div>
<div class="zwartArea zwartAreaWhite sidebarBorderLeft" id="section02">
<div class="fixedsticky" id="filter" style="top:0;">
<div class="themes" id="sortArea">
<a href="index.html" class="hoverBackB">
<img class="template" src="./img/arrowBack.svg">
<img class="template" src="../img/arrowBack.svg">
</a>
<p></p><!--{title}-->
<a class="closeSidebar"><img class="template" src="./img/arrowUpW.svg"/></a>
<a class="closeSidebar"><img class="template" src="../img/arrowUpW.svg"/></a>
</div>
</div>
@ -67,10 +67,10 @@
</div>
</div>
<script src='./js/jquery-2.1.3.min.js'></script>
<script src='./js/fixedfixed.js'></script>
<script src='./js/fixedsticky.js'></script>
<script src='./js/mainScripts_single.js'></script>
<script src='../js/jquery-2.1.3.min.js'></script>
<script src='../js/fixedfixed.js'></script>
<script src='../js/fixedsticky.js'></script>
<script src='../js/mainScripts_single.js'></script>
</body>
</html>

Loading…
Cancel
Save