mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 05:28:14 +08:00
支持16byte分行和js
This commit is contained in:
@@ -4,12 +4,14 @@ import os
|
||||
import glob
|
||||
import binascii
|
||||
import gzip
|
||||
import re
|
||||
|
||||
try:
|
||||
io = __import__("io").BytesIO
|
||||
except:
|
||||
io = __import__("StringIO").StringIO
|
||||
|
||||
for fn in glob.glob('*.html'):
|
||||
def gen(fn):
|
||||
s = open(fn, 'rb').read()
|
||||
dat = io()
|
||||
with gzip.GzipFile(fileobj=dat, mode="w") as f:
|
||||
@@ -20,6 +22,13 @@ for fn in glob.glob('*.html'):
|
||||
except:
|
||||
s = ','.join(["0x"+binascii.hexlify(c) for c in dat])
|
||||
|
||||
fn = fn.replace('.', '_')
|
||||
print("const unsigned char %s[0x%x] = {%s};" % (fn, len(dat), s))
|
||||
s = re.sub("((?:0x.+?,){16})", "\\1\n", s)
|
||||
|
||||
fn = fn.replace('.', '_')
|
||||
print("const unsigned char %s[0x%x] = {\n%s};" % (fn, len(dat), s))
|
||||
|
||||
for fn in glob.glob('*.html'):
|
||||
gen(fn)
|
||||
|
||||
for fn in glob.glob('*.js'):
|
||||
gen(fn)
|
||||
|
||||
Reference in New Issue
Block a user