compile.py generates bip39-standalone.html

This commit is contained in:
Ian Coleman
2015-08-16 18:58:42 +10:00
parent c90c680e13
commit ab78acc683
3 changed files with 9233 additions and 28471 deletions

File diff suppressed because one or more lines are too long

48
compile.py Normal file
View File

@@ -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("""<script src="/(.*)"></script>""")
scripts = scriptsFinder.findall(page)
for script in scripts:
filename = os.path.join("src", script)
s = open(filename)
scriptContent = "<script>%s</script>" % s.read()
s.close()
scriptTag = """<script src="/%s"></script>""" % script
page = page.replace(scriptTag, scriptContent)
# Style tags
stylesFinder = re.compile("""<link rel="stylesheet" href="/(.*)">""")
styles = stylesFinder.findall(page)
for style in styles:
filename = os.path.join("src", style)
s = open(filename)
styleContent = "<style>%s</style>" % s.read()
s.close()
styleTag = """<link rel="stylesheet" href="/%s">""" % 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()

View File

@@ -12,6 +12,8 @@ Download `bip39-standalone.html`
Open the file in a browser by double clicking it.
This can be compiled from source using the command `python compile.py`
## Usage
Enter your BIP39 phrase into the 'BIP39 Phrase' field, or press
@@ -25,3 +27,10 @@ Toggle columns to blank to easily copy/paste a single column of data, eg to
import private keys into a wallet or supply someone with a list of addresses.
The BIP32 keys can be used at [bip32.org](https://bip32.org) if desired.
## Making changes
Please do not make modifications to `bip39-standalone.html`, since they will
be overwritten by `compile.py`.
Make changes in `src/*` and apply them using the command `python compile.py`