diff options
Diffstat (limited to 'nikola/plugins/task_create_bundles.py')
| -rw-r--r-- | nikola/plugins/task_create_bundles.py | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/nikola/plugins/task_create_bundles.py b/nikola/plugins/task_create_bundles.py index ad670e1..84ac0ab 100644 --- a/nikola/plugins/task_create_bundles.py +++ b/nikola/plugins/task_create_bundles.py @@ -22,6 +22,8 @@ # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +from __future__ import unicode_literals + import os try: @@ -53,6 +55,7 @@ class BuildBundles(LateTask): 'theme_bundles': get_theme_bundles(self.site.THEMES), 'themes': self.site.THEMES, 'files_folders': self.site.config['FILES_FOLDERS'], + 'code_color_scheme': self.site.config['CODE_COLOR_SCHEME'], } def build_bundle(output, inputs): @@ -76,7 +79,7 @@ class BuildBundles(LateTask): for name, files in kw['theme_bundles'].items(): output_path = os.path.join(kw['output_folder'], name) dname = os.path.dirname(name) - file_dep = [get_asset_path( + file_dep = [utils.get_asset_path( os.path.join(dname, fname), kw['themes'], kw['files_folders']) for fname in files @@ -101,47 +104,6 @@ class BuildBundles(LateTask): } -def get_asset_path(path, themes, files_folders={'files': ''}): - """Checks which theme provides the path with the given asset, - and returns the "real" path to the asset, relative to the - current directory. - - If the asset is not provided by a theme, then it will be checked for - in the FILES_FOLDERS - - >>> get_asset_path('assets/css/rst.css', ['site', 'default']) - 'nikola/data/themes/default/assets/css/rst.css' - - >>> get_asset_path('assets/css/theme.css', ['site', 'default']) - 'nikola/data/themes/site/assets/css/theme.css' - - >>> get_asset_path('nikola.py', ['site', 'default'], {'nikola': ''}) - 'nikola/nikola.py' - - >>> get_asset_path('nikola/nikola.py', ['site', 'default'], - ... {'nikola':'nikola'}) - 'nikola/nikola.py' - - """ - for theme_name in themes: - candidate = os.path.join( - utils.get_theme_path(theme_name), - path - ) - if os.path.isfile(candidate): - return os.path.relpath(candidate, os.getcwd()) - for src, rel_dst in files_folders.items(): - candidate = os.path.join( - src, - os.path.relpath(path, rel_dst) - ) - if os.path.isfile(candidate): - return os.path.relpath(candidate, os.getcwd()) - - # whatever! - return None - - def get_theme_bundles(themes): """Given a theme chain, return the bundle definitions.""" bundles = {} |
