|
@@ -18,29 +18,36 @@ |
|
|
|
|
|
MINIMUM_VERSION_SUPPORTED = 6 |
|
|
MAXIMUM_VERSION_SUPPORTED = 7 |
|
|
ALL_VERSIONS = list(range(MINIMUM_VERSION_SUPPORTED, MAXIMUM_VERSION_SUPPORTED + 1)) |
|
|
ALL_VERSIONS_SUPPORTED = list(range(MINIMUM_VERSION_SUPPORTED, MAXIMUM_VERSION_SUPPORTED + 1)) |
|
|
|
|
|
MINIMUM_VERSION_DISPLAYED = 7 |
|
|
MAXIMUM_VERSION_DISPLAYED = 7 |
|
|
ALL_VERSIONS_DISPLAYED = list(range(MINIMUM_VERSION_DISPLAYED, MAXIMUM_VERSION_DISPLAYED + 1)) |
|
|
|
|
|
GLOB = "v{0}/*".format(MAXIMUM_VERSION_SUPPORTED) |
|
|
DIR = "v{0}".format(MAXIMUM_VERSION_SUPPORTED) |
|
|
|
|
|
def error(msg): |
|
|
print(colorama.Fore.RED + "ERROR:" + msg) |
|
|
|
|
|
def theme_list(): |
|
|
return sorted(['base', 'base-jinja', 'bootstrap', 'bootstrap-jinja', 'bootstrap3', 'bootstrap3-jinja'] + [theme.split('/')[-1] for theme in glob.glob("v{0}/*".format(MAXIMUM_VERSION_SUPPORTED))]) |
|
|
return sorted(['base', 'base-jinja', 'bootstrap', 'bootstrap-jinja', 'bootstrap3', 'bootstrap3-jinja'] + [theme.split('/')[-1] for theme in glob.glob(GLOB)]) |
|
|
|
|
|
def build_site(): |
|
|
data = {} |
|
|
for theme in theme_list(): |
|
|
data[theme] = get_data(theme) |
|
|
|
|
|
data['__meta__'] = {'allver': ALL_VERSIONS} |
|
|
data['__meta__'] = {'allver': ALL_VERSIONS_DISPLAYED} |
|
|
with open(os.path.join('output', 'theme_data.js'), 'wb+') as outf: |
|
|
outf.write("var data = " + json.dumps(data, indent=4, ensure_ascii=True, sort_keys=True)) |
|
|
|
|
|
def get_data(theme): |
|
|
data = {} |
|
|
data['chain'] = utils.get_theme_chain(theme, 'v7') |
|
|
data['chain'] = utils.get_theme_chain(theme, DIR) |
|
|
data['name'] = theme |
|
|
readme = utils.get_asset_path('README.md', data['chain'], _themes_dir='v7') |
|
|
conf_sample = utils.get_asset_path('conf.py.sample', data['chain'], _themes_dir='v7') |
|
|
readme = utils.get_asset_path('README.md', data['chain'], _themes_dir=DIR) |
|
|
conf_sample = utils.get_asset_path('conf.py.sample', data['chain'], _themes_dir=DIR) |
|
|
if readme: |
|
|
data['readme'] = codecs.open(readme, 'r', 'utf8').read() |
|
|
else: |
|
@@ -58,11 +65,11 @@ def get_data(theme): |
|
|
'bootstrap3-jinja' in data['chain'] or |
|
|
'bootstrap3' in data['chain']) and \ |
|
|
'bootstrap3-gradients' not in data['chain'] |
|
|
data['engine'] = utils.get_template_engine(data['chain'], 'v7') |
|
|
data['engine'] = utils.get_template_engine(data['chain'], DIR) |
|
|
data['chain'] = data['chain'][::-1] |
|
|
|
|
|
data['allver'] = [] |
|
|
for v in ALL_VERSIONS: |
|
|
for v in ALL_VERSIONS_SUPPORTED: |
|
|
if glob.glob('v{0}/*'.format(v)): |
|
|
data['allver'].append(v) |
|
|
|
|
|