From ab78acc683cf497b1b910e85fbbb77703401da6d Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Sun, 16 Aug 2015 18:58:42 +1000 Subject: compile.py generates bip39-standalone.html --- compile.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 compile.py (limited to 'compile.py') diff --git a/compile.py b/compile.py new file mode 100644 index 0000000..4d2dbe2 --- /dev/null +++ b/compile.py @@ -0,0 +1,48 @@ +import os +import re +import datetime + +# This script generates the bip39-standalone.html file. + +# It removes script and style tags and replaces with the file content. + +f = open('src/index.html') +page = f.read() +f.close() + + +# Script tags + +scriptsFinder = re.compile("""""") +scripts = scriptsFinder.findall(page) + +for script in scripts: + filename = os.path.join("src", script) + s = open(filename) + scriptContent = "" % s.read() + s.close() + scriptTag = """""" % script + page = page.replace(scriptTag, scriptContent) + + +# Style tags + +stylesFinder = re.compile("""""") +styles = stylesFinder.findall(page) + +for style in styles: + filename = os.path.join("src", style) + s = open(filename) + styleContent = "" % s.read() + s.close() + styleTag = """""" % style + page = page.replace(styleTag, styleContent) + + +# Write the standalone file + +f = open('bip39-standalone.html', 'w') +f.write(page) +f.close() + +print "%s - DONE" % datetime.datetime.now() -- cgit v1.2.3