forked from entrouvert/publik-base-theme
trivial: apply black
This commit is contained in:
parent
da4448c589
commit
2bf37aaa7e
|
@ -28,8 +28,9 @@ for dirname in sorted(os.listdir('static')):
|
||||||
theme['variables']['no_extra_js'] = False
|
theme['variables']['no_extra_js'] = False
|
||||||
else:
|
else:
|
||||||
theme['variables']['no_extra_js'] = True
|
theme['variables']['no_extra_js'] = True
|
||||||
if (os.path.exists(os.path.join('static', dirname, 'backoffice.scss')) or
|
if os.path.exists(os.path.join('static', dirname, 'backoffice.scss')) or os.path.exists(
|
||||||
os.path.exists(os.path.join('static', dirname, 'backoffice.css'))):
|
os.path.join('static', dirname, 'backoffice.css')
|
||||||
|
):
|
||||||
theme['variables']['portal_agent_extra_css'] = '/static/%s/backoffice.css' % dirname
|
theme['variables']['portal_agent_extra_css'] = '/static/%s/backoffice.css' % dirname
|
||||||
else:
|
else:
|
||||||
theme['variables']['portal_agent_extra_css'] = None
|
theme['variables']['portal_agent_extra_css'] = None
|
||||||
|
@ -53,21 +54,23 @@ for dirname in sorted(os.listdir('static')):
|
||||||
if settings_app == 'combo':
|
if settings_app == 'combo':
|
||||||
for settings_key in theme['settings'][settings_app].keys():
|
for settings_key in theme['settings'][settings_app].keys():
|
||||||
if settings_key not in (
|
if settings_key not in (
|
||||||
'COMBO_ASSET_SLOTS.update',
|
'COMBO_ASSET_SLOTS.update',
|
||||||
'COMBO_CELL_ASSET_SLOTS.update',
|
'COMBO_CELL_ASSET_SLOTS.update',
|
||||||
'COMBO_MAP_ATTRIBUTION',
|
'COMBO_MAP_ATTRIBUTION',
|
||||||
'COMBO_MAP_DEFAULT_POSITION',
|
'COMBO_MAP_DEFAULT_POSITION',
|
||||||
'COMBO_MAP_MAX_BOUNDS',
|
'COMBO_MAP_MAX_BOUNDS',
|
||||||
'COMBO_MAP_TILE_URLTEMPLATE',
|
'COMBO_MAP_TILE_URLTEMPLATE',
|
||||||
'COMBO_PUBLIC_TEMPLATES.update',
|
'COMBO_PUBLIC_TEMPLATES.update',
|
||||||
'COMBO_SEARCH_SERVICES.update',
|
'COMBO_SEARCH_SERVICES.update',
|
||||||
'JSON_CELL_TYPES.update',
|
'JSON_CELL_TYPES.update',
|
||||||
'PWA_NOTIFICATION_BADGE_URL',
|
'PWA_NOTIFICATION_BADGE_URL',
|
||||||
'PWA_NOTIFICATION_ICON_URL',
|
'PWA_NOTIFICATION_ICON_URL',
|
||||||
'WCS_CATEGORY_ASSET_SLOTS',
|
'WCS_CATEGORY_ASSET_SLOTS',
|
||||||
'WCS_FORM_ASSET_SLOTS',
|
'WCS_FORM_ASSET_SLOTS',
|
||||||
):
|
):
|
||||||
print('E: unknown settings key for %s (%s)' % (dirname, settings_key), file=sys.stderr)
|
print(
|
||||||
|
'E: unknown settings key for %s (%s)' % (dirname, settings_key), file=sys.stderr
|
||||||
|
)
|
||||||
errors = True
|
errors = True
|
||||||
|
|
||||||
themes.append(theme)
|
themes.append(theme)
|
||||||
|
@ -85,8 +88,12 @@ if os.path.exists('help/fr/misc-scss.page'):
|
||||||
description = ''.join(description.itertext()).strip('$')
|
description = ''.join(description.itertext()).strip('$')
|
||||||
value = ''.join(value.itertext()).strip('$')
|
value = ''.join(value.itertext()).strip('$')
|
||||||
parameter_type = 'text'
|
parameter_type = 'text'
|
||||||
if (value.startswith('#') or value in ('white', 'black') or
|
if (
|
||||||
name.endswith('color') or name.endswith('background')):
|
value.startswith('#')
|
||||||
|
or value in ('white', 'black')
|
||||||
|
or name.endswith('color')
|
||||||
|
or name.endswith('background')
|
||||||
|
):
|
||||||
parameter_type = 'color'
|
parameter_type = 'color'
|
||||||
if value.endswith('px') or value.endswith('rem') or name.endswith('size'):
|
if value.endswith('px') or value.endswith('rem') or name.endswith('size'):
|
||||||
parameter_type = 'size'
|
parameter_type = 'size'
|
||||||
|
|
|
@ -9,10 +9,7 @@ os.chdir(sys.argv[1])
|
||||||
data_uris = []
|
data_uris = []
|
||||||
for filename in os.listdir('img/'):
|
for filename in os.listdir('img/'):
|
||||||
varname, filetype = os.path.splitext(filename)
|
varname, filetype = os.path.splitext(filename)
|
||||||
mimetype = {
|
mimetype = {'.png': 'image/png', '.svg': 'image/svg+xml'}.get(filetype)
|
||||||
'.png': 'image/png',
|
|
||||||
'.svg': 'image/svg+xml'
|
|
||||||
}.get(filetype)
|
|
||||||
if not mimetype:
|
if not mimetype:
|
||||||
continue
|
continue
|
||||||
filesize = os.stat('img/' + filename).st_size
|
filesize = os.stat('img/' + filename).st_size
|
||||||
|
|
|
@ -13,11 +13,20 @@ args = parser.parse_args()
|
||||||
for filename in os.listdir(os.path.join(args.path, 'src')):
|
for filename in os.listdir(os.path.join(args.path, 'src')):
|
||||||
outname = os.path.basename(filename)
|
outname = os.path.basename(filename)
|
||||||
fd = open('/tmp/tmp-%s' % outname, 'w')
|
fd = open('/tmp/tmp-%s' % outname, 'w')
|
||||||
fd.write(open(os.path.join(args.path, 'src', filename)).read().replace(
|
fd.write(
|
||||||
'fill:#DA0000', 'fill:#%s' % args.color))
|
open(os.path.join(args.path, 'src', filename)).read().replace('fill:#DA0000', 'fill:#%s' % args.color)
|
||||||
|
)
|
||||||
fd.close()
|
fd.close()
|
||||||
subprocess.call(['inkscape', '--without-gui',
|
subprocess.call(
|
||||||
'--file', '/tmp/tmp-%s' % outname,
|
[
|
||||||
|
'inkscape',
|
||||||
|
'--without-gui',
|
||||||
|
'--file',
|
||||||
|
'/tmp/tmp-%s' % outname,
|
||||||
'--export-area-drawing',
|
'--export-area-drawing',
|
||||||
'--export-png', os.path.join(args.path, outname.replace('.svg', '-%s.png' % args.color)),
|
'--export-png',
|
||||||
'--export-height', '31'])
|
os.path.join(args.path, outname.replace('.svg', '-%s.png' % args.color)),
|
||||||
|
'--export-height',
|
||||||
|
'31',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
|
@ -10,6 +10,8 @@ args = sys.argv[1:]
|
||||||
if b'Inkscape 0' not in inkscape_version:
|
if b'Inkscape 0' not in inkscape_version:
|
||||||
# --export-png replaced by --export-filename
|
# --export-png replaced by --export-filename
|
||||||
# --without-gui and --file removed
|
# --without-gui and --file removed
|
||||||
args = [x.replace('--export-png', '--export-filename') for x in args if x not in ('--without-gui', '--file')]
|
args = [
|
||||||
|
x.replace('--export-png', '--export-filename') for x in args if x not in ('--without-gui', '--file')
|
||||||
|
]
|
||||||
|
|
||||||
sys.exit(subprocess.call(['inkscape'] + args))
|
sys.exit(subprocess.call(['inkscape'] + args))
|
||||||
|
|
|
@ -26,66 +26,66 @@ import sys
|
||||||
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
||||||
|
|
||||||
names = {
|
names = {
|
||||||
'02': 'famille',
|
'02': 'famille',
|
||||||
'03': 'papiers',
|
'03': 'papiers',
|
||||||
'04': 'sante',
|
'04': 'sante',
|
||||||
'05': 'travail',
|
'05': 'travail',
|
||||||
'06': 'logement',
|
'06': 'logement',
|
||||||
'07': 'transport',
|
'07': 'transport',
|
||||||
'08': 'sport',
|
'08': 'sport',
|
||||||
'09': 'securite',
|
'09': 'securite',
|
||||||
'10': 'signalements',
|
'10': 'signalements',
|
||||||
'11': 'dechets'
|
'11': 'dechets',
|
||||||
}
|
}
|
||||||
|
|
||||||
filenames = [
|
filenames = [
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_02.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_02.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_03.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_03.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_04.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_04.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_05.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_05.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_06.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_06.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_07.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_07.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_08.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_08.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_09.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_09.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_10.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_10.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_11.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_11.svg',
|
||||||
]
|
]
|
||||||
|
|
||||||
whitelist = [
|
whitelist = [
|
||||||
'M38.354,88.859l-3.', # papiers/shirt
|
'M38.354,88.859l-3.', # papiers/shirt
|
||||||
'M96.213,42.521c-0.', # signalements/1st wave
|
'M96.213,42.521c-0.', # signalements/1st wave
|
||||||
'M101.516,45.251c-0', # signalements/2nd wave
|
'M101.516,45.251c-0', # signalements/2nd wave
|
||||||
'M111.558,47.581c-0', # signalements/3rd wave
|
'M111.558,47.581c-0', # signalements/3rd wave
|
||||||
'M118.346,102.92c-0', # transport/cadre velo
|
'M118.346,102.92c-0', # transport/cadre velo
|
||||||
'M92.644,102.92c-0.', # "
|
'M92.644,102.92c-0.', # "
|
||||||
'M92.643,102.92H70', # "
|
'M92.643,102.92H70', # "
|
||||||
'M63.625,95.128c-7.', # sante/wheelchair
|
'M63.625,95.128c-7.', # sante/wheelchair
|
||||||
'M69.187,64.57c-0.3', # sante/kid
|
'M69.187,64.57c-0.3', # sante/kid
|
||||||
'M66.882,52.466c-0.', # "
|
'M66.882,52.466c-0.', # "
|
||||||
'M90.321,95.128c-0.', # "
|
'M90.321,95.128c-0.', # "
|
||||||
'M94.035,85.527c-0.', # "
|
'M94.035,85.527c-0.', # "
|
||||||
'M68.871,60.921c-4.', # "
|
'M68.871,60.921c-4.', # "
|
||||||
'M71.663,53.41c-0.2', # "
|
'M71.663,53.41c-0.2', # "
|
||||||
'M73.875,52.752c-0.', # "
|
'M73.875,52.752c-0.', # "
|
||||||
'M114.493,43.283c-0', # sante/stetho
|
'M114.493,43.283c-0', # sante/stetho
|
||||||
'M137.485,76.615c-0', # "
|
'M137.485,76.615c-0', # "
|
||||||
'M141.604,77.302c0,', # "
|
'M141.604,77.302c0,', # "
|
||||||
'M108.574,71.064L', # logement/house
|
'M108.574,71.064L', # logement/house
|
||||||
'M96.33,80.938H84.', # travail/briefcase outline
|
'M96.33,80.938H84.', # travail/briefcase outline
|
||||||
]
|
]
|
||||||
blacklist = [
|
blacklist = [
|
||||||
'M104.125,87.167H', # famille/border
|
'M104.125,87.167H', # famille/border
|
||||||
'M83.83,46.362l0.4', # papiers/i
|
'M83.83,46.362l0.4', # papiers/i
|
||||||
'M85.544,35.605l-0', # papiers/d
|
'M85.544,35.605l-0', # papiers/d
|
||||||
'M96.618,36.592l-0', # papiers/e
|
'M96.618,36.592l-0', # papiers/e
|
||||||
'M105.127,26.812l1', # papiers/n
|
'M105.127,26.812l1', # papiers/n
|
||||||
'M111.078,28.917l0', # papiers/t
|
'M111.078,28.917l0', # papiers/t
|
||||||
'M119.033,40.591l0', # papiers/i
|
'M119.033,40.591l0', # papiers/i
|
||||||
'M123.222,26.927l0', # papiers/t
|
'M123.222,26.927l0', # papiers/t
|
||||||
'M131.074,39.075l0', # papiers/e
|
'M131.074,39.075l0', # papiers/e
|
||||||
'M92.208,95.872H59', # travail/briefcase parts
|
'M92.208,95.872H59', # travail/briefcase parts
|
||||||
'M81.853,95.268c0,', # "
|
'M81.853,95.268c0,', # "
|
||||||
]
|
]
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('path', help='out path')
|
parser.add_argument('path', help='out path')
|
||||||
|
@ -102,24 +102,35 @@ for filename in filenames:
|
||||||
outname = names.get(re.search(r'\d+', filename).group())
|
outname = names.get(re.search(r'\d+', filename).group())
|
||||||
|
|
||||||
fd = open('tmp-%s.svg' % outname, 'w')
|
fd = open('tmp-%s.svg' % outname, 'w')
|
||||||
fd.write(open(os.path.join('pictos', filename)).read().replace(
|
fd.write(
|
||||||
'E0037A', args.primary).replace(
|
open(os.path.join('pictos', filename))
|
||||||
'6D1F80', args.secondary))
|
.read()
|
||||||
|
.replace('E0037A', args.primary)
|
||||||
|
.replace('6D1F80', args.secondary)
|
||||||
|
)
|
||||||
fd.close()
|
fd.close()
|
||||||
subprocess.call([inkscape, '--without-gui',
|
subprocess.call(
|
||||||
'--file', 'tmp-%s.svg' % outname,
|
[
|
||||||
|
inkscape,
|
||||||
|
'--without-gui',
|
||||||
|
'--file',
|
||||||
|
'tmp-%s.svg' % outname,
|
||||||
'--export-area-page',
|
'--export-area-page',
|
||||||
'--export-png', os.path.join(path_out, '%s.png' % outname),
|
'--export-png',
|
||||||
'--export-width', '128'])
|
os.path.join(path_out, '%s.png' % outname),
|
||||||
|
'--export-width',
|
||||||
|
'128',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
tree = ET.parse(open(os.path.join('pictos', filename)))
|
tree = ET.parse(open(os.path.join('pictos', filename)))
|
||||||
parent_map = {c:p for p in tree.iter() for c in p}
|
parent_map = {c: p for p in tree.iter() for c in p}
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
for node in tree.iter():
|
for node in tree.iter():
|
||||||
tag_name = node.tag.split('}')[-1]
|
tag_name = node.tag.split('}')[-1]
|
||||||
if tag_name == 'svg':
|
if tag_name == 'svg':
|
||||||
continue
|
continue
|
||||||
if tag_name == 'g': # keep groups
|
if tag_name == 'g': # keep groups
|
||||||
continue
|
continue
|
||||||
if tag_name in ('linearGradient', 'polygon', 'rect', 'clipPath', 'polyline', 'circle'):
|
if tag_name in ('linearGradient', 'polygon', 'rect', 'clipPath', 'polyline', 'circle'):
|
||||||
if tag_name == 'circle' and outname == 'transport':
|
if tag_name == 'circle' and outname == 'transport':
|
||||||
|
@ -166,12 +177,14 @@ for filename in filenames:
|
||||||
del node.attrib['style']
|
del node.attrib['style']
|
||||||
if tag_name == 'path':
|
if tag_name == 'path':
|
||||||
if node.attrib.get('fill') == '#FFFFFF' or (
|
if node.attrib.get('fill') == '#FFFFFF' or (
|
||||||
node.attrib['d'].startswith('M120.281,98.383c-1') or # travail/skirt
|
node.attrib['d'].startswith('M120.281,98.383c-1')
|
||||||
node.attrib['d'].startswith('M108.574,71.064L') or # logement/house
|
or node.attrib['d'].startswith('M108.574,71.064L') # travail/skirt
|
||||||
node.attrib['d'].startswith('M37.523,66.207c0,5') or # transport/wheel
|
or node.attrib['d'].startswith('M37.523,66.207c0,5') # logement/house
|
||||||
node.attrib['d'].startswith('M-9.2,66.207c0,5.2') or # transport/other wheel
|
or node.attrib['d'].startswith('M-9.2,66.207c0,5.2') # transport/wheel
|
||||||
node.attrib['d'].startswith('M96.33,80.938H84.') # travail/briefcase outline
|
or node.attrib['d'].startswith( # transport/other wheel
|
||||||
):
|
'M96.33,80.938H84.'
|
||||||
|
) # travail/briefcase outline
|
||||||
|
):
|
||||||
node.attrib['fill'] = 'none'
|
node.attrib['fill'] = 'none'
|
||||||
node.attrib['stroke'] = '#FFFFFF'
|
node.attrib['stroke'] = '#FFFFFF'
|
||||||
else:
|
else:
|
||||||
|
@ -180,8 +193,16 @@ for filename in filenames:
|
||||||
node.attrib['fill'] = 'none'
|
node.attrib['fill'] = 'none'
|
||||||
node.attrib['stroke'] = '#FFFFFF'
|
node.attrib['stroke'] = '#FFFFFF'
|
||||||
tree.write('tmp-%s.svg' % outname)
|
tree.write('tmp-%s.svg' % outname)
|
||||||
subprocess.call([inkscape, '--without-gui',
|
subprocess.call(
|
||||||
'--file', 'tmp-%s.svg' % outname,
|
[
|
||||||
'--export-area-page',
|
inkscape,
|
||||||
'--export-png', os.path.join(path_out, '%s-on.png' % outname),
|
'--without-gui',
|
||||||
'--export-width', '128'])
|
'--file',
|
||||||
|
'tmp-%s.svg' % outname,
|
||||||
|
'--export-area-page',
|
||||||
|
'--export-png',
|
||||||
|
os.path.join(path_out, '%s-on.png' % outname),
|
||||||
|
'--export-width',
|
||||||
|
'128',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
|
@ -27,22 +27,22 @@ import tempfile
|
||||||
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
inkscape = os.path.abspath(os.path.join(os.path.dirname(__file__), 'inkscape_wrapper.py'))
|
||||||
|
|
||||||
names = {
|
names = {
|
||||||
'12': 'profile',
|
'12': 'profile',
|
||||||
'13': 'documents',
|
'13': 'documents',
|
||||||
'14': 'family',
|
'14': 'family',
|
||||||
'15': 'requests',
|
'15': 'requests',
|
||||||
'16': 'links',
|
'16': 'links',
|
||||||
'17': 'billings',
|
'17': 'billings',
|
||||||
}
|
}
|
||||||
|
|
||||||
filenames = [
|
filenames = [
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_12.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_12.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_13.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_13.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_14.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_14.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_15.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_15.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_16.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_16.svg',
|
||||||
'EO_CONNECTVILLE_PUBLIK_PICTO_17.svg',
|
'EO_CONNECTVILLE_PUBLIK_PICTO_17.svg',
|
||||||
]
|
]
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('path', help='out path')
|
parser.add_argument('path', help='out path')
|
||||||
|
@ -100,10 +100,15 @@ for filename in filenames:
|
||||||
with tempfile.NamedTemporaryFile(suffix='.svg') as tmpfile:
|
with tempfile.NamedTemporaryFile(suffix='.svg') as tmpfile:
|
||||||
tree.write(tmpfile.name)
|
tree.write(tmpfile.name)
|
||||||
tmpfile.flush()
|
tmpfile.flush()
|
||||||
cmd = [inkscape, '--without-gui',
|
cmd = [
|
||||||
'--file', tmpfile.name,
|
inkscape,
|
||||||
|
'--without-gui',
|
||||||
|
'--file',
|
||||||
|
tmpfile.name,
|
||||||
'--export-area-drawing',
|
'--export-area-drawing',
|
||||||
'--export-png', out_filepath]
|
'--export-png',
|
||||||
|
out_filepath,
|
||||||
|
]
|
||||||
if variant_width:
|
if variant_width:
|
||||||
cmd.extend(['--export-width', variant_width])
|
cmd.extend(['--export-width', variant_width])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -35,11 +35,11 @@ for element in ('title', 'div[@id="arianeUserTools"]'):
|
||||||
# rename "contenu" container to put content into it
|
# rename "contenu" container to put content into it
|
||||||
for content in root.xpath('//div[@id="contenu"]'):
|
for content in root.xpath('//div[@id="contenu"]'):
|
||||||
content.clear()
|
content.clear()
|
||||||
content.attrib['id'] ='content'
|
content.attrib['id'] = 'content'
|
||||||
|
|
||||||
for content in root.xpath('//a[@id="eosm-btn"]'):
|
for content in root.xpath('//a[@id="eosm-btn"]'):
|
||||||
content.clear()
|
content.clear()
|
||||||
content.attrib['id'] ='publik-mobile-menu'
|
content.attrib['id'] = 'publik-mobile-menu'
|
||||||
|
|
||||||
content = etree.tostring(root, method='html', pretty_print=True)
|
content = etree.tostring(root, method='html', pretty_print=True)
|
||||||
|
|
||||||
|
@ -51,27 +51,32 @@ content = re.sub('<script src=.*jquery.min.js.*', '', content)
|
||||||
|
|
||||||
content = content.replace('<script>document.body.className="withJS"</script>', '')
|
content = content.replace('<script>document.body.className="withJS"</script>', '')
|
||||||
|
|
||||||
content = content.replace('<body',
|
content = content.replace('<body', r'<body {% block bodyargs %}{% endblock %} ')
|
||||||
r'<body {% block bodyargs %}{% endblock %} ')
|
|
||||||
|
|
||||||
content = content.replace('</head>', '<title>{% block global_title %}{% endblock %}</title>\n</head>')
|
content = content.replace('</head>', '<title>{% block global_title %}{% endblock %}</title>\n</head>')
|
||||||
|
|
||||||
content = content.replace('<head>', '<head>{% block head %}{% endblock %}')
|
content = content.replace('<head>', '<head>{% block head %}{% endblock %}')
|
||||||
|
|
||||||
content = content.replace('<div id="content">', '''
|
content = content.replace(
|
||||||
|
'<div id="content">',
|
||||||
|
'''
|
||||||
{% if include_top_links != False %}<div id="toplinks">{% block user-info %}{% endblock %}</div>{% endif %}
|
{% if include_top_links != False %}<div id="toplinks">{% block user-info %}{% endblock %}</div>{% endif %}
|
||||||
{% block nav %}{% endblock %}
|
{% block nav %}{% endblock %}
|
||||||
{% block grenoble-content %}
|
{% block grenoble-content %}
|
||||||
{% block messages %}
|
{% block messages %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endblock %}''')
|
{% endblock %}''',
|
||||||
|
)
|
||||||
|
|
||||||
content = content.replace('</body>', '''
|
content = content.replace(
|
||||||
|
'</body>',
|
||||||
|
'''
|
||||||
{% block tracking %}
|
{% block tracking %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body-bottom %}
|
{% block body-bottom %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
''')
|
''',
|
||||||
|
)
|
||||||
|
|
||||||
open('base-theme.html', 'w').write(content)
|
open('base-theme.html', 'w').write(content)
|
||||||
|
|
|
@ -47,24 +47,27 @@ content = content.replace(FILENAME, '')
|
||||||
content = re.sub('<script( type=.*)? src=.*jquery.min.js.*', '', content)
|
content = re.sub('<script( type=.*)? src=.*jquery.min.js.*', '', content)
|
||||||
content = re.sub('<script( type=.*)? src=.*formCtrl.*.js.*', '', content)
|
content = re.sub('<script( type=.*)? src=.*formCtrl.*.js.*', '', content)
|
||||||
|
|
||||||
content = content.replace('<body',
|
content = content.replace('<body', r'<body {% block bodyargs %}{% endblock %} ')
|
||||||
r'<body {% block bodyargs %}{% endblock %} ')
|
|
||||||
|
|
||||||
content = content.replace('</head>', '<title>{% block global_title %}{% endblock %}</title>\n</head>')
|
content = content.replace('</head>', '<title>{% block global_title %}{% endblock %}</title>\n</head>')
|
||||||
|
|
||||||
content = content.replace('<head>', '<head>{% block head %}{% endblock %}')
|
content = content.replace('<head>', '<head>{% block head %}{% endblock %}')
|
||||||
|
|
||||||
content = content.replace('<main id="corps">', '''<main id="corps">
|
content = content.replace(
|
||||||
|
'<main id="corps">',
|
||||||
|
'''<main id="corps">
|
||||||
{% block nav %}{% endblock %}
|
{% block nav %}{% endblock %}
|
||||||
{% block messages %}{% endblock %}
|
{% block messages %}{% endblock %}
|
||||||
{% block local-content-wrapper %}
|
{% block local-content-wrapper %}
|
||||||
{% endblock %}''')
|
{% endblock %}''',
|
||||||
|
)
|
||||||
|
|
||||||
content = content.replace('</body>', '{% block local-body-bottom %}{% endblock %}</body>')
|
content = content.replace('</body>', '{% block local-body-bottom %}{% endblock %}</body>')
|
||||||
|
|
||||||
content = content.replace("SERVER_ROOT = '/'", 'SERVER_ROOT="//www.hautes-alpes.fr/"')
|
content = content.replace("SERVER_ROOT = '/'", 'SERVER_ROOT="//www.hautes-alpes.fr/"')
|
||||||
|
|
||||||
content = content.replace('<div id="toolbarTraduction">',
|
content = content.replace(
|
||||||
'<div id="toolbarTraduction">{% block user-info %}{% endblock %}')
|
'<div id="toolbarTraduction">', '<div id="toolbarTraduction">{% block user-info %}{% endblock %}'
|
||||||
|
)
|
||||||
|
|
||||||
open(os.path.join('.', 'base-theme.html'), 'w').write(content)
|
open(os.path.join('.', 'base-theme.html'), 'w').write(content)
|
||||||
|
|
|
@ -46,10 +46,14 @@ head_content = etree.tostring(root, method='html')
|
||||||
|
|
||||||
# remove closing <html> because it will be closed later
|
# remove closing <html> because it will be closed later
|
||||||
head_content = head_content.replace('</html>', '')
|
head_content = head_content.replace('</html>', '')
|
||||||
head_content = head_content.replace('</head>', external_js + '''
|
head_content = head_content.replace(
|
||||||
|
'</head>',
|
||||||
|
external_js
|
||||||
|
+ '''
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
<title>{% block global_title %}{% endblock %}</title>
|
<title>{% block global_title %}{% endblock %}</title>
|
||||||
</head>''')
|
</head>''',
|
||||||
|
)
|
||||||
|
|
||||||
subprocess.call(['wget', '--quiet', '-O', HEADER_FILENAME, '--convert-links', HEADER_URL])
|
subprocess.call(['wget', '--quiet', '-O', HEADER_FILENAME, '--convert-links', HEADER_URL])
|
||||||
header_content = open(HEADER_FILENAME).read().strip()
|
header_content = open(HEADER_FILENAME).read().strip()
|
||||||
|
@ -86,7 +90,18 @@ publik_footer = '''<div id="footer-wrapper">
|
||||||
</div>
|
</div>
|
||||||
</div>'''
|
</div>'''
|
||||||
|
|
||||||
content = '\n'.join([head_content, '<body {% block bodyargs %}{% endblock %}>', header_content,
|
content = '\n'.join(
|
||||||
banner_content, publik_content, publik_footer, footer_content,
|
[
|
||||||
'{% block tracking %}{% endblock %}', '</body>', '</html>'])
|
head_content,
|
||||||
|
'<body {% block bodyargs %}{% endblock %}>',
|
||||||
|
header_content,
|
||||||
|
banner_content,
|
||||||
|
publik_content,
|
||||||
|
publik_footer,
|
||||||
|
footer_content,
|
||||||
|
'{% block tracking %}{% endblock %}',
|
||||||
|
'</body>',
|
||||||
|
'</html>',
|
||||||
|
]
|
||||||
|
)
|
||||||
open('base-theme.html', 'w').write(content)
|
open('base-theme.html', 'w').write(content)
|
||||||
|
|
Loading…
Reference in New Issue