re_integrated html2print boilerplate from osp
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
# HTML2PRINT : tous des sangs mélé
|
||||
|
||||
## Book src
|
||||
|
||||
bin/sync.sh will pull books from git repositories listed in the the script
|
||||
source are in the directory book-src
|
||||
|
||||
## Building
|
||||
|
||||
bin/build.py will read the book sources and convert them to html files using pandoc (pypandoc)
|
||||
|
||||
### Assets
|
||||
|
||||
building process intergate in html files all the necessary assets (css/js) contained in the "assets" directory
|
||||
|
||||
## Automation
|
||||
|
||||
gulp is watching assets files to convert scss to css and then rebuild html pages
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* DEBUG STYLES
|
||||
*/
|
||||
|
||||
.debug .header {
|
||||
outline: 1px solid pink;
|
||||
}
|
||||
.debug .body {
|
||||
outline: 1px solid purple;
|
||||
}
|
||||
.debug .footer {
|
||||
outline: 1px solid pink;
|
||||
}
|
||||
|
||||
.debug .region-break {
|
||||
border-top: 1px dashed blue;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.debug img {
|
||||
outline: 1px solid blue;
|
||||
}
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
#viewport {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 25px;
|
||||
left: 0;
|
||||
right: 0; }
|
||||
|
||||
#toolbar {
|
||||
background-color: black;
|
||||
position: fixed;
|
||||
height: 25px;
|
||||
bottom: 0em;
|
||||
left: 0;
|
||||
right: 0;
|
||||
color: white;
|
||||
font-family: sans;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
padding: 3px 0;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
align-items: center;
|
||||
-webkit-align-items: center; }
|
||||
|
||||
label {
|
||||
margin-left: 1.5em;
|
||||
margin-right: 3px; }
|
||||
|
||||
input {
|
||||
border: 1px solid white;
|
||||
background-color: white;
|
||||
font-size: 11px;
|
||||
vertical-align: -2px; }
|
||||
|
||||
input[type=number] {
|
||||
width: 50px;
|
||||
vertical-align: 0px;
|
||||
margin-left: 2px; }
|
||||
|
||||
input:hover {
|
||||
cursor: pointer;
|
||||
background-color: yellow; }
|
||||
|
||||
button {
|
||||
border: 1px solid white;
|
||||
background-color: white;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
margin-right: 1em;
|
||||
height: 19px; }
|
||||
|
||||
button:hover {
|
||||
cursor: pointer;
|
||||
background-color: yellow; }
|
||||
|
||||
.separator {
|
||||
content: " ";
|
||||
flex-grow: 2;
|
||||
-webkit-flex-grow: 2; }
|
||||
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0; }
|
||||
Vendored
+338
@@ -0,0 +1,338 @@
|
||||
<style type="text/css">
|
||||
@charset "UTF-8";
|
||||
/* the geometry of the page */
|
||||
/* the size of the crop marks*/
|
||||
/* the size of bleed */
|
||||
/**
|
||||
* Computation
|
||||
*/
|
||||
/* EXTRA SPACE AROUND THE PAGE: BLEED + CROP */
|
||||
/* GEOMETRY OF THE PAPER SHEET */
|
||||
/* SIZE OF SPREAD */
|
||||
/**
|
||||
* DEFINITION OF THE PAPER SHEET
|
||||
*/
|
||||
@page {
|
||||
size: 210mm 291mm;
|
||||
margin: 0; }
|
||||
|
||||
/**
|
||||
* CANVAS
|
||||
*/
|
||||
@media all {
|
||||
body {
|
||||
margin: 0; }
|
||||
.paper {
|
||||
width: 210mm;
|
||||
height: 290mm;
|
||||
box-sizing: border-box;
|
||||
counter-increment: page-counter;
|
||||
page-break-inside: avoid;
|
||||
page-break-after: always;
|
||||
overflow: hidden;
|
||||
/* Crop marks */
|
||||
padding: 0mm;
|
||||
position: relative; }
|
||||
.paper .crops {
|
||||
width: 210mm;
|
||||
height: 290mm;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0; }
|
||||
.paper .crops div {
|
||||
border-style: solid;
|
||||
border-color: black;
|
||||
border-width: 0;
|
||||
width: 0mm;
|
||||
height: 0mm;
|
||||
position: absolute;
|
||||
box-sizing: border-box; }
|
||||
.paper .crops div span {
|
||||
width: 0mm;
|
||||
height: 0mm;
|
||||
background-color: white;
|
||||
position: absolute; }
|
||||
.paper .crops .crop-top-left {
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
top: 0;
|
||||
left: 0; }
|
||||
.paper .crops .crop-top-left span {
|
||||
right: -1px;
|
||||
bottom: -1px; }
|
||||
.paper .crops .crop-top-right {
|
||||
border-left-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
top: 0;
|
||||
right: 0; }
|
||||
.paper .crops .crop-top-right span {
|
||||
left: -1px;
|
||||
bottom: -1px; }
|
||||
.paper .crops .crop-bottom-right {
|
||||
border-left-width: 1px;
|
||||
border-top-width: 1px;
|
||||
right: 0;
|
||||
bottom: 0; }
|
||||
.paper .crops .crop-bottom-right span {
|
||||
left: -1px;
|
||||
top: -1px; }
|
||||
.paper .crops .crop-bottom-left {
|
||||
border-right-width: 1px;
|
||||
border-top-width: 1px;
|
||||
left: 0;
|
||||
bottom: 0; }
|
||||
.paper .crops .crop-bottom-left span {
|
||||
right: -1px;
|
||||
top: -1px; }
|
||||
.page {
|
||||
width: 210mm;
|
||||
height: 290mm;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden; }
|
||||
.spread .paper {
|
||||
float: left; }
|
||||
.spread .paper:nth-child(odd) {
|
||||
margin-left: 0mm; }
|
||||
.spread .paper:nth-child(even) {
|
||||
margin-right: 0mm; }
|
||||
.spread .paper:first-child {
|
||||
margin-left: 210mm; } }
|
||||
|
||||
@media print {
|
||||
html {
|
||||
width: 210mm; }
|
||||
body {
|
||||
/* Allows printing of background colors */
|
||||
background-color: white;
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
/* Activate opentype features and kernings */
|
||||
-webkit-font-feature-settings: "liga", "dlig", "clig", "kern";
|
||||
text-rendering: optimizeLegibility; } }
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
.region-break {
|
||||
/* Apply this class to an element to put it on a new region.
|
||||
* Hint:
|
||||
* You can also use an empty <div class="page-break"></div>
|
||||
* if you want to put manual page breaks without attaching it to an HTML element
|
||||
*/
|
||||
-webkit-region-break-before: always;
|
||||
break-before: always; }
|
||||
|
||||
.header,
|
||||
.body,
|
||||
.footer {
|
||||
box-sizing: border-box; }
|
||||
|
||||
/* __________________________________ HEADER __________________________________ */
|
||||
.header {
|
||||
top: 0;
|
||||
margin: 0;
|
||||
padding-top: 8mm;
|
||||
width: 100%;
|
||||
height: 10mm;
|
||||
text-align: left; }
|
||||
.header:after {
|
||||
content: "TDSM"; }
|
||||
|
||||
/* __________________________________ MAIN SECTION __________________________________ */
|
||||
.body {
|
||||
height: 270mm;
|
||||
width: 210mm;
|
||||
margin-bottom: 12mm;
|
||||
padding-top: 18mm;
|
||||
padding-bottom: 12mm;
|
||||
position: absolute; }
|
||||
|
||||
.recipient {
|
||||
-webkit-flow-from: myStory;
|
||||
flow-from: myStory; }
|
||||
|
||||
#my-story {
|
||||
-webkit-flow-into: myStory;
|
||||
flow-into: myStory; }
|
||||
|
||||
/* __________________________________ FOOTER __________________________________ */
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 10mm;
|
||||
text-align: center; }
|
||||
.footer:after {
|
||||
content: counter(page-counter); }
|
||||
|
||||
/* mirrored pages */
|
||||
.paper:nth-child(odd) .header {
|
||||
text-align: right; }
|
||||
|
||||
.paper:nth-child(odd) .header,
|
||||
.paper:nth-child(odd) .body,
|
||||
.paper:nth-child(odd) .footer {
|
||||
padding-left: 20mm;
|
||||
padding-right: 20mm; }
|
||||
|
||||
.paper:nth-child(even) .header,
|
||||
.paper:nth-child(even) .body,
|
||||
.paper:nth-child(even) .footer {
|
||||
padding-left: 20mm;
|
||||
padding-right: 20mm; }
|
||||
|
||||
img {
|
||||
max-width: 100%; }
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
/* Avoids headings to be cut or to be orphans.
|
||||
* But it doesn't seem to work
|
||||
* if the element after has a page-break-inside avoid. It tries its best! */
|
||||
-webkit-region-break-inside: avoid;
|
||||
break-inside: avoid;
|
||||
-webkit-region-break-after: avoid;
|
||||
break-after: avoid; }
|
||||
|
||||
/* AN EXAMPLE TO AVOID PAGE BREAK INSIDE,
|
||||
* HERE NO PARAGRAPH WILL BE CUT,
|
||||
* BUT YOU MIGHT WANT TO DEACTIVATE THIS */
|
||||
p {
|
||||
/*-webkit-region-break-inside: avoid;*/
|
||||
/* break-inside: avoid;*/ }
|
||||
|
||||
/**
|
||||
* DEBUG STYLES
|
||||
*/
|
||||
.debug .header {
|
||||
outline: 1px solid pink; }
|
||||
|
||||
.debug .body {
|
||||
outline: 1px solid purple; }
|
||||
|
||||
.debug .footer {
|
||||
outline: 1px solid pink; }
|
||||
|
||||
.debug .region-break {
|
||||
border-top: 1px dashed blue;
|
||||
box-sizing: border-box; }
|
||||
|
||||
.debug img {
|
||||
outline: 1px solid blue; }
|
||||
|
||||
/**
|
||||
* User Interface
|
||||
*/
|
||||
@media screen {
|
||||
body {
|
||||
background-color: #F0F0F0; }
|
||||
#pages {
|
||||
width: 210mm;
|
||||
height: 290mm;
|
||||
margin-left: auto;
|
||||
margin-right: auto; }
|
||||
.spread #pages {
|
||||
width: 420mm;
|
||||
height: 580mm; }
|
||||
.paper {
|
||||
/* centrer la page à l'écran */
|
||||
background-color: white;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em; }
|
||||
.normal .page {
|
||||
outline: 1px dashed lightsalmon; }
|
||||
.preview .paper {
|
||||
background: none; }
|
||||
.preview .page {
|
||||
outline: 1px solid lightgray;
|
||||
background-color: white; }
|
||||
.preview .crops {
|
||||
visibility: hidden; }
|
||||
.button {
|
||||
z-index: 1000;
|
||||
background-color: black;
|
||||
font-family: sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-size: 9pt !important;
|
||||
letter-spacing: 1pt;
|
||||
color: white;
|
||||
margin: 0;
|
||||
padding: 5pt 7pt;
|
||||
cursor: pointer;
|
||||
border: 0; }
|
||||
.button:hover {
|
||||
background-color: white;
|
||||
color: black;
|
||||
outline: 1pt solid black; }
|
||||
.button-active {
|
||||
background-color: white;
|
||||
color: black;
|
||||
outline: 1pt solid black; }
|
||||
.lo-res {
|
||||
outline: 10px solid red; }
|
||||
#interface {
|
||||
font-family: sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-size: 10pt !important;
|
||||
line-height: 14pt;
|
||||
letter-spacing: 1pt;
|
||||
position: fixed;
|
||||
bottom: 10pt;
|
||||
right: 10pt; }
|
||||
#interface a {
|
||||
text-decoration: none;
|
||||
position: static; }
|
||||
div.dropdown {
|
||||
display: inline-block;
|
||||
position: relative; }
|
||||
div.dropdown ul {
|
||||
padding: 0.5em 0;
|
||||
display: none;
|
||||
background-color: black;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 2em;
|
||||
height: 200pt;
|
||||
width: 80pt;
|
||||
overflow: auto; }
|
||||
div.dropdown ul a {
|
||||
padding: 0 1em;
|
||||
color: white;
|
||||
display: block; }
|
||||
div.dropdown ul a:hover {
|
||||
background-color: white;
|
||||
color: black; }
|
||||
div.dropdown button {
|
||||
width: 80pt; }
|
||||
#toc {
|
||||
display: inline-block; }
|
||||
#toc-pages {
|
||||
padding: 0.5em 0;
|
||||
display: none;
|
||||
background-color: black;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 2em;
|
||||
height: 200pt;
|
||||
width: 80pt;
|
||||
overflow: auto; }
|
||||
#toc-pages a {
|
||||
padding: 0 1em;
|
||||
color: white; }
|
||||
#toc-pages a:hover {
|
||||
background-color: white;
|
||||
color: black; }
|
||||
#toc-pages button {
|
||||
width: 80pt; } }
|
||||
|
||||
@media print {
|
||||
#interface {
|
||||
display: none; } }
|
||||
|
||||
</style>
|
||||
Vendored
-257
@@ -1,257 +0,0 @@
|
||||
<style type="text/css">
|
||||
/* the geometry of the page */
|
||||
/* the size of the crop marks*/
|
||||
/* the size of bleed */
|
||||
/**
|
||||
* Computation
|
||||
*/
|
||||
/* EXTRA SPACE AROUND THE PAGE: BLEED + CROP */
|
||||
/* GEOMETRY OF THE PAPER SHEET */
|
||||
/* SIZE OF SPREAD */
|
||||
/**
|
||||
* DEFINITION OF THE PAPER SHEET
|
||||
*/
|
||||
@page {
|
||||
size: 210mm 291mm;
|
||||
margin: 0; }
|
||||
|
||||
/**
|
||||
* CANVAS
|
||||
*/
|
||||
@media all {
|
||||
body {
|
||||
margin: 0; }
|
||||
.paper {
|
||||
width: 210mm;
|
||||
height: 290mm;
|
||||
box-sizing: border-box;
|
||||
counter-increment: page-counter;
|
||||
page-break-inside: avoid;
|
||||
page-break-after: always;
|
||||
overflow: hidden; }
|
||||
.page {
|
||||
width: 210mm;
|
||||
height: 290mm;
|
||||
position: relative; } }
|
||||
|
||||
@media print {
|
||||
html {
|
||||
width: 210mm; }
|
||||
body {
|
||||
/* Allows printing of background colors */
|
||||
background-color: white;
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
/* Activate opentype features and kernings */
|
||||
-webkit-font-feature-settings: "liga", "dlig", "clig", "kern";
|
||||
text-rendering: optimizeLegibility; } }
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
.page-break {
|
||||
/* Apply this class to an element to put it on a new region.
|
||||
* Hint:
|
||||
* You can also use an empty <div class="page-break"></div>
|
||||
* if you want to put manual page breaks without attaching it to an HTML element
|
||||
*/
|
||||
break-after: region; }
|
||||
|
||||
/* __________________________________ LAYOUT __________________________________ */
|
||||
.header,
|
||||
.body,
|
||||
.footer {
|
||||
box-sizing: border-box; }
|
||||
|
||||
/* __________________________________ HEADER __________________________________ */
|
||||
.header {
|
||||
top: 0;
|
||||
margin: 0;
|
||||
padding-top: 8mm;
|
||||
width: 100%;
|
||||
height: 10mm;
|
||||
text-align: left; }
|
||||
.header:after {
|
||||
content: "Ethica Lectures"; }
|
||||
|
||||
/* __________________________________ MAIN SECTION __________________________________ */
|
||||
.body {
|
||||
height: 270mm;
|
||||
width: 210mm;
|
||||
margin-bottom: 12mm;
|
||||
padding-top: 18mm;
|
||||
padding-bottom: 12mm;
|
||||
position: absolute; }
|
||||
|
||||
.recipient {
|
||||
-webkit-flow-from: contentFlow;
|
||||
flow-from: contentFlow; }
|
||||
|
||||
#content > * {
|
||||
-webkit-flow-into: contentFlow;
|
||||
flow-into: contentFlow contents; }
|
||||
|
||||
/* __________________________________ FOOTER __________________________________ */
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 10mm;
|
||||
text-align: center; }
|
||||
.footer:after {
|
||||
content: counter(page-counter); }
|
||||
|
||||
/* mirrored pages */
|
||||
.paper:nth-child(odd) .header,
|
||||
.paper:nth-child(odd) .body,
|
||||
.paper:nth-child(odd) .footer {
|
||||
padding-left: 20mm;
|
||||
padding-right: 20mm; }
|
||||
|
||||
.paper:nth-child(even) .header,
|
||||
.paper:nth-child(even) .body,
|
||||
.paper:nth-child(even) .footer {
|
||||
padding-left: 20mm;
|
||||
padding-right: 20mm; }
|
||||
|
||||
img {
|
||||
max-width: 100%; }
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
/* Avoids headings to be cut or to be orphans.
|
||||
* But it doesn't seem to work
|
||||
* if the element after has a page-break-inside avoid. It tries its best! */
|
||||
-webkit-region-break-inside: avoid;
|
||||
-webkit-region-break-after: avoid;
|
||||
break-inside: avoid;
|
||||
break-after: avoid; }
|
||||
|
||||
/* AN EXAMPLE TO AVOID PAGE BREAK INSIDE,
|
||||
* HERE NO PARAGRAPH WILL BE CUT,
|
||||
* BUT YOU MIGHT WANT TO DEACTIVATE THIS */
|
||||
p {
|
||||
/*-webkit-region-break-inside: avoid;*/ }
|
||||
|
||||
/**
|
||||
* DEBUG STYLES
|
||||
*/
|
||||
.debug .paper {
|
||||
outline: 1px solid blue; }
|
||||
|
||||
.debug .page {
|
||||
outline: 1px solid green; }
|
||||
|
||||
.debug .header {
|
||||
outline: 1px solid pink; }
|
||||
|
||||
.debug .body {
|
||||
outline: 1px solid purple; }
|
||||
|
||||
.debug .footer {
|
||||
outline: 1px solid pink; }
|
||||
|
||||
.debug .region-break {
|
||||
border-top: 1px dashed blue;
|
||||
box-sizing: border-box; }
|
||||
|
||||
.debug img {
|
||||
outline: 1px solid blue; }
|
||||
|
||||
/**
|
||||
* Style
|
||||
*/
|
||||
@media screen {
|
||||
body {
|
||||
background-color: #EEE; }
|
||||
.paper {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 10px 7px #AAA;
|
||||
margin: 20px; } }
|
||||
|
||||
h1 {
|
||||
font-family: "amiri", serif;
|
||||
font-weight: bold; }
|
||||
|
||||
h2 {
|
||||
font-family: "amiri", serif;
|
||||
font-weight: 500; }
|
||||
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: 'Open Sans', sans-serif; }
|
||||
|
||||
h1 {
|
||||
font-size: 42pt; }
|
||||
|
||||
h2 {
|
||||
font-size: 32pt; }
|
||||
|
||||
h3 {
|
||||
font-size: 14pt; }
|
||||
|
||||
h4 {
|
||||
font-size: 11pt; }
|
||||
|
||||
h5 {
|
||||
font-size: 11pt; }
|
||||
|
||||
h6 {
|
||||
font-size: 11pt; }
|
||||
|
||||
h2 {
|
||||
margin: 0.2em 0 0.4em 0; }
|
||||
|
||||
p, table, li, figcaption {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 10pt; }
|
||||
|
||||
figure {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 4mm 0 0; }
|
||||
figure img {
|
||||
border: 1px solid #ccc; }
|
||||
figure figcaption {
|
||||
font-size: 8pt; }
|
||||
|
||||
img[alt="logo"] {
|
||||
max-height: 0.9cm;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin: 5mm 5mm 0 0; }
|
||||
img[alt="logo"] + br {
|
||||
display: none; }
|
||||
|
||||
img[alt~="visuel"] {
|
||||
margin: 0 4mm 0 0; }
|
||||
img[alt~="visuel"] + figcaption {
|
||||
display: none; }
|
||||
img[alt~="visuel"]:not([alt~="full"]) {
|
||||
max-height: 6.5cm; }
|
||||
img[alt~="visuel"][alt~="full"] {
|
||||
max-width: 85%; }
|
||||
|
||||
a {
|
||||
color: inherit; }
|
||||
|
||||
.header:after {
|
||||
font-family: "amiri", serif;
|
||||
font-weight: normal;
|
||||
font-size: 9pt; }
|
||||
|
||||
.footer {
|
||||
text-align: left; }
|
||||
.footer:after {
|
||||
font-family: "amiri", serif;
|
||||
font-weight: bold;
|
||||
font-size: 10pt; }
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,70 @@
|
||||
#viewport {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 25px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
background-color: black;
|
||||
position: fixed;
|
||||
height: 25px;
|
||||
bottom: 0em;
|
||||
left: 0;
|
||||
right: 0;
|
||||
color: white;
|
||||
font-family: sans;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
padding: 3px 0;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
align-items: center;
|
||||
-webkit-align-items: center;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-left: 1.5em;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
input {
|
||||
border: 1px solid white;
|
||||
background-color: white;
|
||||
font-size: 11px;
|
||||
vertical-align: -2px;
|
||||
}
|
||||
input[type=number]{
|
||||
width: 50px;
|
||||
vertical-align: 0px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
input:hover {
|
||||
cursor: pointer;
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
button {
|
||||
border: 1px solid white;
|
||||
background-color: white;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
margin-right: 1em;
|
||||
height: 19px;
|
||||
}
|
||||
button:hover {
|
||||
cursor: pointer;
|
||||
background-color: yellow;
|
||||
}
|
||||
.separator {
|
||||
content: " ";
|
||||
flex-grow: 2;
|
||||
-webkit-flex-grow: 2;
|
||||
}
|
||||
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* Computation
|
||||
*/
|
||||
|
||||
|
||||
/* EXTRA SPACE AROUND THE PAGE: BLEED + CROP */
|
||||
// TODO: find a more appropriate name
|
||||
$crop: $crop-size + $bleed;
|
||||
|
||||
/* GEOMETRY OF THE PAPER SHEET */
|
||||
$paper-width: $page-width + ( $crop * 2 );
|
||||
$paper-height: $page-height + ( $crop * 2 );
|
||||
|
||||
/* SIZE OF SPREAD */
|
||||
$spread: $page-width * 2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* DEFINITION OF THE PAPER SHEET
|
||||
*/
|
||||
@page {
|
||||
size: $paper-width ($paper-height + 1);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CANVAS
|
||||
*/
|
||||
|
||||
@media all {
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
.paper {
|
||||
width: $paper-width;
|
||||
height: $paper-height;
|
||||
box-sizing: border-box;
|
||||
|
||||
counter-increment: page-counter;
|
||||
|
||||
// To make sure that one paper sheet is not splitted into different pages in the PDF
|
||||
page-break-inside: avoid;
|
||||
page-break-after: always;
|
||||
overflow: hidden;
|
||||
|
||||
/* Crop marks */
|
||||
padding: $crop;
|
||||
position: relative;
|
||||
.crops {
|
||||
width: $paper-width;
|
||||
height: $paper-height;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
div {
|
||||
border-style: solid;
|
||||
border-color: black;
|
||||
border-width: 0;
|
||||
width: $crop;
|
||||
height: $crop;
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
|
||||
span {
|
||||
width: $bleed;
|
||||
height: $bleed;
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
.crop-top-left {
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
span { right: -1px; bottom: -1px;}
|
||||
}
|
||||
.crop-top-right {
|
||||
border-left-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
||||
span { left: -1px; bottom: -1px;}
|
||||
}
|
||||
.crop-bottom-right {
|
||||
border-left-width: 1px;
|
||||
border-top-width: 1px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
span { left: -1px; top: -1px;}
|
||||
}
|
||||
.crop-bottom-left {
|
||||
border-right-width: 1px;
|
||||
border-top-width: 1px;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
|
||||
span { right: -1px; top: -1px;}
|
||||
}
|
||||
}
|
||||
}
|
||||
.page {
|
||||
width: $page-width;
|
||||
height: $page-height;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// TODO: changer le format du papier en spread pour pouvoir imprimer en planche
|
||||
.spread {
|
||||
.paper {
|
||||
float: left;
|
||||
}
|
||||
.paper:nth-child(odd) {
|
||||
margin-left: -$crop;
|
||||
}
|
||||
.paper:nth-child(even) {
|
||||
margin-right: -$crop;
|
||||
}
|
||||
.paper:first-child {
|
||||
margin-left: $page-width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
html {
|
||||
width: $paper-width;
|
||||
}
|
||||
body {
|
||||
/* Allows printing of background colors */
|
||||
background-color: white;
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
/* Activate opentype features and kernings */
|
||||
-webkit-font-feature-settings: "liga", "dlig", "clig", "kern";
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
.region-break {
|
||||
/* Apply this class to an element to put it on a new region.
|
||||
* Hint:
|
||||
* You can also use an empty <div class="page-break"></div>
|
||||
* if you want to put manual page breaks without attaching it to an HTML element
|
||||
*/
|
||||
-webkit-region-break-before: always;
|
||||
break-before: always;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
.header,
|
||||
.body,
|
||||
.footer {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* __________________________________ HEADER __________________________________ */
|
||||
.header {
|
||||
top: 0;
|
||||
margin: 0;
|
||||
padding-top: $page-margin-top;
|
||||
width: 100%;
|
||||
height: $header-height;
|
||||
text-align: left;
|
||||
|
||||
&:after {
|
||||
content: $header-text;
|
||||
}
|
||||
}
|
||||
/* __________________________________ MAIN SECTION __________________________________ */
|
||||
.body {
|
||||
height: $page-height - $header-height - $footer-height;
|
||||
width: $page-width;
|
||||
margin-bottom: $page-margin-bottom;
|
||||
padding-top: $page-margin-top + $header-height;
|
||||
padding-bottom: $page-margin-bottom;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.recipient {
|
||||
-webkit-flow-from: myStory;
|
||||
flow-from: myStory;
|
||||
}
|
||||
|
||||
#my-story {
|
||||
-webkit-flow-into: myStory;
|
||||
flow-into: myStory;
|
||||
}
|
||||
/* __________________________________ FOOTER __________________________________ */
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: $footer-height;
|
||||
text-align: center;
|
||||
|
||||
&:after {
|
||||
content: $footer-text;
|
||||
}
|
||||
}
|
||||
|
||||
/* mirrored pages */
|
||||
.paper {
|
||||
&:nth-child(odd) .header {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&:nth-child(odd) .header,
|
||||
&:nth-child(odd) .body,
|
||||
&:nth-child(odd) .footer {
|
||||
padding-left: $page-margin-inside;
|
||||
padding-right: $page-margin-outside;
|
||||
}
|
||||
&:nth-child(even) .header,
|
||||
&:nth-child(even) .body,
|
||||
&:nth-child(even) .footer {
|
||||
padding-left: $page-margin-outside;
|
||||
padding-right: $page-margin-inside;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
/* Avoids headings to be cut or to be orphans.
|
||||
* But it doesn't seem to work
|
||||
* if the element after has a page-break-inside avoid. It tries its best! */
|
||||
-webkit-region-break-inside: avoid;
|
||||
break-inside: avoid;
|
||||
-webkit-region-break-after: avoid;
|
||||
break-after: avoid;
|
||||
}
|
||||
|
||||
/* AN EXAMPLE TO AVOID PAGE BREAK INSIDE,
|
||||
* HERE NO PARAGRAPH WILL BE CUT,
|
||||
* BUT YOU MIGHT WANT TO DEACTIVATE THIS */
|
||||
p {
|
||||
/*-webkit-region-break-inside: avoid;*/
|
||||
/* break-inside: avoid;*/
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@import "setup.scss";
|
||||
@import "html2print.scss";
|
||||
@import "layout.scss";
|
||||
@import "debug.scss";
|
||||
@import "ui.scss";
|
||||
@import "styles.scss";
|
||||
@@ -20,6 +20,6 @@ $page-margin-bottom: 12mm;
|
||||
|
||||
// Header & footer variables
|
||||
$header-height: 10mm;
|
||||
$header-text: "Ethica Lectures";
|
||||
$header-text: "TDSM";
|
||||
$footer-height: 10mm;
|
||||
$footer-text: counter(page-counter);
|
||||
|
||||
+1
-245
@@ -1,245 +1 @@
|
||||
@import "setup.scss";
|
||||
|
||||
/**
|
||||
* Computation
|
||||
*/
|
||||
|
||||
|
||||
/* EXTRA SPACE AROUND THE PAGE: BLEED + CROP */
|
||||
// TODO: find a more appropriate name
|
||||
$crop: $crop-size + $bleed;
|
||||
|
||||
/* GEOMETRY OF THE PAPER SHEET */
|
||||
$paper-width: $page-width + ( $crop * 2 );
|
||||
$paper-height: $page-height + ( $crop * 2 );
|
||||
|
||||
/* SIZE OF SPREAD */
|
||||
$spread: $page-width * 2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* DEFINITION OF THE PAPER SHEET
|
||||
*/
|
||||
@page {
|
||||
size: $paper-width ($paper-height + 1);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CANVAS
|
||||
*/
|
||||
|
||||
@media all {
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
.paper {
|
||||
width: $paper-width;
|
||||
height: $paper-height;
|
||||
box-sizing: border-box;
|
||||
|
||||
counter-increment: page-counter;
|
||||
|
||||
// To make sure that one paper sheet is not splitted into different pages in the PDF
|
||||
page-break-inside: avoid;
|
||||
page-break-after: always;
|
||||
overflow: hidden;
|
||||
|
||||
|
||||
}
|
||||
.page {
|
||||
width: $page-width;
|
||||
height: $page-height;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media print {
|
||||
html {
|
||||
width: $paper-width;
|
||||
}
|
||||
body {
|
||||
/* Allows printing of background colors */
|
||||
background-color: white;
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
/* Activate opentype features and kernings */
|
||||
-webkit-font-feature-settings: "liga", "dlig", "clig", "kern";
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
.page-break {
|
||||
/* Apply this class to an element to put it on a new region.
|
||||
* Hint:
|
||||
* You can also use an empty <div class="page-break"></div>
|
||||
* if you want to put manual page breaks without attaching it to an HTML element
|
||||
*/
|
||||
// -webkit-region-break-before: always;
|
||||
break-after: region;
|
||||
}
|
||||
|
||||
// section.level1, section.level2{
|
||||
// break-after: always;
|
||||
// }
|
||||
|
||||
/* __________________________________ LAYOUT __________________________________ */
|
||||
|
||||
.header,
|
||||
.body,
|
||||
.footer {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* __________________________________ HEADER __________________________________ */
|
||||
.header {
|
||||
top: 0;
|
||||
margin: 0;
|
||||
padding-top: $page-margin-top;
|
||||
width: 100%;
|
||||
height: $header-height;
|
||||
text-align: left;
|
||||
|
||||
&:after {
|
||||
content: $header-text;
|
||||
}
|
||||
}
|
||||
/* __________________________________ MAIN SECTION __________________________________ */
|
||||
.body {
|
||||
height: $page-height - $header-height - $footer-height;
|
||||
width: $page-width;
|
||||
margin-bottom: $page-margin-bottom;
|
||||
padding-top: $page-margin-top + $header-height;
|
||||
padding-bottom: $page-margin-bottom;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.recipient {
|
||||
-webkit-flow-from: contentFlow;
|
||||
flow-from: contentFlow;
|
||||
}
|
||||
|
||||
#content > * {
|
||||
-webkit-flow-into: contentFlow;
|
||||
flow-into: contentFlow contents;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* __________________________________ FOOTER __________________________________ */
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: $footer-height;
|
||||
text-align: center;
|
||||
|
||||
&:after {
|
||||
content: $footer-text;
|
||||
}
|
||||
}
|
||||
|
||||
/* mirrored pages */
|
||||
.paper {
|
||||
|
||||
&:nth-child(odd) .header {
|
||||
@if $page-layout == 2 {text-align: right;}
|
||||
}
|
||||
|
||||
&:nth-child(odd) .header,
|
||||
&:nth-child(odd) .body,
|
||||
&:nth-child(odd) .footer {
|
||||
padding-left: $page-margin-inside;
|
||||
padding-right: $page-margin-outside;
|
||||
}
|
||||
&:nth-child(even) .header,
|
||||
&:nth-child(even) .body,
|
||||
&:nth-child(even) .footer {
|
||||
padding-left: $page-margin-outside;
|
||||
padding-right: $page-margin-inside;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
/* Avoids headings to be cut or to be orphans.
|
||||
* But it doesn't seem to work
|
||||
* if the element after has a page-break-inside avoid. It tries its best! */
|
||||
-webkit-region-break-inside: avoid;
|
||||
-webkit-region-break-after: avoid;
|
||||
break-inside: avoid;
|
||||
break-after: avoid;
|
||||
}
|
||||
|
||||
/* AN EXAMPLE TO AVOID PAGE BREAK INSIDE,
|
||||
* HERE NO PARAGRAPH WILL BE CUT,
|
||||
* BUT YOU MIGHT WANT TO DEACTIVATE THIS */
|
||||
p {
|
||||
/*-webkit-region-break-inside: avoid;*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DEBUG STYLES
|
||||
*/
|
||||
.debug .paper {
|
||||
outline: 1px solid blue;
|
||||
}
|
||||
.debug .page {
|
||||
outline: 1px solid green;
|
||||
}
|
||||
.debug .header {
|
||||
outline: 1px solid pink;
|
||||
}
|
||||
.debug .body {
|
||||
outline: 1px solid purple;
|
||||
}
|
||||
.debug .footer {
|
||||
outline: 1px solid pink;
|
||||
}
|
||||
|
||||
.debug .region-break {
|
||||
border-top: 1px dashed blue;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.debug img {
|
||||
outline: 1px solid blue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Style
|
||||
*/
|
||||
|
||||
@media screen{
|
||||
body{
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
.paper{
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 10px 7px #AAA;
|
||||
margin: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@import "custom.scss";
|
||||
// your styles here
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* User Interface
|
||||
*/
|
||||
@media screen {
|
||||
// C A N V A S
|
||||
body {
|
||||
background-color: #F0F0F0;
|
||||
}
|
||||
#pages {
|
||||
width: $paper-width;
|
||||
height: $paper-height;
|
||||
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.spread #pages {
|
||||
width: $paper-width * 2;
|
||||
height: $paper-height * 2;
|
||||
}
|
||||
.paper {
|
||||
/* centrer la page à l'écran */
|
||||
background-color: white;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.normal .paper {
|
||||
//outline: 1px solid lightgray;
|
||||
}
|
||||
.normal .page {
|
||||
outline: 1px dashed lightsalmon;
|
||||
}
|
||||
.preview .paper {
|
||||
background: none;
|
||||
}
|
||||
.preview .page {
|
||||
outline: 1px solid lightgray;
|
||||
background-color: white;
|
||||
}
|
||||
.preview .crops { visibility: hidden; }
|
||||
|
||||
|
||||
|
||||
// M E N U
|
||||
.button {
|
||||
z-index: 1000;
|
||||
background-color: black;
|
||||
font-family: sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-size: 9pt !important;
|
||||
letter-spacing: 1pt;
|
||||
color: white;
|
||||
margin: 0;
|
||||
padding: 5pt 7pt;
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
}
|
||||
.button:hover {
|
||||
background-color: white;
|
||||
color: black;
|
||||
outline: 1pt solid black;
|
||||
}
|
||||
.button-active {
|
||||
background-color: white;
|
||||
color: black;
|
||||
outline: 1pt solid black;
|
||||
}
|
||||
.lo-res {
|
||||
outline: 10px solid red;
|
||||
}
|
||||
#interface {
|
||||
font-family: sans-serif;
|
||||
text-transform: uppercase;
|
||||
font-size: 10pt !important;
|
||||
line-height: 14pt;
|
||||
letter-spacing: 1pt;
|
||||
position: fixed;
|
||||
bottom: 10pt;
|
||||
right: 10pt;
|
||||
}
|
||||
|
||||
#interface a {
|
||||
text-decoration: none;
|
||||
position: static;
|
||||
}
|
||||
|
||||
|
||||
div.dropdown {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
|
||||
ul {
|
||||
padding: 0.5em 0;
|
||||
display: none;
|
||||
background-color: black;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 2em;
|
||||
height: 200pt;
|
||||
width: 80pt;
|
||||
overflow: auto;
|
||||
|
||||
a {
|
||||
padding: 0 1em;
|
||||
color: white;
|
||||
display: block;
|
||||
|
||||
&:hover {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
}
|
||||
button {
|
||||
width: 80pt;
|
||||
}
|
||||
}
|
||||
|
||||
#toc {
|
||||
display: inline-block;
|
||||
}
|
||||
#toc-pages {
|
||||
padding: 0.5em 0;
|
||||
display: none;
|
||||
background-color: black;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 2em;
|
||||
height: 200pt;
|
||||
width: 80pt;
|
||||
overflow: auto;
|
||||
}
|
||||
#toc-pages a {
|
||||
padding: 0 1em;
|
||||
color: white;
|
||||
}
|
||||
#toc-pages a:hover {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
#toc-pages button {
|
||||
width: 80pt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media print {
|
||||
#interface {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
$(function() {
|
||||
|
||||
$.getJSON('build/toc.json', function(data){
|
||||
// console.log(data);
|
||||
for (book of data) {
|
||||
// console.log(book);
|
||||
var $optgroup = $('<optgroup>').attr('label', book.label);
|
||||
for (page of book.pages) {
|
||||
// console.log(page);
|
||||
$optgroup.append($('<option>').attr('value', book.label+'/'+page.file).text(book.label+' : '+page.label));
|
||||
}
|
||||
$('[name="document"]').append($optgroup);
|
||||
}
|
||||
})
|
||||
|
||||
$('select[name="document"]').change(function(e){
|
||||
// console.log(e);
|
||||
// var optionSelected = $("option:selected", this);
|
||||
// var valueSelected = ;
|
||||
console.log(this.value);
|
||||
$('iframe').attr('src', 'build/'+this.value);
|
||||
});
|
||||
|
||||
// activate toolbar events when iframe is loaded
|
||||
$('iframe').load(function() {
|
||||
var doc = $("iframe").contents().find("html");
|
||||
|
||||
$('[name="preview"]').change(function() {
|
||||
if($(this).is(":checked")) {
|
||||
doc.addClass("preview");
|
||||
doc.removeClass("normal");
|
||||
} else {
|
||||
doc.removeClass("preview");
|
||||
doc.addClass("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$('[name="debug"]').change(function() {
|
||||
if($(this).is(":checked")) {
|
||||
doc.addClass("debug");
|
||||
} else {
|
||||
doc.removeClass("debug");
|
||||
}
|
||||
});
|
||||
|
||||
$('[name="spread"]').change(function() {
|
||||
if($(this).is(":checked")) {
|
||||
doc.addClass("spread");
|
||||
} else {
|
||||
doc.removeClass("spread");
|
||||
}
|
||||
});
|
||||
|
||||
//$('[name="hi-res"]').change(function() {
|
||||
//if($(this).is(":checked")) {
|
||||
//doc.addClass("export");
|
||||
//} else {
|
||||
//doc.removeClass("export");
|
||||
//}
|
||||
//});
|
||||
|
||||
$('[name="zoom"]').change(function() {
|
||||
zoomLevel = $(this).val() / 100;
|
||||
|
||||
doc.find("#pages").css({
|
||||
"-webkit-transform": "scale(" + zoomLevel + ")",
|
||||
"-webkit-transform-origin": "0 0"
|
||||
});
|
||||
});
|
||||
|
||||
//$(".paper").each(function(){
|
||||
//page = $(this).attr("id");
|
||||
//$("#toc-pages").append("<li><a href='#" + page + "'>" + page.replace("-", " ") + "</a></li>")
|
||||
//});
|
||||
|
||||
$('[name="page"]').change(function() {
|
||||
var pageNumber = $(this).val() - 1;
|
||||
|
||||
var target = doc.find('.paper:eq(' + pageNumber + ')');
|
||||
var offsetTop = target.offset().top;
|
||||
|
||||
doc.find('body').scrollTop(offsetTop);
|
||||
});
|
||||
|
||||
$("#print").on('click', function() {
|
||||
$("iframe").get(0).contentWindow.print();
|
||||
});
|
||||
});
|
||||
|
||||
//// __________________________________ HIGH RESOLUTION __________________________________ //
|
||||
//$("#hi-res").click(function(e){
|
||||
//e.preventDefault();
|
||||
//$(this).toggleClass("button-active");
|
||||
//$("html").toggleClass("export");
|
||||
//$("img").each(function(){
|
||||
//var hires = $(this).attr("data-alt-src");
|
||||
//var lores = $(this).attr("src");
|
||||
//$(this).attr("data-alt-src", lores)
|
||||
//$(this).attr("src", hires)
|
||||
//});
|
||||
//console.log("Wait for hi-res images to load");
|
||||
//window.setTimeout(function(){
|
||||
//console.log("Check image resolution");
|
||||
//// Redlights images too small for printing
|
||||
//$("img").each(function(){
|
||||
//if (Math.ceil(this.naturalHeight / $(this).height()) < 3) {
|
||||
//console.log($(this).attr("src") + ": " + Math.floor(this.naturalHeight / $(this).height()) );
|
||||
//if($(this).parent().hasClass("moveable")) {
|
||||
//$(this).parent().toggleClass("lo-res");
|
||||
//} else {
|
||||
//$(this).toggleClass("lo-res");
|
||||
//}
|
||||
//}
|
||||
//});
|
||||
//}, 2000);
|
||||
//});
|
||||
|
||||
|
||||
});
|
||||
|
||||
//(function($) {
|
||||
//'use strict';
|
||||
|
||||
//$('iframe')[0].addEventListener("load", function(event) {
|
||||
//console.log(arguments);
|
||||
//}, false);
|
||||
//})(document.querySelectorAll.bind(document));
|
||||
@@ -0,0 +1,106 @@
|
||||
// html2print needs CSS regions
|
||||
// load a ‘polyfill’ if the browser does not support it
|
||||
if (window.chrome) {
|
||||
console.log('running chrome, no support for css regions; loading the polyfill');
|
||||
var script = document.createElement('script');
|
||||
script.setAttribute('src', 'assets/lib/css-regions.min.js');
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
};
|
||||
|
||||
$(function() {
|
||||
// ________________________________ INIT __________________________________ //
|
||||
// Creating crop marks
|
||||
$("#master-page").append("<div class='crops'><div class='crop-top-left'><span class='bleed'></span></div><div class='crop-top-right'><span class='bleed'></span></div><div class='crop-bottom-right'><span class='bleed'></span></div><div class='crop-bottom-left'><span class='bleed'></span></div></div>")
|
||||
|
||||
// Cloning the master page
|
||||
for (i = 1; i < nb_page; i++){
|
||||
$("#master-page").clone().attr("id","page-"+i).insertBefore($("#master-page"));
|
||||
}
|
||||
$("#master-page").attr("data-width", $(".paper:first-child").width()).hide();
|
||||
|
||||
// Loads main content into <article id="my-story">
|
||||
// if (content) {
|
||||
// $("#my-story").load(content);
|
||||
// }
|
||||
|
||||
|
||||
// ________________________________ PREVIEW __________________________________ //
|
||||
$("#preview").click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).toggleClass("button-active");
|
||||
$("html").toggleClass("preview normal");
|
||||
});
|
||||
|
||||
// __________________________________ DEBUG __________________________________ //
|
||||
$("#debug").click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).toggleClass("button-active");
|
||||
$("html").toggleClass("debug");
|
||||
});
|
||||
|
||||
// __________________________________ SPREAD __________________________________ //
|
||||
$("#spread").click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).toggleClass("button-active");
|
||||
$("body").toggleClass("spread");
|
||||
});
|
||||
|
||||
// __________________________________ HIGH RESOLUTION __________________________________ //
|
||||
$("#hi-res").click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).toggleClass("button-active");
|
||||
$("html").toggleClass("export");
|
||||
$("img").each(function(){
|
||||
var hires = $(this).attr("data-alt-src");
|
||||
var lores = $(this).attr("src");
|
||||
$(this).attr("data-alt-src", lores)
|
||||
$(this).attr("src", hires)
|
||||
});
|
||||
console.log("Wait for hi-res images to load");
|
||||
window.setTimeout(function(){
|
||||
console.log("Check image resolution");
|
||||
// Redlights images too small for printing
|
||||
$("img").each(function(){
|
||||
if (Math.ceil(this.naturalHeight / $(this).height()) < 3) {
|
||||
console.log($(this).attr("src") + ": " + Math.floor(this.naturalHeight / $(this).height()) );
|
||||
if($(this).parent().hasClass("moveable")) {
|
||||
$(this).parent().toggleClass("lo-res");
|
||||
} else {
|
||||
$(this).toggleClass("lo-res");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
|
||||
// __________________________________ TOC __________________________________ //
|
||||
$(".paper").each(function(){
|
||||
page = $(this).attr("id");
|
||||
$("#toc-pages").append("<li><a href='#" + page + "'>" + page.replace("-", " ") + "</a></li>")
|
||||
});
|
||||
|
||||
$("#goto").click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).toggleClass("button-active");
|
||||
$("#toc-pages").toggle();
|
||||
});
|
||||
|
||||
|
||||
// __________________________________ ZOOM __________________________________ //
|
||||
$("#zoom").click(function(e){
|
||||
e.preventDefault();
|
||||
$(this).toggleClass("button-active");
|
||||
$("#zoom-list").toggle();
|
||||
});
|
||||
$("#zoom-list a").click(function(e){
|
||||
e.preventDefault();
|
||||
zoom = $(this).attr("title") / 100 ;
|
||||
unzoom = 1 / zoom;
|
||||
$("#pages").css("-webkit-transform", "scale(" + zoom + ")");
|
||||
$("#pages").css("-webkit-transform-origin", "0 0");
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -1,23 +0,0 @@
|
||||
// ________________________________ SETUP __________________________________ //
|
||||
|
||||
|
||||
var nb_page = 15;
|
||||
var cropmarks = false;
|
||||
var debug = false;
|
||||
|
||||
// ________________________________ INIT __________________________________ //
|
||||
// Creating crop marks
|
||||
if(cropmarks){
|
||||
$("#master-page").append("<div class='crops'><div class='crop-top-left'><span class='bleed'></span></div><div class='crop-top-right'><span class='bleed'></span></div><div class='crop-bottom-right'><span class='bleed'></span></div><div class='crop-bottom-left'><span class='bleed'></span></div></div>")
|
||||
}
|
||||
|
||||
// Cloning the master page
|
||||
for (i = 1; i <= nb_page; i++){
|
||||
console.log('page',i);
|
||||
$("#master-page").clone().attr("id","page-"+i).insertBefore($("#master-page"));
|
||||
}
|
||||
$("#master-page").attr("data-width", $(".paper:first-child").width()).hide();
|
||||
|
||||
if (debug) {
|
||||
$('body').addClass("debug");
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,6 +1,3 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
nb_page = 5;
|
||||
cropmarks = false;
|
||||
|
||||
</script>
|
||||
cropmarks = true;
|
||||
|
||||
+51
-22
@@ -1,6 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# @Author: Bachir Soussi Chiadmi <bach>
|
||||
# @Date: 27-03-2017
|
||||
# @Email: bachir@figureslibres.io
|
||||
# @Last modified by: bach
|
||||
# @Last modified time: 21-04-2017
|
||||
# @License: GPL-V3
|
||||
|
||||
|
||||
import sys, os
|
||||
import shutil
|
||||
import markdown
|
||||
@@ -10,23 +19,25 @@ import pypandoc
|
||||
import json
|
||||
import re
|
||||
|
||||
# import json
|
||||
# import getopt
|
||||
# import urllib
|
||||
|
||||
BOOKS_SRC = 'book-src'
|
||||
BUILD_d = "build"
|
||||
CUR_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
_TOC = []
|
||||
|
||||
def main():
|
||||
print("Building books")
|
||||
if not os.path.isdir(BUILD_d):
|
||||
os.mkdir(BUILD_d)
|
||||
|
||||
# loop through books sources
|
||||
for book in os.listdir(BOOKS_SRC):
|
||||
if os.path.isdir(os.path.join(BOOKS_SRC, book)):
|
||||
# print(book)
|
||||
parse_book(book)
|
||||
|
||||
with open(BUILD_d+'/toc.json', 'w') as fp:
|
||||
json.dump(_TOC, fp, ensure_ascii=False, indent="\t")
|
||||
|
||||
|
||||
def parse_book(book):
|
||||
book_name = book.replace('.git', '')
|
||||
@@ -34,12 +45,6 @@ def parse_book(book):
|
||||
print(book_name)
|
||||
print("- - -")
|
||||
|
||||
# build destination
|
||||
book_build_d = os.path.join(BUILD_d,book_name)
|
||||
if os.path.isdir(book_build_d):
|
||||
shutil.rmtree(book_build_d, ignore_errors=True)
|
||||
os.mkdir(book_build_d)
|
||||
|
||||
# table of content (ordered list of markdown files)
|
||||
sum_p = os.path.join(BOOKS_SRC, book, "SUMMARY.md")
|
||||
if not os.path.isfile(sum_p):
|
||||
@@ -49,14 +54,18 @@ def parse_book(book):
|
||||
sum_f = open(sum_p)
|
||||
sum_str = sum_f.read()
|
||||
# print(sum_str)
|
||||
# convert md to html
|
||||
sum_html = markdown.markdown(sum_str)
|
||||
# print(sum_html)
|
||||
# create dom from html string (as it will be parsable)
|
||||
sum_dom = BeautifulSoup(sum_html, 'html.parser')
|
||||
# print(sum_dom)
|
||||
# parse html dom to get file list in the right order
|
||||
toc = parse_summary(sum_dom.ul, {})
|
||||
# print(toc)
|
||||
|
||||
generate_html(book, toc, book_build_d)
|
||||
# generate final html build for html2print
|
||||
generate_html(book, toc, book_name)
|
||||
|
||||
def parse_summary(ul, toc):
|
||||
i=0
|
||||
@@ -75,21 +84,37 @@ def parse_summary(ul, toc):
|
||||
|
||||
return toc
|
||||
|
||||
def generate_html(book, toc, book_build_d):
|
||||
railway = []
|
||||
def generate_html(book, toc, book_name):
|
||||
|
||||
|
||||
# build destination
|
||||
book_build_d = os.path.join(BUILD_d,book_name)
|
||||
if os.path.isdir(book_build_d):
|
||||
shutil.rmtree(book_build_d, ignore_errors=True)
|
||||
os.mkdir(book_build_d)
|
||||
|
||||
book_toc = {
|
||||
'label':book_name,
|
||||
'pages':[]
|
||||
}
|
||||
|
||||
for p in toc:
|
||||
# print(toc[p]['file'])
|
||||
# generate html with pandoc
|
||||
|
||||
# files
|
||||
md_f = toc[p]['file']
|
||||
in_f = os.path.join(BOOKS_SRC, book, md_f)
|
||||
if not os.path.isfile(in_f):
|
||||
print("Source path is not a file, can't generate html : "+in_f)
|
||||
continue
|
||||
# print('in_f : '+in_f)
|
||||
|
||||
html_f = md_f.replace('.md', '.html')
|
||||
html_f = html_f.replace('README', 'index')
|
||||
html_f = html_f.replace('/', '-')
|
||||
in_f = os.path.join(BOOKS_SRC, book, md_f)
|
||||
# print(in_f)
|
||||
out_f = os.path.join(book_build_d,html_f)
|
||||
# print(out_f)
|
||||
# print('out_f : '+out_f)
|
||||
|
||||
# pandoc options
|
||||
# filters = []
|
||||
@@ -97,11 +122,13 @@ def generate_html(book, toc, book_build_d):
|
||||
pdoc_args = ['-s',
|
||||
'--mathjax',
|
||||
'--smart',
|
||||
'--css=assets/fonts/amiri/amiri.css',
|
||||
'--css=assets/css/dist/styles.css',
|
||||
'--css=../../assets/fonts/amiri/amiri.css',
|
||||
'--css=../../assets/css/dist/main.css',
|
||||
'--include-before-body=templates/top.tpl.html',
|
||||
'--include-after-body=templates/bot.tpl.html',
|
||||
'--include-after-body=assets/js/jquery.min.js',
|
||||
'--include-after-body=assets/lib/jquery.min.js',
|
||||
'--include-after-body=assets/js/setup.js',
|
||||
'--include-after-body=assets/js/html2print.js',
|
||||
'--include-after-body=assets/js/script.js',
|
||||
'--include-after-body=templates/end.tpl.html']
|
||||
|
||||
@@ -115,11 +142,13 @@ def generate_html(book, toc, book_build_d):
|
||||
outputfile=out_f)
|
||||
|
||||
# save reference in railway
|
||||
railway.append({'label':toc[p]['label'], 'file':html_f})
|
||||
book_toc['pages'].append({'label':toc[p]['label'], 'file':html_f})
|
||||
|
||||
global _TOC
|
||||
_TOC.append(book_toc)
|
||||
# save railway as json file
|
||||
with open(book_build_d+'/railway.json', 'w') as fp:
|
||||
json.dump(railway, fp, ensure_ascii=False, indent="\t")
|
||||
# with open(book_build_d+'/railway.json', 'w') as fp:
|
||||
# json.dump(railway, fp, ensure_ascii=False, indent="\t")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# @Author: Bachir Soussi Chiadmi <bach>
|
||||
# @Date: 26-03-2017
|
||||
# @Email: bachir@figureslibres.io
|
||||
# @Last modified by: bach
|
||||
# @Last modified time: 21-04-2017
|
||||
# @License: GPL-V3
|
||||
|
||||
|
||||
echo "Sync books"
|
||||
|
||||
# activate credential cache
|
||||
|
||||
+10
-2
@@ -8,18 +8,26 @@ var shell = require('gulp-shell')
|
||||
var watch = require('gulp-watch');
|
||||
|
||||
gulp.task('scss', function () {
|
||||
gulp.src('./assets/css/styles.scss')
|
||||
gulp.src('./assets/css/main.scss')
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(wrap('<style type="text/css">\n<%= contents %>\n</style>'))
|
||||
.pipe(gulp.dest('./assets/css/dist'));
|
||||
});
|
||||
|
||||
gulp.task('gui', function () {
|
||||
gulp.src('./assets/css/gui.scss')
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
// .pipe(wrap('<style type="text/css">\n<%= contents %>\n</style>'))
|
||||
.pipe(gulp.dest('./assets/css/dist'));
|
||||
});
|
||||
|
||||
gulp.task('build', shell.task([
|
||||
'./bin/build.py'
|
||||
]));
|
||||
|
||||
// default gulp task
|
||||
gulp.task('default', ['scss'], function() {
|
||||
gulp.task('default', ['scss', 'gui'], function() {
|
||||
gulp.watch('./assets/css/**/*.scss', ['scss']);
|
||||
gulp.watch('./assets/css/gui.scss', ['gui']);
|
||||
gulp.watch(['bin/build.py', './assets/css/**/*.scss', './assets/js/**/*.js', './templates/*.tpl.html'], ['build']);
|
||||
});
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en" class="normal">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>HTML2print</title>
|
||||
|
||||
<link rel="stylesheet" href="/assets/css/dist/gui.css" media="screen">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="viewport">
|
||||
<iframe src=""></iframe>
|
||||
</div>
|
||||
|
||||
<div id="toolbar">
|
||||
<label for="preview">preview</label>
|
||||
<input name="preview" value="true" type="checkbox">
|
||||
|
||||
<label for="debug">debug</label>
|
||||
<input name="debug" value="true" type="checkbox">
|
||||
|
||||
<label for="spread">spread</label>
|
||||
<input name="spread" value="true" type="checkbox">
|
||||
|
||||
<label for="hi-res">hi-res</label>
|
||||
<input name="hi-res" value="true" type="checkbox">
|
||||
|
||||
<label for="zoom">zoom</label>
|
||||
<input name="zoom" value="100" type="number" min="25" max="1600" step="25">
|
||||
|
||||
<label for="document">document</label>
|
||||
<select name="document"></select>
|
||||
|
||||
<label for="page">page</label>
|
||||
<input name="page" value="1" type="number" min="1" max="100" step="1">
|
||||
|
||||
<div class="separator"></div>
|
||||
|
||||
<button id="print">print</button>
|
||||
</div>
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script type="text/javascript" src="/assets/lib/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/assets/js/gui.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
|
||||
DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
cd $DIR
|
||||
|
||||
python -m http.server
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
</div>
|
||||
<!-- // my-story -->
|
||||
</div>
|
||||
<!-- // content -->
|
||||
<!-- // stories -->
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
<div id="pages">
|
||||
<div id="master-page" class="paper">
|
||||
<div class="page">
|
||||
<section class="header">
|
||||
</section>
|
||||
|
||||
<section class="body recipient">
|
||||
</section>
|
||||
|
||||
<section class="footer">
|
||||
</section>
|
||||
<section class="header"></section>
|
||||
<section class="body recipient"></section>
|
||||
<section class="footer"></section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="stories">
|
||||
<div id="my-story">
|
||||
|
||||
Reference in New Issue
Block a user