diff options
-rwxr-xr-x | theme/assets/print.css | 2 | ||||
-rwxr-xr-x | theme/stylesheets/ebook.less | 40 | ||||
-rw-r--r-- | theme/templates/ebook/page.html | 2 |
3 files changed, 38 insertions, 6 deletions
diff --git a/theme/assets/print.css b/theme/assets/print.css index 997d485..5fcd5ef 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}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 +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}body .page blockquote,body .page code,body .page img,body .page pre,body .page tr{page-break-inside:avoid}.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 .section>h1,body .page .section>h2,body .page .section>h3,body .page blockquote>:first-child{margin-top:0}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>: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}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 h2,body .page h3,body .page p{orphans:3;widows:3}body .page h1,body .page h2,body .page h3{page-break-before:initial;page-break-after:avoid}body .page .book-chapter{display:none}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}
\ No newline at end of file diff --git a/theme/stylesheets/ebook.less b/theme/stylesheets/ebook.less index f167fd0..01a7d42 100755 --- a/theme/stylesheets/ebook.less +++ b/theme/stylesheets/ebook.less @@ -7,6 +7,42 @@ body { font-family: sans-serif; .markdown-content(#000, 1.6); + pre, code, blockquote { + page-break-inside: avoid; + } + + tr, img { + page-break-inside: avoid; + } + + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + + + h1, + h2, + h3 { + page-break-before: initial; + page-break-after: avoid; + } + + // Section and first titles + .section { + > h1, > h2, > h3 { + margin-top: 0px; + } + } + + // Hide the title (only used to build PDF table of content) + .book-chapter { + display: none; + } + + // First page: table of contents &.page-toc { .glossary { margin-bottom: 40px; @@ -31,9 +67,5 @@ body { } } } - - .book-chapter { - display: none; - } } } diff --git a/theme/templates/ebook/page.html b/theme/templates/ebook/page.html index f207184..0b87586 100644 --- a/theme/templates/ebook/page.html +++ b/theme/templates/ebook/page.html @@ -22,7 +22,7 @@ <div class="page"> <h1 class="book-chapter book-chapter-{{ progress.current.level|lvl }}">{{ progress.current.title }}</h1> {% for section in content %} - <div class="{{ section.type }}" id="section-{{ section.id }}"> + <div class="section {{ section.type }}" id="section-{{ section.id }}"> {% if section.type == "normal" %} {% autoescape false %}{{ section.content }}{% endautoescape %} {% endif %} |