changes to scripts as to be run by hook

master
Castro0o 8 years ago
parent 3b1d781227
commit 065b39dcb4

@ -102,7 +102,7 @@ def parse_work(site, title, content):
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')
tmpfile = open('tmp_content.mw', 'w') tmpfile = open('./tmp_content.mw', 'w')
tmpfile.write(mw_content) tmpfile.write(mw_content)
tmpfile.close() tmpfile.close()
args_pandoc = shlex.split( 'pandoc -f mediawiki -t html5 tmp_content.mw' ) args_pandoc = shlex.split( 'pandoc -f mediawiki -t html5 tmp_content.mw' )

@ -30,7 +30,7 @@ print year
# DEFS: create_page create_index # DEFS: create_page create_index
###### ######
def create_page(memberpages, mode): def create_page(memberpages, mode):
page_template = open("{}-template.html".format(year), "r") page_template = open("./{}-template.html".format(year), "r")
indexdict = {} #parent dict: contains articledict instances indexdict = {} #parent dict: contains articledict instances
for member in memberpages: for member in memberpages:
print member print member
@ -102,7 +102,7 @@ def create_page(memberpages, mode):
def create_index(indexdict): def create_index(indexdict):
index_template = open("index-template-{}.html".format(year), "r") index_template = open("./index-template-{}.html".format(year), "r")
index_tree = html5lib.parse(index_template, namespaceHTMLElements=False) index_tree = html5lib.parse(index_template, namespaceHTMLElements=False)
index_container = index_tree.find(".//div[@class='isotope']") #maybe id is imp index_container = index_tree.find(".//div[@class='isotope']") #maybe id is imp
keys = indexdict.keys() keys = indexdict.keys()
@ -118,7 +118,7 @@ def create_index(indexdict):
thumbnail=(indexdict[key]['Thumbnail']) thumbnail=(indexdict[key]['Thumbnail'])
) )
print '----', indexdict[key]['Title'],indexdict[key]['Path'] print '----', indexdict[key]['Title'],indexdict[key]['Path']
write_html_file(index_tree, 'web/{}.html'.format('index')) write_html_file(index_tree, './web/{}.html'.format('index'))
##### #####

@ -0,0 +1,10 @@
#!/bin/sh
git_work_tree_path=/var/www/mmdc-site
GIT_WORK_TREE=$git_work_tree_path git checkout -f
commitname=`git log -n 1 --pretty=format:%cn`
commitdate=`git log -n 1 --pretty=format:%cd`
# runs script that converts md to website
python $git_work_tree_path/mmdc_wiki2web.py
Loading…
Cancel
Save