Skip to content
Permalink
Browse files
Merge branch 'master' into logging
  • Loading branch information
Kwpolska committed Jul 10, 2015
2 parents 0c2c790 + 77a5b46 commit a2cd345e49d665641be4f4167a15d2835e3af56a
Show file tree
Hide file tree
Showing 69 changed files with 502 additions and 82 deletions.
@@ -5,13 +5,18 @@ Features
--------

* Remove logging handlers (Issue #1797)
* Add ``-d``, ``--detach`` option to ``nikola serve`` (Issue #1871)
* Use provided teaser format (``*_READ_MORE_LINK``) with custom teaser text
(Issue #1879)
* Delete old ``bootstrap`` theme (use ``bootstrap3`` instead)
* Screen reader-friendly navbar collapses and dropdowns (Issue #1863)
* Modern reST stylesheets, based in part on Bootstrap 3 (Issue #1150)

Bugfixes
--------

* Fix links in sample post (Issue #1874)
* Don't use deprecated Yapsy methods (Isue #1868)
* Surpress wincing when auto is aborted during rebuilding
* Show tags only from the current language on tag listing pages (Issue #1856)
* Remove gap between line numbers and code (Issue #1859)
@@ -65,10 +65,10 @@ Assuming you have pip installed::

For optional features::

pip install Nikola[extras]
pip install "Nikola[extras]"

For tests (see tests/README.rst for more details)::

pip install Nikola[extras,tests]
pip install "Nikola[extras,tests]"

For more information, see https://getnikola.com/
@@ -94,7 +94,7 @@ The most basic commands needed to get by are:
deploy the site using the ``DEPLOY_COMMANDS`` setting
``nikola github_deploy```
deploy the site to GitHub Pages
``nikola serve [-p PORT] [-a ADDRESS] [-b|--browser] [-6|--ipv6]``
``nikola serve [-p PORT] [-a ADDRESS] [-d|--detach] [-b|--browser] [-6|--ipv6]``
start development web server
``nikola auto [-p PORT] [-a ADDRESS] [-b|--browser] [-6|--ipv6]``
start development web server with automated rebuilds and reloads
@@ -36,7 +36,7 @@ Edit the post:
Build the site:
``nikola build``

Start the test server and open a browser (http://127.0.0.1:8000/):
Start the test server and open a browser:
``nikola serve -b``


@@ -201,14 +201,14 @@ of how to "get" something for your specific operating system are left to you.

The short version is::

pip install nikola
pip install Nikola

Note that you need Python v2.7 or newer OR v3.3 or newer.

Some features require **extra dependencies**. You can install them all in bulk
by doing::

pip install nikola[extras]
pip install "Nikola[extras]"

Alternatively, you can install those packages one-by-one, when required (Nikola
will tell you what packages are needed)
@@ -322,10 +322,15 @@ def run(self, cmd_args):
if args[0] not in sub_cmds.keys():
LOGGER.error("Unknown command {0}".format(args[0]))
sugg = defaultdict(list)
for c in sub_cmds.keys():
d = lev(c, args[0])
sub_filtered = (i for i in sub_cmds.keys() if i != 'run')
for c in sub_filtered:
d = levenshtein(c, args[0])
sugg[d].append(c)
LOGGER.info('Did you mean "{}"?', '" or "'.join(sugg[min(sugg.keys())]))
best_sugg = sugg[min(sugg.keys())]
if len(best_sugg) == 1:
LOGGER.info('Did you mean "{}"?'.format(best_sugg[0]))
else:
LOGGER.info('Did you mean "{}" or "{}"?'.format('", "'.join(best_sugg[:-1]), best_sugg[-1]))
return 3
if sub_cmds[args[0]] is not Help and not isinstance(sub_cmds[args[0]], Command): # Is a doit command
if not self.nikola.configured:
@@ -339,12 +344,32 @@ def print_version():
print("Nikola v" + __version__)


# Stolen from http://stackoverflow.com/questions/4173579/implementing-levenshtein-distance-in-python
def lev(a, b):
if not a or not b:
return max(len(a), len(b))
return min(lev(a[1:], b[1:]) + (a[0] != b[0]), lev(a[1:], b) + 1, lev(a, b[1:]) + 1)

def levenshtein(s1, s2):
"""Calculate the Levenshtein distance of two strings.
Implementation from Wikibooks:
https://en.wikibooks.org/w/index.php?title=Algorithm_Implementation/Strings/Levenshtein_distance&oldid=2974448#Python
Copyright © The Wikibooks contributors (CC BY-SA/fair use citation); edited to match coding style and add an exception.
"""
if len(s1) < len(s2):
return levenshtein(s2, s1)

# len(s1) >= len(s2)
if len(s2) == 0:
return len(s1)

previous_row = range(len(s2) + 1)
for i, c1 in enumerate(s1):
current_row = [i + 1]
for j, c2 in enumerate(s2):
# j+1 instead of j since previous_row and current_row are one character longer than s2
insertions = previous_row[j + 1] + 1
deletions = current_row[j] + 1
substitutions = previous_row[j] + (c1 != c2)
current_row.append(min(insertions, deletions, substitutions))
previous_row = current_row

return previous_row[-1]

if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
@@ -21,7 +21,7 @@ import time
BLOG_AUTHOR = ${BLOG_AUTHOR} # (translatable)
BLOG_TITLE = ${BLOG_TITLE} # (translatable)
# This is the main URL for your site. It will be used
# in a prominent link
# in a prominent link. Don't forget the protocol (http/https)!
SITE_URL = ${SITE_URL}
# This is the URL where Nikola's output will be deployed.
# If not set, defaults to SITE_URL
@@ -229,7 +229,7 @@ WRITE_TAG_CLOUD = True
# "blogging": "Meta-blog posts about blogging about blogging.",
# "open source": "My contributions to my many, varied, ever-changing, and eternal libre software projects."
# },
#}
# }


# If you do not want to display a tag publicly, you can mark it as hidden.
@@ -272,7 +272,7 @@ HIDDEN_TAGS = ['mathjax']
# "blogging": "Meta-blog posts about blogging about blogging.",
# "open source": "My contributions to my many, varied, ever-changing, and eternal libre software projects."
# },
#}
# }

# If you do not want to display a category publicly, you can mark it as hidden.
# The category will not be displayed on the category list page.
@@ -655,8 +655,7 @@ COMMENT_SYSTEM_ID = ${COMMENT_SYSTEM_ID}
# (Uses the INDEX_FILE setting, so if that is, say, default.html,
# it will instead /foo/default.html => /foo)
# (Note: This was briefly STRIP_INDEX_HTML in v 5.4.3 and 5.4.4)
# Default = False
# STRIP_INDEXES = False
STRIP_INDEXES = ${STRIP_INDEXES}

# Should the sitemap list directories which only include other directories
# and no files.
@@ -821,7 +820,7 @@ MARKDOWN_EXTENSIONS = ['fenced_code', 'codehilite', 'extra']
# <input type="text" name="q" maxlength="255" results="0" placeholder="Search"/>
# </form>
# <!-- End of custom search -->
#""" % SITE_URL
# """ % SITE_URL

# Use content distribution networks for jQuery, twitter-bootstrap css and js,
# and html5shiv (for older versions of Internet Explorer)
@@ -2,18 +2,15 @@ This folder contains the source used to generate a static site using Nikola.

Installation and documentation at https://getnikola.com/

Configuration file for the site is `conf.py`.
Configuration file for the site is ``conf.py``.

To build the site::

nikola build

To see it::

nikola serve

And point your browser to http://localhost:8000/

nikola serve -b

To check all available commands::

@@ -17,11 +17,11 @@ and build a site using it. Congratulations!

Next steps:

* `Read the manual </stories/handbook.html>`__
* :doc:`Read the manual <handbook>`
* `Visit the Nikola website to learn more <https://getnikola.com>`__
* `See a demo photo gallery </galleries/demo/index.html>`__
* `See a demo listing </stories/listings-demo.html>`__
* `See a demo slideshow </stories/slides-demo.html>`__
* `See a demo of the Bootstrap theme </stories/bootstrap-demo.html>`__
* `See a demo photo gallery <link://gallery/demo>`__
* :doc:`See a demo listing <listings-demo>`
* :doc:`See a demo slideshow <slides-demo>`
* :doc:`See a demo of the Bootstrap theme <bootstrap-demo>`

Send feedback to info@getnikola.com!
@@ -320,6 +320,7 @@ pre.code, code {
*/

a[href^="#"]:after,
a[href^="data:"]:after,
a[href^="javascript:"]:after {
content: "";
}