summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-04-04 16:02:57 -0700
committerSamy Pessé <samypesse@gmail.com>2014-04-04 16:02:57 -0700
commit0c7e2b3557526bf74842096f5af0bba911380662 (patch)
treee6309b85a53557976c2a884a698532016257b5fe
parente34e65813ccb05ae29b7d47f9258663898315de9 (diff)
downloadgitbook-0c7e2b3557526bf74842096f5af0bba911380662.zip
gitbook-0c7e2b3557526bf74842096f5af0bba911380662.tar.gz
gitbook-0c7e2b3557526bf74842096f5af0bba911380662.tar.bz2
Add base style for printing
-rw-r--r--Gruntfile.js3
-rw-r--r--lib/generate/page/index.js8
-rw-r--r--theme/assets/print.css1
-rw-r--r--theme/stylesheets/print.less10
-rw-r--r--theme/templates/layout.html3
-rw-r--r--theme/templates/page.html11
6 files changed, 35 insertions, 1 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index 018ec12..c0ab169 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -16,7 +16,8 @@ module.exports = function (grunt) {
optimization: 2
},
files: {
- "theme/assets/style.css": "theme/stylesheets/main.less"
+ "theme/assets/style.css": "theme/stylesheets/main.less",
+ "theme/assets/print.css": "theme/stylesheets/print.less"
}
}
},
diff --git a/lib/generate/page/index.js b/lib/generate/page/index.js
index a489066..111bb1e 100644
--- a/lib/generate/page/index.js
+++ b/lib/generate/page/index.js
@@ -92,6 +92,14 @@ Generator.prototype.finish = function() {
output,
html
);
+ })
+
+ //
+ .then(function() {
+ return fs.copy(
+ path.join(that.options.theme, "assets"),
+ path.join(that.options.output, "gitbook")
+ );
});
};
diff --git a/theme/assets/print.css b/theme/assets/print.css
new file mode 100644
index 0000000..98d113c
--- /dev/null
+++ b/theme/assets/print.css
@@ -0,0 +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} \ No newline at end of file
diff --git a/theme/stylesheets/print.less b/theme/stylesheets/print.less
new file mode 100644
index 0000000..5a4d06f
--- /dev/null
+++ b/theme/stylesheets/print.less
@@ -0,0 +1,10 @@
+@import "highlight.less";
+
+body {
+ font: 12pt Georgia, "Times New Roman", Times, serif;
+ line-height: 1.3;
+}
+
+@page {
+ margin: 1.5cm;
+} \ No newline at end of file
diff --git a/theme/templates/layout.html b/theme/templates/layout.html
index 3057f4b..7f564b2 100644
--- a/theme/templates/layout.html
+++ b/theme/templates/layout.html
@@ -32,8 +32,11 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="shortcut icon" href="{{ staticBase }}/images/favicon.ico" type="image/x-icon">
+
+ {% block style %}
<link rel="stylesheet" href="{{ staticBase }}/style.css">
{% endblock %}
+ {% endblock %}
</head>
<body>
{% block content %}{% endblock %}
diff --git a/theme/templates/page.html b/theme/templates/page.html
index ef61d8f..7af99fb 100644
--- a/theme/templates/page.html
+++ b/theme/templates/page.html
@@ -2,7 +2,18 @@
{% block title %}{{ title }}{% endblock %}
+{% block style %}
+<link rel="stylesheet" href="{{ staticBase }}/print.css">
+{% endblock %}
+
+
{% block content %}
+ {# Cover #}
+
+ {# Summary #}
+
+
+ {# Pages content #}
{% for page in pages %}
<article id="{{ page.path }}" style="page-break-after: always;">
{% for section in page.content %}