Mercurial > piecrust2
comparison piecrust/app.py @ 521:39175c48a4ae
config: Make sure `site/auto_formats` has at least `html`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 28 Jul 2015 21:23:11 -0700 |
parents | aae241804096 |
children | 624559e72d3b |
comparison
equal
deleted
inserted
replaced
520:bab91fcef741 | 521:39175c48a4ae |
---|---|
148 | 148 |
149 # Cache auto-format regexes. | 149 # Cache auto-format regexes. |
150 if not isinstance(sitec['auto_formats'], dict): | 150 if not isinstance(sitec['auto_formats'], dict): |
151 raise ConfigurationError("The 'site/auto_formats' setting must be " | 151 raise ConfigurationError("The 'site/auto_formats' setting must be " |
152 "a dictionary.") | 152 "a dictionary.") |
153 html_auto_format = sitec['auto_formats'] | 153 # Check that `.html` is in there. |
154 if not html_auto_format: | 154 sitec['auto_formats'].setdefault('html', sitec['default_format']) |
155 sitec['auto_formats']['html'] = sitec['default_format'] | |
156 cachec['auto_formats_re'] = r"\.(%s)$" % ( | 155 cachec['auto_formats_re'] = r"\.(%s)$" % ( |
157 '|'.join( | 156 '|'.join( |
158 [re.escape(i) for i in | 157 [re.escape(i) for i in |
159 list(sitec['auto_formats'].keys())])) | 158 list(sitec['auto_formats'].keys())])) |
160 if sitec['default_auto_format'] not in sitec['auto_formats']: | 159 if sitec['default_auto_format'] not in sitec['auto_formats']: |