X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git;a=blobdiff_plain;f=compile.py;fp=compile.py;h=4d2dbe257fe1d88fdc3e2951cc9f6307410b2e4f;hp=0000000000000000000000000000000000000000;hb=ab78acc683cf497b1b910e85fbbb77703401da6d;hpb=c90c680e13cc1c51f53479ed9427ca60c5ec5a0c 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()