Apply styles to ebook output

This commit is contained in:
Samy Pessé
2015-01-14 22:31:36 +01:00
parent 3382f1b084
commit 9467cda131
5 changed files with 22 additions and 24 deletions
+8 -3
View File
@@ -11,6 +11,12 @@ var stringUtils = require("../../utils/string");
var Generator = function() {
BaseGenerator.apply(this, arguments);
// eBook format
this.ebookFormat = this.options.extension || path.extname(this.options.output).replace("\.", "") || "pdf";
// Styles to use
this.styles = ["ebook", this.ebookFormat];
};
util.inherits(Generator, BaseGenerator);
@@ -20,7 +26,6 @@ Generator.prototype.finish = function() {
return BaseGenerator.prototype.finish.apply(this)
.then(function() {
var d = Q.defer();
var format = that.options.extension || path.extname(that.options.output).replace("\.", "") || "pdf";
if (!that.options.cover && fs.existsSync(path.join(that.options.output, "cover.jpg"))) {
that.options.cover = path.join(that.options.output, "cover.jpg");
@@ -44,7 +49,7 @@ Generator.prototype.finish = function() {
"--breadth-first": true
};
if (format == "pdf") {
if (that.ebookFormat == "pdf") {
var pdfOptions = that.options.pdf;
_.extend(_options, {
@@ -64,7 +69,7 @@ Generator.prototype.finish = function() {
var command = [
"ebook-convert",
path.join(that.options.output, "SUMMARY.html"),
path.join(that.options.output, "index."+format),
path.join(that.options.output, "index."+that.ebookFormat),
stringUtils.optionsToShellArgs(_options)
].join(" ");
+1
View File
@@ -11,6 +11,7 @@ var BaseGenerator = require("../site");
var Generator = function() {
BaseGenerator.apply(this, arguments);
// Styles to use
this.styles = ["ebook"];
// Base for assets in plugins
+1 -1
View File
@@ -1,4 +1,4 @@
{% extends "./layout.html" %}
{% extends "./page.html" %}
{% block title %}Glossary | {{ title }}{% endblock %}
+11 -8
View File
@@ -3,14 +3,17 @@
{% block title %}{{ progress.current.title }} | {{ title }}{% endblock %}
{% block style %}
<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 %}
<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 %}
{% for style in styles %}
<link rel="stylesheet" href="{{ basePath }}/{{ style }}">
{% endfor %}
{% endblock %}
{% block content %}
+1 -12
View File
@@ -1,18 +1,7 @@
{% extends "./layout.html" %}
{% extends "./page.html" %}
{% block title %}Table of Contents | {{ title }}{% endblock %}
{% block style %}
<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 %}
{% macro articles(_articles) %}
{% for item in _articles %}
{% set externalLink = item.path|isExternalLink %}