Skip to content
Permalink
Browse files

merged master

  • Loading branch information
ralsina committed Sep 2, 2015
2 parents 3d1c4b8 + c38375a commit 04909cd8d15cd1b238b240af280f29b6c255056b
@@ -4,6 +4,7 @@ New in master
Features
--------

* New support for online CSS and JS minifying services (Issue #1999)
* Make <base> tag optional with USE_BASE_TAG flag (Issue #1985)
* Render author pages (Issue #1972)
* Atom feeds for tag lists (Issue #1686)
@@ -29,6 +30,7 @@ Bugfixes
--------

* Make nikola tabcompletion work outside sites (Issue #1983)
* Fix display of categories list in bootstrap theme (Issue #2002)
* If webassets is not installed, use unbundled assets (Issue #1992)
* Check links in Atom and sitemap files (Issue #1993)
* Link checker should check all absolute URLs to self (Issue #1991)
@@ -1350,6 +1350,11 @@ optipng
jpegoptim
Compress JPEG files using `jpegoptim <http://www.kokkonen.net/tjko/projects.html>`_

cssminify
Minify CSS using http://cssminifier.com/ (requires internet access)

jsminify
Minify JS using http://javascript-minifier.com/ (requires internet access)

You can apply filters to specific posts or pages by using the ``filters`` metadata field:

@@ -193,8 +193,8 @@ require whatever data you want.
Also, you can specify a custom template to be used by a post or page via the ``template`` metadata,
and custom templates can be added in the ``templates/`` folder of your site.

Customizing themes to user color preferece and section colors
-------------------------------------------------------------
Customizing themes to user color preference and section colors
--------------------------------------------------------------

The user’s preference for theme color is exposed in templates as
``theme_color`` set in the ``THEME_COLOR`` option.
@@ -9,7 +9,7 @@
% endif
% for text, full_name, path, link, indent_levels, indent_change_before, indent_change_after in cat_hierarchy:
% for i in range(indent_change_before):
<ul class="unstyled">
<ul class="list-inline">
% endfor
<li><a class="reference badge" href="${link}">${text}</a>
% if indent_change_after <= 0:
@@ -26,7 +26,6 @@

"""Utility functions to help run filters on files."""

from .utils import req_missing
from functools import wraps
import os
import io
@@ -39,6 +38,9 @@
import typogrify.filters as typo
except ImportError:
typo = None # NOQA
import requests

from .utils import req_missing, LOGGER


def apply_to_binary_file(f):
@@ -274,3 +276,29 @@ def php_template_injection(data):
return phpdata
else:
return data


@apply_to_text_file
def cssminify(data):
"""Minify CSS using http://cssminifier.com/."""
try:
url = 'http://cssminifier.com/raw'
_data = {'input': data}
response = requests.post(url, data=_data)
return response.text
except Exception as exc:
LOGGER.error("can't use cssminifier.com: {}", exc)
return data


@apply_to_text_file
def jsminify(data):
"""Minify JS using http://javascript-minifier.com/."""
try:
url = 'http://javascript-minifier.com/raw'
_data = {'input': data}
response = requests.post(url, data=_data)
return response.text
except Exception as exc:
LOGGER.error("can't use javascript-minifier.com: {}", exc)
return data
@@ -234,7 +234,11 @@ def analyze(self, fname, find_sources=False, check_remote=False):
target = l[2]
if target == "#":
continue
target, _ = urldefrag(target)
target = urldefrag(target)[0]

if any([urlparse(target).netloc.endswith(_) for _ in ['example.com', 'example.net', 'example.org']]):
self.logger.info("Not testing example address \"{0}\".".format(target))
continue

# absolute URL to root-relative
if target.startswith(base_url.geturl()):
@@ -344,6 +348,10 @@ def scan_links(self, find_sources=False, check_remote=False):
failure = False
# Maybe we should just examine all HTML files
output_folder = self.site.config['OUTPUT_FOLDER']

if urlparse(self.site.config['BASE_URL']).netloc == 'example.com':
self.logger.error("You've not changed the SITE_URL (or BASE_URL) setting from \"example.com\"!")

for fname in _call_nikola_list(self.site)[0]:
if fname.startswith(output_folder):
if '.html' == fname[-5:]:
@@ -3,7 +3,7 @@ Markdown>=2.4.0
Jinja2>=2.7.2
pyphen>=0.9.1
micawber>=0.3.0
pygal==2.0.5
pygal==2.0.6
typogrify>=2.0.4
phpserialize>=1.3
webassets>=0.10.1

0 comments on commit 04909cd

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