Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into fix-2056
  • Loading branch information
ralsina committed Sep 15, 2015
2 parents cd7c7e5 + f7b6d48 commit b615124
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 32 deletions.
6 changes: 4 additions & 2 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Better Template / JS / CSS demo in sample site.
* New normalize_html filter
* Support UTF-8 paths and encoded links when the ``USE_SLUGIFY`` option
is disabled. (Issue #2037)
Expand All @@ -19,12 +20,13 @@ Features
Bugfixes
--------

* Generate language-specific section links (Issue #2069)
* Rebuild pages when user changes POST_SECTION_COLORS (Issue #2066)
* Look for bundle assets also in output/, allowing bundling of files
* Look for bundle assets also in output/, allowing bundling of files
created by plugins (Issue #1370)
* In listings, if lexer is not specified, use literal (Issue #2078)
* Remove bogus ambiguity on listing links (Issue #2080)
* Unix-slash caused conflict in windows (Issue #2079)
* Unix-slash caused conflict in Windows (Issue #2079)
* Locale is now threadsafe, avoid races in threaded builds (Issue #2071)
* Make typogrify filter work when applied from metadata (Issue #2064)
* Handle metadata in post files that start with a BOM (Issue #2059)
Expand Down
Binary file added nikola/data/samplesite/images/frontispiece.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified nikola/data/samplesite/images/illus_001.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 23 additions & 25 deletions nikola/data/samplesite/stories/dr-nikolas-vendetta.rst
@@ -1,23 +1,18 @@
A BID FOR FORTUNE OR; DR. NIKOLA'S VENDETTA
===========================================

By GUY BOOTHBY

Author of "Dr. Nikola," "The Beautiful White Devil," etc., etc.

PART I
======
.. title: A BID FOR FORTUNE OR; DR. NIKOLA'S VENDETTA
.. template: book.tmpl
.. hyphenate: yes
.. filters: filters.typogrify
.. class:: subtitle

By `GUY BOOTHBY <http://www.gutenberg.org/ebooks/author/3587>`__

PROLOGUE
--------

DR. NIKOLA
~~~~~~~~~~
Author of "Dr. Nikola," "The Beautiful White Devil," etc., etc.

.. figure:: /images/frontispiece.jpg
:class: bookfig

.. sidebar:: The Project Gutenberg EBook of A Bid for Fortune, by Guy Boothby
.. topic:: The Project Gutenberg EBook of A Bid for Fortune, by Guy Boothby

This eBook is for the use of anyone anywhere at no cost and with
almost no restrictions whatsoever. You may copy it, give it away or
Expand All @@ -28,7 +23,7 @@ DR. NIKOLA
Title: A Bid for Fortune
or Dr. Nikola's Vendetta

Author: Guy Boothby
Author: `Guy Boothby <http://www.gutenberg.org/ebooks/author/3587>`__

Release Date: May 29, 2007 [EBook #21640]

Expand All @@ -43,9 +38,19 @@ DR. NIKOLA
LONDON, MELBOURNE AND TORONTO
1918

.. figure:: /images/illus_001.jpg
:class: bookfig

PART I
======

PROLOGUE
--------

.. role:: smallcaps


The manager of the new Imperial Restaurant on the Thames Embankment went
:smallcaps:`The` manager of the new Imperial Restaurant on the Thames Embankment went
into his luxurious private office and shut the door. Having done so, he
first scratched his chin reflectively, and then took a letter from the
drawer in which it had reposed for more than two months and perused it
Expand All @@ -61,13 +66,6 @@ at the dial; the hands stood at half-past seven. He immediately threw
the letter on the table, and as he did so his anxiety found relief in
words.

.. class:: pull-left

.. figure:: /images/illus_001.jpg

"Again she turned her face from me."


"It's really the most extraordinary affair I ever had to do with," he
remarked. "And as I've been in the business just three-and-thirty years
at eleven a.m. next Monday morning, I ought to know something about it.
Expand Down Expand Up @@ -467,4 +465,4 @@ Sailor* public-house, East India Dock Road."

------------------------

You can read the rest of "A Bid For Fortune; Or, Dr. Nikola's Vendetta" at `Project Gutenberg <http://www.gutenberg.org/ebooks/21640>`__
You can read the rest of "A Bid For Fortune; Or, Dr. Nikola's Vendetta" at `Open Library <https://archive.org/stream/bidforfortunenov00bootiala#page/12/mode/2up>`__
117 changes: 117 additions & 0 deletions nikola/data/samplesite/templates/book.tmpl
@@ -0,0 +1,117 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%inherit file="post.tmpl"/>

<%block name="extra_head">
${parent.extra_head()}
<link href='https://fonts.googleapis.com/css?family=Gentium+Book+Basic' rel='stylesheet' type='text/css'>
<style>
.smallcaps {
font-variant: small-caps;
}
.chapter {
width: 100%;
padding: 10px;
-webkit-column-gap: 40px;
-moz-column-gap: 40px;
column-gap: 40px;
-webkit-column-width: 400px;
-moz-column-width: 400px;
column-width: 400px;
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-rule: 1px solid #ddd;
-moz-column-rule: 1px solid #ddd;
column-rule: 1px solid #ddd;
height: 90vh;
font-family: 'Gentium Book Basic', serif;
color: #2d2e2e;
font-weight: 500;
}
div.frame {
overflow: hidden;
padding: 0;
margin: 0;
}
div.scrolling-cont {
overflow-x: scroll;
padding: 0;
margin: 0;
}
h1, h2, h3, h4 {
text-align: center;
width: 100%;
font-family: 'Gentium Book Basic', serif;
font-size: 120%;
font-weight: 900;
}
h1 {
font-size: 150%;
}
.subtitle {
text-align: center;
width: 100%;
}
.bookfig {
width: 100%;
height: auto;
max-width: 100%;
max-height: 100%;
}
div.figure {
height: 88vh;
margin: 0;
}
div.topic {
margin: 0;
}
div.section > p {
text-indent: 1em;
margin-bottom: 0;
text-align: justify;
}
</style>
</%block>

<%block name="content">
<article class="storypage" itemscope="itemscope" itemtype="http://schema.org/Article">
<div class="frame">
<div class="scrolling-cont" id="scrolling-cont" name="scrolling-cont">
<div class="e-content entry-content chapter" itemprop="articleBody text">
<h1>${post.title()}</h1>
${post.text()}
</div>
</div>
</div>
</article>
</%block>

<%block name="extra_js">
<script src="//cdnjs.cloudflare.com/ajax/libs/Flowtype.js/1.1.0/flowtype.min.js"></script>
<script>
$('#scrolling-cont').flowtype({
minimum: 500,
maximum: 1200,
minFont: 20,
maxFont: 40,
fontRatio: 50
});
$(document).ready(function() {
var elem = $('#scrolling-cont');
elem.click(function(event) {
var x1 = elem.position().left;
var pw = elem.width() + 20;
var x2 = event.pageX;
if (x2 - x1 < pw / 2) {
pw = -pw;
}
elem.animate({
scrollLeft: '+=' + pw
}, 500)
});
});
</script>
</%block>
8 changes: 7 additions & 1 deletion nikola/nikola.py
Expand Up @@ -945,7 +945,13 @@ def _set_global_context(self):
self._GLOBAL_CONTEXT['hidden_categories'] = self.config.get('HIDDEN_CATEGORIES')
self._GLOBAL_CONTEXT['hidden_authors'] = self.config.get('HIDDEN_AUTHORS')
self._GLOBAL_CONTEXT['url_replacer'] = self.url_replacer
self._GLOBAL_CONTEXT['post_section_colors'] = self.config.get('POST_SECTION_COLORS')
self._GLOBAL_CONTEXT['posts_sections'] = self.config.get('POSTS_SECTIONS')
self._GLOBAL_CONTEXT['posts_section_are_indexes'] = self.config.get('POSTS_SECTION_ARE_INDEXES')
self._GLOBAL_CONTEXT['posts_section_colors'] = self.config.get('POSTS_SECTION_COLORS')
self._GLOBAL_CONTEXT['posts_section_descriptions'] = self.config.get('POSTS_SECTION_DESCRIPTIONS')
self._GLOBAL_CONTEXT['posts_section_from_meta'] = self.config.get('POSTS_SECTION_FROM_META')
self._GLOBAL_CONTEXT['posts_section_name'] = self.config.get('POSTS_SECTION_NAME')
self._GLOBAL_CONTEXT['posts_section_title'] = self.config.get('POSTS_SECTION_TITLE')

# IPython theme configuration. If a website has ipynb enabled in post_pages
# we should enable the IPython CSS (leaving that up to the theme itself).
Expand Down
11 changes: 8 additions & 3 deletions nikola/post.py
Expand Up @@ -745,11 +745,16 @@ def section_color(self, lang=None):

def section_link(self, lang=None):
"""Return the link to the post's section."""
if lang is None:
lang = nikola.utils.LocaleBorg().current_lang

slug = self.section_slug(lang)
t = os.path.normpath(self.translations[lang])
if t == '.':
t = ''
link = '/' + '/'.join(i for i in (t, slug) if i) + '/'
if not self.pretty_urls:
link = urljoin('/' + slug + '/', self.index_file)
else:
link = '/' + slug + '/'
link = urljoin(link, self.index_file)
link = utils.encodelink(link)
return link

Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
@@ -1,7 +1,7 @@
-r requirements-extras.txt
mock==1.3.0
coverage==3.7.1
pytest==2.7.2
pytest==2.7.3
pytest-cov==2.1.0
freezegun==0.3.5
python-coveralls==2.5.0
Expand Down

0 comments on commit b615124

Please sign in to comment.