page creation working

master
Castro0o 10 years ago
parent 818e007157
commit cadc0f7b8c

@ -23,8 +23,8 @@ display: none;
## To Do ## 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 #! /usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pprint, re, subprocess, shlex import pprint, re, subprocess, shlex, urllib
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from mwclient import Site from mwclient import Site
@ -76,6 +76,29 @@ def write_html_file(html_tree, filename):
edited.write(html) edited.write(html)
edited.close() 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): def pandoc2html(mw_content):
'''convert individual mw sections to html''' '''convert individual mw sections to html'''
mw_content = mw_content.encode('utf-8') mw_content = mw_content.encode('utf-8')

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

Loading…
Cancel
Save