Skip to content
Browse files
Create new meta files in nikola theme -n
Signed-off-by: Chris Warrick <>
  • Loading branch information
Kwpolska committed May 14, 2017
1 parent 19891cc commit 2ed19882d39e55e6607e10801c8d99e66758925b
Showing 1 changed file with 12 additions and 9 deletions.
@@ -32,6 +32,7 @@
import shutil
import time
import requests
import configparser

import pygments
from pygments.lexers import PythonLexer
@@ -326,9 +327,7 @@ def new_theme(self, name, engine, parent):"Created directory {0}".format(base))

# Check if engine and parent match
engine_file = utils.get_asset_path('engine', utils.get_theme_chain(parent,
with, 'r', encoding='utf-8') as fh:
parent_engine =
parent_engine = utils.get_template_engine(utils.get_theme_chain(parent,

if parent_engine != engine:
LOGGER.error("Cannot use engine {0} because parent theme '{1}' uses {2}".format(engine, parent, parent_engine))
@@ -342,12 +341,16 @@ def new_theme(self, name, engine, parent):
LOGGER.error("Theme already exists")
return 2

with, 'parent'), 'w', encoding='utf-8') as fh:
fh.write(parent + '\n')"Created file {0}".format(os.path.join(themedir, 'parent')))
with, 'engine'), 'w', encoding='utf-8') as fh:
fh.write(engine + '\n')"Created file {0}".format(os.path.join(themedir, 'engine')))
cp = configparser.ConfigParser()
cp['Theme'] = {
'engine': engine,
'parent': parent

theme_meta_path = os.path.join(themedir, name + '.theme')
with, 'w', encoding='utf-8') as fh:
cp.write(fh)"Created file {0}".format(theme_meta_path))"Theme {0} created successfully.".format(themedir))
LOGGER.notice('Remember to set THEME="{0}" in to use this theme.'.format(name))

0 comments on commit 2ed1988

Please sign in to comment.