mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 11:03:39 +00:00
Normalize summary in gitbook
This commit is contained in:
+2
-1
@@ -6,6 +6,7 @@ var fs = require("./utils/fs");
|
||||
var parseNavigation = require("./utils/navigation");
|
||||
var parseProgress = require("./utils/progress");
|
||||
var pageUtil = require("./utils/page");
|
||||
var summaryUtil = require("./utils/summary");
|
||||
|
||||
var Configuration = require("./configuration");
|
||||
var TemplateEngine = require("./template");
|
||||
@@ -270,7 +271,7 @@ Book.prototype.parseSummary = function() {
|
||||
});
|
||||
})
|
||||
.then(function(summary) {
|
||||
that.summary = summary;
|
||||
that.summary = summaryUtil.normalize(summary);
|
||||
that.navigation = parseNavigation(that.summary, that.files);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -75,6 +75,9 @@ Generator.prototype.prepareTemplates = function() {
|
||||
|
||||
// Add filter
|
||||
this.env.addFilter("contentLink", this.contentLink.bind(this));
|
||||
this.env.addFilter('lvl', function(lvl) {
|
||||
return lvl.split(".").length;
|
||||
});
|
||||
|
||||
// Add extension
|
||||
this.env.addExtension('ParentExtension', new ParentExtension());
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<div class="exercise-header">Exercise</div>
|
||||
<div class="exercise-inner">
|
||||
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
||||
</div>
|
||||
<div class="exercise-inner">
|
||||
<pre><code>{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}</code></pre>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="exercise-inner">
|
||||
<pre><code>{% autoescape false %}{{ section.code.solution|code }}{% endautoescape %}</code></pre>
|
||||
</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
<div class="exercise-header">Quiz</div>
|
||||
<div class="exercise-inner">{% autoescape false %}{{ section.content }}{% endautoescape %}</div>
|
||||
{% for quiz in section.quiz %}
|
||||
<div class="question exercise-inner">
|
||||
<div class="question-header">Question {{ loop.index }} of {{ section.quiz.length }}</div>
|
||||
|
||||
<div class="question-base">
|
||||
{% autoescape false %}{{ quiz.base }}{% endautoescape %}
|
||||
</div>
|
||||
<div class="question-solution">
|
||||
{% autoescape false %}{{ quiz.solution }}{% endautoescape %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -23,10 +23,6 @@
|
||||
<div class="{{ section.type }}" id="section-{{ section.id }}">
|
||||
{% if section.type == "normal" %}
|
||||
{% autoescape false %}{{ section.content }}{% endautoescape %}
|
||||
{% elif section.type == "exercise" %}
|
||||
{% include "./includes/exercise.html" with {section: section} %}
|
||||
{% elif section.type == "quiz" %}
|
||||
{% include "./includes/quiz.html" with {section: section} %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<ul class="languages">
|
||||
{% for lang in langs %}
|
||||
<li>
|
||||
<a href="{{ basePath}}/{{ lang.path|pathJoin("/index.html") }}">{{ lang.title }}</a>
|
||||
<a href="{{ basePath}}/{{ lang.lang }}/index.html">{{ lang.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user