1
0
Fork 0

Its now possible to build pdf, epub and mobi again

This commit is contained in:
Thomas Schmidts 2014-10-29 17:36:21 +01:00
parent d6d80d2b9b
commit aa5d74c32d
8 changed files with 78 additions and 112 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,11 +18,6 @@ define([
var $book; var $book;
$book = state.$book; $book = state.$book;
if (state.githubId) {
// Initialize storage
storage.setBaseKey(state.githubId);
}
// Init sidebar // Init sidebar
sidebar.init(); sidebar.init();

View File

@ -3,30 +3,55 @@
@import "ebook/variables.less"; @import "ebook/variables.less";
@import "ebook/highlight.less"; @import "ebook/highlight.less";
.page {
.book-chapter { .book-chapter {
display: none; display: none;
} }
.exercise, .quiz { .exercise, .quiz {
margin: 1cm 0cm; margin: 1cm 0cm;
padding: 0.4cm; border: 2px solid #ddd;
page-break-inside: avoid;
border: 3px solid #ddd;
.exercise-header { .exercise-header {
margin-bottom: 0.4cm; padding: 0.1cm 0.3cm;
padding-bottom: 0.2cm; background: #f5f5f5;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
font-weight: bold;
page-break-inside: avoid;
}
.exercise-inner {
padding: 0.15cm 0.3cm;
p:last-child {
margin: 0px;
}
}
hr {
height: 2px;
} }
.question { .question {
margin-top: 0.4cm; margin-top: 0.1cm;
border-top: 1px solid #ddd;
.question-base {
}
.question-solution {
} }
} }
}
}
body { body {
.page {
font-family: sans-serif; font-family: sans-serif;
.markdown-content(#333, 1.6); .markdown-content(#333, 1.6);
} }
}

View File

@ -1,87 +1,36 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block title %}{{ title }}{% endblock %} {% block title %}{{ progress.current.title }} | {{ title }}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{{ staticBase }}/print.css"> <link rel="stylesheet" href="{{ staticBase }}/print.css">
{% for resource in plugins.resources.css %}
{% if resource.url %}
<link rel="stylesheet" href="{{ resource.url }}">
{% else %}
<link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
{% endif %}
{% endfor %}
{% endblock %} {% endblock %}
{% block content %}
{% macro articleContent(content) %} <div class="page">
<h1 class="book-chapter book-chapter-{{ progress.current.level|lvl }}">{{ progress.current.title }}</h1>
{% for section in content %} {% for section in content %}
<section class="{{ section.type }}" id="section-{{ section.id }}">
{% if section.type == "normal" %} {% if section.type == "normal" %}
{% autoescape false %}{{ section.content }}{% endautoescape %} {% autoescape false %}{{ section.content }}{% endautoescape %}
{% elif section.type == "exercise" %} {% elif section.type == "exercise" %}
<div class="exercise"> {% include "./includes/page/exercise.html" with {section: section} %}
<div class="exercise-header">Exercise #{{ exercise }}</div>
{% autoescape false %}{{ section.content }}{% endautoescape %}
<pre><code>{% autoescape false %}{{ section.code.base|code }}{% endautoescape %}</code></pre>
{% set exercise = exercise + 1 %}
</div>
{% elif section.type == "quiz" %} {% elif section.type == "quiz" %}
<div class="quiz"> {% include "./includes/page/quiz.html" with {section: section} %}
<div class="exercise-header">Quiz #{{ exercise }}</div>
{% autoescape false %}{{ section.content }}{% endautoescape %}
{% for quiz in section.quiz %}
<div class="question">
<div class="question-header">Question {{ loop.index }} of {{ section.quiz.length }}</div>
{% autoescape false %}{{ quiz.base }}{% endautoescape %}
</div>
{% endfor %}
{% set exercise = exercise + 1 %}
</div>
{% endif %} {% endif %}
{% endfor %} </section>
{% endmacro %}
{% set exercise = 1 %}
{% block content %}
{# Pages content #}
{% for item in progress.chapters %}
<article id="{{ article.path }}">
<h1 class="book-chapter book-chapter-{{ item.level|lvl }}">{{ item.title }}</h1>
{% if pages[item.path] %}
{{ articleContent(pages[item.path].content) }}
{% endif %}
</article>
{% endfor %} {% endfor %}
{% if progress.current.next and progress.current.next.path %}
{# Exercise solutions #} <a href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" />
{% if exercise > 1 %}
{% set exercise = 1 %}
<article>
<h1 class="book-chapter book-chapter-1">Exercise Solutions</h1>
<h1>Exercise Solutions</h1>
{% for item in progress.chapters %}
{% if pages[item.path] %}
{% for section in pages[item.path].content %}
{% if section.type == "exercise" %}
<div class="exercise">
<div class="exercise-header">Exercise #{{ exercise }}</div>
{% autoescape false %}{{ section.content }}{% endautoescape %}
<pre><code>{% autoescape false %}{{ section.code.solution|code }}{% endautoescape %}</code></pre>
{% set exercise = exercise + 1 %}
</div>
{% elif section.type == "quiz" %}
<div class="quiz">
<div class="exercise-header">Quiz #{{ exercise }}</div>
{% autoescape false %}{{ section.content }}{% endautoescape %}
{% for quiz in section.quiz %}
<div class="question">
<div class="question-header">Question {{ loop.index }} of {{ section.quiz.length }}</div>
{% autoescape false %}{{ quiz.solution }}{% endautoescape %}
</div>
{% endfor %}
{% set exercise = exercise + 1 %}
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</article>
{% endif %} {% endif %}
</div>
{% endblock %} {% endblock %}
{% block javascript %}{% endblock %}

View File

@ -2,9 +2,6 @@
{% block head %} {% block head %}
{% parent %} {% parent %}
{% if githubAuthor %}
<meta name="author" content="{{ githubAuthor }}">
{% endif %}
{% if progress.current.next and progress.current.next.path %} {% if progress.current.next and progress.current.next.path %}
<link rel="next" href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" /> <link rel="next" href="{{ basePath }}/{{ progress.current.next.path|mdLink }}" />
{% endif %} {% endif %}
@ -17,7 +14,7 @@
{% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %} {% block description %}{% if progress.current.level == "0" %}{{ description }}{% endif %}{% endblock %}
{% block content %} {% block content %}
<div class="book" {% if githubId %}data-github="{{ githubId }}"{% endif %} data-level="{{ progress.current.level }}" data-basepath="{{ basePath }}" data-revision="{{ revision }}"> <div class="book" data-level="{{ progress.current.level }}" data-basepath="{{ basePath }}" data-revision="{{ revision }}">
{% include "includes/book/summary.html" %} {% include "includes/book/summary.html" %}
<div class="book-body"> <div class="book-body">
<div class="body-inner"> <div class="body-inner">