Skip to content
Permalink
Browse files

Remove Colorbox leftovers

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 17, 2018
1 parent 10b4a15 commit bbef176fc126442c7bbffd8d246fb7aa4976117d
@@ -7,7 +7,7 @@ Features
* Support for Commento comment system (Issue #2773)
* New PRESERVE_ICC_PROFILES option to control whether ICC profiles are
preserved when copying images.
* Use baguetteJS in bootstrap theme (part of Issue #2777)
* Use baguetteBox in Bootstrap theme (part of Issue #2777)
* New default-config command to generate a clean configuration.
* New ``thumbnail`` shortcode similar to the reStructuredText
``thumbnail`` directive (via Issue #2809)
@@ -68,6 +68,7 @@ Bugfixes
Removed features
----------------

* Removed Colorbox (Issue #2777)
* Removed ``googleplus`` comments (no longer supported) (Issue #635)
* Removed the slides directive for docutils, it will now be a separate plugin.
* Dropped Python 2 and Python 3.3 support (oldest supported version is 3.4)
@@ -46,7 +46,6 @@ Name Type Descript
``blog_title`` TranslatableSetting<str> ``BLOG_TITLE`` setting
``blog_url`` str ``SITE_URL`` setting
``body_end`` TranslatableSetting<str> ``BODY_END`` setting
``colorbox_locales`` defaultdict<str, str> dictionary of available Colorbox locales
``colorize_str_from_base_color`` function ``utils.colorize_str_from_base_color`` function
``color_hsl_adjust_hex`` function ``utils.color_hsl_adjust_hex`` function
``comment_system_id`` str ``COMMENT_SYSTEM_ID`` setting
@@ -36,8 +36,8 @@ assets
references to them. The default subdirectories are ``css``, ``js``, ``xml``
and ``fonts`` (Bootstrap).

The included themes use `Bootstrap <https://getbootstrap.com/>`_, `Colorbox
<http://www.jacklmoore.com/colorbox>`_, `Flowr.js
The included themes use `Bootstrap <https://getbootstrap.com/>`_,
`baguetteBox <https://feimosi.github.io/baguetteBox.js/>`_, `Flowr.js
<https://github.com/kalyan02/flowr-js>`_ and `Moment.js
<https://momentjs.com/>`_, so they are in assets, along with CSS files for
syntax highlighting, reStructuredText and Jupyter, as well as a minified
@@ -78,7 +78,7 @@ bundles

.. code:: text

assets/css/all.css=bootstrap.css,rst_base.css,nikola_rst.css,code.css,colorbox.css,custom.css
assets/css/all.css=bootstrap.min.css,rst_base.css,nikola_rst.css,code.css,baguetteBox.min.css,theme.css,custom.css

This creates a file called "assets/css/all.css" in your output that is the
combination of all the other file paths, relative to the output file.
@@ -158,9 +158,6 @@ The following keys are currently supported:
defaults to False)
* ``ignored_assets`` — comma-separated list of assets to ignore (relative to
the ``assets/`` directory, eg. ``css/theme.css``)
* ``ignore_colorbox_i18n`` — prevent copying Colorbox locales. Accepted
values: ``all`` (all ignored), ``unused`` (used locales copied),
``none`` (all copied)

Templates
---------
@@ -211,45 +211,6 @@
# This dict is currently empty.
},
'RTL_LANGUAGES': ('ar', 'fa', 'he', 'ur'),
'COLORBOX_LOCALES': defaultdict(
str,
ar='ar',
bg='bg',
ca='ca',
cs='cs',
cz='cs',
da='da',
de='de',
en='',
es='es',
et='et',
fa='fa',
fi='fi',
fr='fr',
he='he',
hr='hr',
hu='hu',
id='id',
it='it',
ja='ja',
ko='kr', # kr is South Korea, ko is the Korean language
lt='lt',
nb='no',
nl='nl',
pl='pl',
pt='pt-BR', # hope nobody will mind
pt_br='pt-BR',
ru='ru',
sk='sk',
sl='si', # country code is si, language code is sl, colorbox is wrong
sr='sr', # warning: this is Serbian in Latin alphabet
sr_latin='sr',
sv='sv',
tr='tr',
uk='uk',
zh_cn='zh-CN',
zh_tw='zh-TW'
),
'MOMENTJS_LOCALES': defaultdict(
str,
ar='ar',
@@ -1159,7 +1120,6 @@ def _set_global_context_from_config(self):
self._GLOBAL_CONTEXT['extra_head_data'] = self.config.get('EXTRA_HEAD_DATA')
self._GLOBAL_CONTEXT['date_fanciness'] = self.config.get('DATE_FANCINESS')
self._GLOBAL_CONTEXT['js_date_format'] = self.config.get('JS_DATE_FORMAT')
self._GLOBAL_CONTEXT['colorbox_locales'] = LEGAL_VALUES['COLORBOX_LOCALES']
self._GLOBAL_CONTEXT['momentjs_locales'] = LEGAL_VALUES['MOMENTJS_LOCALES']
self._GLOBAL_CONTEXT['hidden_tags'] = self.config.get('HIDDEN_TAGS')
self._GLOBAL_CONTEXT['hidden_categories'] = self.config.get('HIDDEN_CATEGORIES')
@@ -69,7 +69,7 @@ def run(self):
"""Run the thumbnail directive."""
uri = directives.uri(self.arguments[0])
if uri.endswith('.svg'):
# the ? at the end makes docutil output an <img> instead of an object for the svg, which colorbox requires
# the ? at the end makes docutil output an <img> instead of an object for the svg, which lightboxes may require
self.arguments[0] = '.thumbnail'.join(os.path.splitext(uri)) + '?'
else:
self.arguments[0] = '.thumbnail'.join(os.path.splitext(uri))
@@ -39,7 +39,7 @@ class ThumbnailShortcode(ShortcodePlugin):
def handler(self, uri, alt=None, align=None, linktitle=None, title=None, imgclass=None, figclass=None, site=None, data=None, lang=None, post=None):
"""Create HTML for thumbnail."""
if uri.endswith('.svg'):
# the ? at the end makes docutil output an <img> instead of an object for the svg, which colorbox requires
# the ? at the end makes docutil output an <img> instead of an object for the svg, which lightboxes may require
src = '.thumbnail'.join(os.path.splitext(uri)) + '?'
else:
src = '.thumbnail'.join(os.path.splitext(uri))
@@ -34,9 +34,6 @@
from nikola import utils
from nikola.nikola import LEGAL_VALUES

_COLORBOX_PREFIX = 'js|colorbox-i18n|jquery.colorbox-'.replace('|', os.sep)
_COLORBOX_SLICE = slice(len(_COLORBOX_PREFIX), -3)


class CopyAssets(Task):
"""Copy theme assets into output."""
@@ -71,37 +68,16 @@ def gen_tasks(self):
theme_ini = utils.parse_theme_meta(main_theme)
if theme_ini:
ignored_assets = theme_ini.get("Nikola", "ignored_assets", fallback='').split(',')
ignore_colorbox_i18n = theme_ini.get("Nikola", "ignore_colorbox_i18n", fallback="unused")
else:
ignored_assets = []
ignore_colorbox_i18n = "unused"

if ignore_colorbox_i18n == "unused":
# Check what colorbox languages we need so we can ignore the rest
needed_colorbox_languages = [LEGAL_VALUES['COLORBOX_LOCALES'][i] for i in kw['translations']]
needed_colorbox_languages = [i for i in needed_colorbox_languages if i] # remove '' for en
# ignored_filenames is passed to copy_tree to avoid creating
# directories. Since ignored_assets are full paths, and copy_tree
# works on single filenames, we can’t use that here.
if not needed_colorbox_languages:
ignored_filenames = set(["colorbox-i18n"])
else:
ignored_filenames = set()

for theme_name in kw['themes']:
src = os.path.join(utils.get_theme_path(theme_name), 'assets')
dst = os.path.join(kw['output_folder'], 'assets')
for task in utils.copy_tree(src, dst, ignored_filenames=ignored_filenames):
for task in utils.copy_tree(src, dst):
asset_name = os.path.relpath(task['name'], dst)
if task['name'] in tasks or asset_name in ignored_assets:
continue
elif asset_name.startswith(_COLORBOX_PREFIX):
if ignore_colorbox_i18n == "all" or ignore_colorbox_i18n is True:
continue

colorbox_lang = asset_name[_COLORBOX_SLICE]
if ignore_colorbox_i18n == "unused" and colorbox_lang not in needed_colorbox_languages:
continue
tasks[task['name']] = task
task['uptodate'] = [utils.config_changed(kw, 'nikola.plugins.task.copy_assets')]
task['basename'] = self.name
@@ -1,11 +1,9 @@
#!/usr/bin/env python3
"""A matrix! Of languages!"""
import nikola.nikola
import os.path
import glob

keys = ['_WINDOWS_LOCALE_GUESSES', 'COLORBOX_LOCALES', 'MOMENTJS_LOCALES', 'PYPHEN_LOCALES', 'DOCUTILS_LOCALES']
keys_short = ['language', 'windows', 'cbox', 'moment', 'pyphen', 'docutils']
keys = ['_WINDOWS_LOCALE_GUESSES', 'MOMENTJS_LOCALES', 'PYPHEN_LOCALES', 'DOCUTILS_LOCALES']
keys_short = ['language', 'windows', 'moment', 'pyphen', 'docutils']
print('\t'.join(keys_short))

for tr in nikola.nikola.LEGAL_VALUES['TRANSLATIONS']:

0 comments on commit bbef176

Please sign in to comment.
You can’t perform that action at this time.