Add summary to page generator

This commit is contained in:
Samy Pessé
2014-04-04 16:40:21 -07:00
parent 0c7e2b3557
commit 9fbe240843
4 changed files with 38 additions and 4 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ Generator.prototype.finish = function() {
);
})
//
// Copy assets
.then(function() {
return fs.copy(
path.join(that.options.theme, "assets"),
+1 -1
View File
@@ -1 +1 @@
.hljs-comment,.hljs-title{color:#8e908c}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#c82829}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#f5871f}.ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#eab700}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor{color:#3e999f}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{display:block;background:white;color:#4d4d4c;padding:.5em}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}body{font:12pt Georgia,"Times New Roman",Times,serif;line-height:1.3}@page{margin:1.5cm}
.hljs-comment,.hljs-title{color:#8e908c}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#c82829}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#f5871f}.ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#eab700}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor{color:#3e999f}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{display:block;background:white;color:#4d4d4c;padding:.5em}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}body{font:12pt Georgia,"Times New Roman",Times,serif;line-height:1.3}@page{margin:1.5cm}section{page-break-after:always}section article:after{border-bottom:1px solid #ccc}
+10
View File
@@ -7,4 +7,14 @@ body {
@page {
margin: 1.5cm;
}
section {
page-break-after: always;
article {
&:after {
border-bottom: 1px solid #ccc;
}
}
}
+26 -2
View File
@@ -9,13 +9,37 @@
{% block content %}
{# Cover #}
<section id="cover">
<h1>{{ title }}</h1>
<h2>By @{{ githubAuthor }}</h2>
</section>
{# Summary #}
<section id="summary">
<ul class="summary">
<li>
<a href="#README.md">Introduction</a>
</li>
{% for item in summary.chapters %}
<li>
<a href="#{{ item.path }}"><b>{{ item.level }})</b> {{ item.title }}</a>
{% if item.articles.length > 0 %}
<ul>
{% for article in item.articles %}
<li>
<a href="#{{ article.path }}"><b>{{ article.level }})</b> {{ article.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</section>
{# Pages content #}
{% for page in pages %}
<article id="{{ page.path }}" style="page-break-after: always;">
<article id="{{ page.path }}">
{% for section in page.content %}
{% if section.type == "normal" %}
{% autoescape false %}{{ section.content }}{% endautoescape %}