diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-10-02 11:20:32 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-10-06 09:44:54 +0200 |
commit | 51c79f294ca8ef9bc3205a7c81454d7a3fd2722c (patch) | |
tree | d2e22d9bfe9020e0db6d8bc2cbd20d45977ee303 | |
parent | ce1e0e187339976fc3cae7ef70bcfdd0eaf68981 (diff) | |
download | gitbook-51c79f294ca8ef9bc3205a7c81454d7a3fd2722c.zip gitbook-51c79f294ca8ef9bc3205a7c81454d7a3fd2722c.tar.gz gitbook-51c79f294ca8ef9bc3205a7c81454d7a3fd2722c.tar.bz2 |
Add css to footer/header for pdf
-rw-r--r-- | lib/configuration.js | 16 | ||||
-rwxr-xr-x | theme/assets/print.css | 2 | ||||
-rwxr-xr-x | theme/stylesheets/ebook.less | 54 | ||||
-rw-r--r-- | theme/templates/ebook/footer.html | 4 | ||||
-rw-r--r-- | theme/templates/ebook/header.html | 3 |
5 files changed, 49 insertions, 30 deletions
diff --git a/lib/configuration.js b/lib/configuration.js index 3b6b47b..563fcef 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -1,5 +1,6 @@ var _ = require('lodash'); var Q = require('q'); +var fs = require('fs'); var path = require('path'); var semver = require('semver'); @@ -276,6 +277,7 @@ Configuration.DEFAULT = { // Margin (in pts) // Note: 72 pts equals 1 inch +<<<<<<< HEAD 'margin': { 'right': 62, 'left': 62, @@ -288,6 +290,20 @@ Configuration.DEFAULT = { // Footer HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. 'footerTemplate': '' +======= + "margin": { + "right": 62, + "left": 62, + "top": 62, + "bottom": 62 + }, + + //Header HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. + "headerTemplate": fs.readFileSync(path.resolve(__dirname, '../theme/templates/ebook/header.html'), { encoding: 'utf-8' }), + + //Footer HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. + "footerTemplate": fs.readFileSync(path.resolve(__dirname, '../theme/templates/ebook/footer.html'), { encoding: 'utf-8' }) +>>>>>>> Add css to footer/header for pdf } }; diff --git a/theme/assets/print.css b/theme/assets/print.css index 61e1d40..997d485 100755 --- a/theme/assets/print.css +++ b/theme/assets/print.css @@ -1 +1 @@ -body .page ol,body .page td,body .page th,body .page ul{padding:0}body .page .anchor:focus,body .page a:active,body .page a:hover{outline:0}body .page dl dt,body .page strong,body .page table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.page.page-toc .glossary{margin-bottom:40px}.page.page-toc .glossary h2 a,.page.page-toc .glossary h2 a:hover{color:inherit;text-decoration:none}.page.page-toc .glossary .glossary-index{list-style:none;margin:0;padding:0}.page.page-toc .glossary .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}.page .book-chapter{display:none}body .page{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#000;overflow:hidden;line-height:1.6;word-wrap:break-word;display:block}body .page>:first-child{margin-top:0!important}body .page>:last-child{margin-bottom:0!important}body .page a{background:0 0;color:#4183c4;text-decoration:none}body .page h1{margin:.67em 0}body .page img{border:0}body .page hr{-moz-box-sizing:content-box;box-sizing:content-box}body .page code,body .page pre{direction:ltr;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}body .page *{-moz-box-sizing:border-box;box-sizing:border-box}body .page a:active,body .page a:focus,body .page a:hover{text-decoration:underline}body .page hr:after,body .page hr:before{display:table;content:" "}body .page hr:after{clear:both}body .page blockquote{margin:0}body .page h1,body .page h2{padding-bottom:.3em;border-bottom:1px solid #eee}body .page ol ol{list-style-type:lower-roman}body .page dd{margin-left:0}body .page .markdown-body>:first-child{margin-top:0!important}body .page .markdown-body>:last-child{margin-bottom:0!important}body .page .anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:700;line-height:1.4}body .page h1{font-size:2.25em;line-height:1.2}body .page h2{font-size:1.75em;line-height:1.225}body .page h3{font-size:1.5em;line-height:1.43}body .page h4{font-size:1.25em}body .page h5,body .page h6{font-size:1em}body .page h6{color:#777}body .page blockquote,body .page dl,body .page ol,body .page p,body .page pre,body .page table,body .page ul{margin-top:0;margin-bottom:16px}body .page hr{overflow:hidden;background:#e7e7e7;height:4px;padding:0;margin:16px 0;border:0}body .page ol,body .page ul{padding-left:2em}body .page ol ol,body .page ol ul,body .page ul ul{margin-top:0;margin-bottom:0}body .page dl{padding:0}body .page dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic}body .page dl dd{padding:0 16px;margin-bottom:16px}body .page blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}body .page blockquote>:first-child{margin-top:0}body .page blockquote>:last-child{margin-bottom:0}body .page table{border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto}body .page table td,body .page table th{padding:6px 13px;border:1px solid #ddd}body .page table tr{background-color:#fff;border-top:1px solid #ccc}body .page table tr:nth-child(2n){background-color:#f8f8f8}body .page img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box;page-break-inside:avoid}body .page code{padding:.2em 0;margin:0;font-size:85%;background-color:#f7f7f7;border-radius:3px}body .page code:after,body .page code:before{letter-spacing:-.2em;content:"\00a0"}body .page pre>code{padding:0;margin:0;font-size:100%;white-space:pre;background:0 0;border:0}body .page .highlight pre,body .page pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f7f7f7;border:none;border-radius:3px}body .page pre{word-wrap:normal}body .page pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}body .page pre code:after,body .page pre code:before{content:normal}body .page .highlight{background:#fff}
\ No newline at end of file +body .page ol,body .page td,body .page th,body .page ul{padding:0}body .page .anchor:focus,body .page a:active,body .page a:hover{outline:0}body .page dl dt,body .page strong,body .page table th{font-weight:700}.link-inherit,.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}body .page{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;color:#000;overflow:hidden;line-height:1.6;word-wrap:break-word;display:block}body .page>:first-child{margin-top:0!important}body .page>:last-child{margin-bottom:0!important}body .page a{background:0 0;color:#4183c4;text-decoration:none}body .page h1{margin:.67em 0}body .page img{border:0}body .page hr{-moz-box-sizing:content-box;box-sizing:content-box}body .page code,body .page pre{direction:ltr;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}body .page *{-moz-box-sizing:border-box;box-sizing:border-box}body .page a:active,body .page a:focus,body .page a:hover{text-decoration:underline}body .page hr:after,body .page hr:before{display:table;content:" "}body .page hr:after{clear:both}body .page blockquote{margin:0}body .page h1,body .page h2{padding-bottom:.3em;border-bottom:1px solid #eee}body .page ol ol{list-style-type:lower-roman}body .page dd{margin-left:0}body .page .markdown-body>:first-child{margin-top:0!important}body .page .markdown-body>:last-child{margin-bottom:0!important}body .page .anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:700;line-height:1.4}body .page h1{font-size:2.25em;line-height:1.2}body .page h2{font-size:1.75em;line-height:1.225}body .page h3{font-size:1.5em;line-height:1.43}body .page h4{font-size:1.25em}body .page h5,body .page h6{font-size:1em}body .page h6{color:#777}body .page blockquote,body .page dl,body .page ol,body .page p,body .page pre,body .page table,body .page ul{margin-top:0;margin-bottom:16px}body .page hr{overflow:hidden;background:#e7e7e7;height:4px;padding:0;margin:16px 0;border:0}body .page ol,body .page ul{padding-left:2em}body .page ol ol,body .page ol ul,body .page ul ul{margin-top:0;margin-bottom:0}body .page dl{padding:0}body .page dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic}body .page dl dd{padding:0 16px;margin-bottom:16px}body .page blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}body .page blockquote>:first-child{margin-top:0}body .page blockquote>:last-child{margin-bottom:0}body .page table{border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto}body .page table td,body .page table th{padding:6px 13px;border:1px solid #ddd}body .page table tr{background-color:#fff;border-top:1px solid #ccc}body .page table tr:nth-child(2n){background-color:#f8f8f8}body .page img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box;page-break-inside:avoid}body .page code{padding:.2em 0;margin:0;font-size:85%;background-color:#f7f7f7;border-radius:3px}body .page code:after,body .page code:before{letter-spacing:-.2em;content:"\00a0"}body .page pre>code{padding:0;margin:0;font-size:100%;white-space:pre;background:0 0;border:0}body .page .highlight pre,body .page pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f7f7f7;border:none;border-radius:3px}body .page pre{word-wrap:normal}body .page pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}body .page pre code:after,body .page pre code:before{content:normal}body .page .highlight{background:#fff}body .page.page-toc .glossary{margin-bottom:40px}body .page.page-toc .glossary h2 a,body .page.page-toc .glossary h2 a:hover{color:inherit;text-decoration:none}body .page.page-toc .glossary .glossary-index{list-style:none;margin:0;padding:0}body .page.page-toc .glossary .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}body .page .book-chapter{display:none}
\ No newline at end of file diff --git a/theme/stylesheets/ebook.less b/theme/stylesheets/ebook.less index 92bc915..f167fd0 100755 --- a/theme/stylesheets/ebook.less +++ b/theme/stylesheets/ebook.less @@ -2,42 +2,38 @@ @import "ebook/variables.less"; -.page { - &.page-toc { - .glossary { - margin-bottom: 40px; +body { + .page { + font-family: sans-serif; + .markdown-content(#000, 1.6); + + &.page-toc { + .glossary { + margin-bottom: 40px; - h2 { - a, a:hover { - color: inherit; - text-decoration: none; + h2 { + a, a:hover { + color: inherit; + text-decoration: none; + } } - } - .glossary-index { - list-style: none; - margin: 0px; - padding: 0px; + .glossary-index { + list-style: none; + margin: 0px; + padding: 0px; - li { - display: inline; - margin: 0px 8px; - white-space: nowrap; + li { + display: inline; + margin: 0px 8px; + white-space: nowrap; + } } } } - } - .book-chapter { - display: none; - } -} - - - -body { - .page { - font-family: sans-serif; - .markdown-content(#000, 1.6); + .book-chapter { + display: none; + } } } diff --git a/theme/templates/ebook/footer.html b/theme/templates/ebook/footer.html new file mode 100644 index 0000000..6975821 --- /dev/null +++ b/theme/templates/ebook/footer.html @@ -0,0 +1,4 @@ +<div style="font-family: sans-serif;margin-top: 20px;padding-top: 10px;border-top: 2px solid #eee;color:#aaa;"> + <span>_SECTION_</span> + <span style="float:right;">_PAGENUM_</span> +</div>
\ No newline at end of file diff --git a/theme/templates/ebook/header.html b/theme/templates/ebook/header.html new file mode 100644 index 0000000..4851be2 --- /dev/null +++ b/theme/templates/ebook/header.html @@ -0,0 +1,3 @@ +<div style="font-family: sans-serif;margin-top: 20px;padding-bottom: 10px;border-bottom: 2px solid #eee;color: #aaa;"> + <span>_TITLE_</span> +</div>
\ No newline at end of file |