Skip to content
Permalink
Browse files

Merge branch 'master' into persistent-state

  • Loading branch information
ralsina committed Jan 25, 2016
2 parents f5aefdd + 9b441bd commit 27d24b68c0fd2c51840a646f09a416480b066f34
@@ -15,6 +15,9 @@ Features
Bugfixes
--------

* Honor ``MATHJAX_CONFIG``
* Display tags and archives in a unified format, with the date on the
left, instead of a misplaced dash in tags (Issue #2212)
* Decide is_mathjax based on current language tags (Issue #2205)
* Don't duplicate images in flowr when resizing page (Issue #2202)

@@ -0,0 +1 @@
{{ data }}
@@ -35,7 +35,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a></li>
{% endfor %}
</ul>
{% endif %}
@@ -28,9 +28,13 @@
</script>
{% else %}
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
{% if mathjax_config %}
{{ mathjax_config }}
{% else %}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
@@ -9,7 +9,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a> <time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a></li>
{% endfor %}
</ul>
{% else %}
@@ -94,9 +94,13 @@
</script>
{% else %}
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
{% if mathjax_config %}
{{ mathjax_config }}
{% else %}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
@@ -43,7 +43,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li>
{% endfor %}
</ul>
{% endif %}
@@ -120,7 +120,7 @@ body {
}
.metadata p:before,
.postpromonav .tags li:before,
.postlist .listdate:before {
.postlist .listdate:after {
content: " — ";
}
.postlist li {
@@ -35,7 +35,7 @@
%if posts:
<ul class="postlist">
% for post in posts:
<li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</a><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></li>
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time> <a href="${post.permalink()}" class="listtitle">${post.title()|h}</a></li>
% endfor
</ul>
%endif
@@ -28,9 +28,13 @@
</script>
%else:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
%endif
</%def>
@@ -9,7 +9,7 @@
%if posts:
<ul class="postlist">
% for post in posts:
<li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</a> <time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></li>
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time> <a href="${post.permalink()}" class="listtitle">${post.title()|h}</a></li>
% endfor
</ul>
%else:
@@ -94,9 +94,13 @@
</script>
%else:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
%endif
</%def>
@@ -43,7 +43,7 @@
%if posts:
<ul class="postlist">
% for post in posts:
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time><a href="${post.permalink()}" class="listtitle">${post.title()|h}<a></li>
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time> <a href="${post.permalink()}" class="listtitle">${post.title()|h}<a></li>
% endfor
</ul>
%endif

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -118,7 +118,7 @@ article.post-micro {
}

.metadata p:before,
.postlist .listdate:before {
.postlist .listdate:after {
content: " — ";
}

@@ -180,7 +180,7 @@
}
} //utils

// If the resposive var is set to true then listen for resize method
// If the responsive var is set to true then listen for resize method
// and prevent resizing from happening twice if responsive is set again during append phase!
if (settings.responsive && !$this.data('__responsive')) {
$(window).resize(function() {
@@ -211,7 +211,7 @@
var currentItem = 0;

// Store all the data
var allData = $this.data('data') || [];
var allData = [];
for (i = 0; i < data.length; i++) {
allData.push(data[i]);
}
@@ -118,7 +118,7 @@ article.post-micro {
}

.metadata p:before,
.postlist .listdate:before {
.postlist .listdate:after {
content: " — ";
}

@@ -142,54 +142,54 @@ def yui_compressor(infile):
raise Exception("yui-compressor is not installed.")
return False

return runinplace(r'{} --nomunge %1 -o %2'.format(yuicompressor), infile)
return runinplace('{} --nomunge %1 -o %2'.format(yuicompressor), infile)


def closure_compiler(infile):
"""Run closure-compiler on a file."""
return runinplace(r'closure-compiler --warning_level QUIET --js %1 --js_output_file %2', infile)
return runinplace('closure-compiler --warning_level QUIET --js %1 --js_output_file %2', infile)


def optipng(infile):
"""Run optipng on a file."""
return runinplace(r"optipng -preserve -o2 -quiet %1", infile)
return runinplace("optipng -preserve -o2 -quiet %1", infile)


def jpegoptim(infile):
"""Run jpegoptim on a file."""
return runinplace(r"jpegoptim -p --strip-all -q %1", infile)
return runinplace("jpegoptim -p --strip-all -q %1", infile)


def html_tidy_withconfig(infile):
def html_tidy_withconfig(infile, executable='tidy5'):
"""Run HTML Tidy with tidy5.conf as config file."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent -config tidy5.conf -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent -config tidy5.conf -modify %1", executable=executable)


def html_tidy_nowrap(infile):
def html_tidy_nowrap(infile, executable='tidy5'):
"""Run HTML Tidy without line wrapping."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1", executable=executable)


def html_tidy_wrap(infile):
def html_tidy_wrap(infile, executable='tidy5'):
"""Run HTML Tidy with line wrapping."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1", executable=executable)


def html_tidy_wrap_attr(infile):
def html_tidy_wrap_attr(infile, executable='tidy5'):
"""Run HTML tidy with line wrapping and attribute indentation."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes yes --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes yes --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1", executable=executable)


def html_tidy_mini(infile):
def html_tidy_mini(infile, executable='tidy5'):
"""Run HTML tidy with minimal settings."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no --drop-empty-elements no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no --drop-empty-elements no -modify %1", executable=executable)


def _html_tidy_runner(infile, options):
def _html_tidy_runner(infile, options, executable='tidy5'):
"""Run HTML Tidy."""
# Warnings (returncode 1) are not critical, and *everything* is a warning.
try:
status = runinplace(r"tidy5 " + options, infile)
status = runinplace(executable + " " + options, infile)
except subprocess.CalledProcessError as err:
status = 0 if err.returncode == 1 else err.returncode
return status
@@ -2207,7 +2207,7 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont

def __repr__(self):
"""Representation of a Nikola site."""
return '<Nikola Site: {0!r}>'.format(self.config['BLOG_TITLE']())
return '<Nikola Site: {0!r}>'.format(self.config['BLOG_TITLE'](self.config['DEFAULT_LANG']))


def sanitized_locales(locale_fallback, locale_default, locales, translations):
@@ -221,6 +221,18 @@ def prepare_config(config):
return p


def test_destination(destination, demo=False):
"""Check if the destination already exists, which can break demo site creation."""
# Issue #2214
if demo and os.path.exists(destination):
LOGGER.warning("The directory {0} already exists, and a new demo site cannot be initialized in an existing directory.".format(destination))
LOGGER.warning("Please remove the directory and try again, or use another directory.")
LOGGER.info("Hint: If you want to initialize a git repository in this directory, run `git init` in the directory after creating a Nikola site.")
return False
else:
return True


class CommandInit(Command):
"""Create a new site."""

@@ -277,7 +289,7 @@ def create_empty_site(cls, target):
makedirs(os.path.join(target, folder))

@staticmethod
def ask_questions(target):
def ask_questions(target, demo=False):
"""Ask some questions about Nikola."""
def urlhandler(default, toconf):
answer = ask('Site URL', 'https://example.com/')
@@ -442,7 +454,7 @@ def chandler(default, toconf):
print("If you do not want to answer and want to go with the defaults instead, simply restart with the `-q` parameter.")

for query, default, toconf, destination in questions:
if target and destination == '!target':
if target and destination == '!target' and test_destination(target, demo):
# Skip the destination question if we know it already
pass
else:
@@ -459,8 +471,9 @@ def chandler(default, toconf):
if toconf:
SAMPLE_CONF[destination] = answer
if destination == '!target':
while not answer:
print(' ERROR: you need to specify a target directory.\n')
while not answer or not test_destination(answer, demo):
if not answer:
print(' ERROR: you need to specify a target directory.\n')
answer = ask(query, default)
STORAGE['target'] = answer

@@ -476,7 +489,7 @@ def _execute(self, options={}, args=None):
except IndexError:
target = None
if not options.get('quiet'):
st = self.ask_questions(target=target)
st = self.ask_questions(target=target, demo=options.get('demo'))
try:
if not target:
target = st['target']
@@ -489,11 +502,13 @@ def _execute(self, options={}, args=None):
Options:
-q, --quiet Do not ask questions about config.
-d, --demo Create a site filled with example data.""")
return False
return 1
if not options.get('demo'):
self.create_empty_site(target)
LOGGER.info('Created empty site at {0}.'.format(target))
else:
if not test_destination(target, True):
return 2
self.copy_sample_site(target)
LOGGER.info("A new site with example data has been created at "
"{0}.".format(target))

0 comments on commit 27d24b6

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