Commit 6bbbd58f authored by sarah's avatar sarah

merge

parents 9ca5bc16 df363a7f
......@@ -16,12 +16,12 @@
@I-2-6: @I-2-5 + 11;
@I-2-7: @I-2-6 + 9;
@II-1: @I-2-7 + 12;
@II-2: @II-1 + 24;
@II-2: @II-1 + 22;
@II-3: @II-2 + 40;
@II-4: @II-3 + 26;
@II-5: @II-4 + 12;
@II-6: @II-5 + 28;
@III: @II-6 + 32;
@III: @II-6 + 30;
body#I-1-1 {
#pages {
......
;(function () {
if ((!document.getNamedFlows) && document.webkitGetNamedFlows) {
document.getNamedFlows = document.webkitGetNamedFlows;
}
if (!document.getNamedFlow) {
document.getNamedFlow = function (name) {
return document.getNamedFlows(name).namedItem(name);
}
}
var textFlow = document.getNamedFlow('main');
/**
* Returns first region the given node is shown within
*
* workaround for getRegionsForContent() as that function only seems to work
* on block-elements
*/
function getRegionByNode(flow, node) {
var ranges, regions = flow.getRegionsByContent(node);
if (regions.length > 0) {
return regions[0];
} else {
regions = flow.getRegions();
for (var i=0; i < regions.length; i++) {
ranges = regions[i].webkitGetRegionFlowRanges();
for (var r=0; r < ranges.length; r++) {
if (ranges[r].isPointInRange(node, 0)) {
return regions[i];
}
}
}
console.log('Could not find region for node', node);
}
}
/**
* Find page for given node, travels up the DOM tree to find
* first wrapping paper element. Does not work for Nodes in a flow.
*/
function getPageByNode (node) {
if (node) {
if (node.classList.contains('paper')) {
return node;
} else {
if (node.parentElement) {
return getPageByNode(node.parentElement);
} else {
return false;
}
}
return false;
}
}
/**
* Get page by node in region
*/
function getPageByRegionNode (flow, node) {
var region = getRegionByNode(flow, node);
if (region) {
return getPageByNode(getRegionByNode(flow, node));
} else {
return null;
}
}
/**
* Return page number for given page
*/
function getPageNum (page) {
return parseInt(page.id.replace(/\D/g, ''));
}
window.fixOrphans = function () {
var threshold = 80,
step = -.025,
max = -0.125;
spans = document.querySelectorAll('.last-line');
for (var i=0; i < spans.length; i++) {
var rects = spans[i].getClientRects(),
lineCount = rects.length; // Remember how many lines we had at the start
if (rects[rects.length-1].width <= threshold) {
var spacing = 0;
while(rects.length >= lineCount && spacing >= max) {
spacing += step;
spans[i].style.letterSpacing = spacing + 'mm';
rects = spans[i].getClientRects()
}
if (rects.length == lineCount) {
spans[i].style.letterSpacing = 0;
}
}
}
}
window.fixWidows = function () {
var threshold = 30,
p = document.querySelectorAll('p');
for (var i=0; i < p.length; i++) {
var rects = p[i].getClientRects();
if (rects.length > 1 && rects[0].height < threshold) {
p[i].classList.add('break-before');
}
}
}
window.reattachHeaders = function () {
var textFlow = document.getNamedFlow('main'),
headers = document.querySelectorAll('h4');
for (var i=0; i< headers.length; i++) {
var h = headers[i],
p = h.nextElementSibling;
if (getPageNum(getPageByRegionNode(textFlow, h)) != getPageNum(getPageByRegionNode(textFlow, p))) {
h.classList.add('break-before');
} else {
var threshold = 75,
rects = p.getClientRects();
if (rects.length > 1 && rects[0].height <= threshold) {
h.classList.add('break-before');
}
}
}
}
window.typographicFixes = function () {
fixOrphans();
reattachHeaders();
fixWidows();
}
})();
\ No newline at end of file
;(function () {
'use strict';
window.buildIndex = function (callback) {
var dummyIndexJSON = "{\"problematisation\":[1,4,6,2,3,10,5,7],\"integrality\":[1,3,5,6,7,10],\"enunciation\":[1,2,10,3,4,8,9,6],\"formulation\":[1,3,4,6,10,2,7,9],\"discursive object\":[1,2,5],\"détournements\":[1],\"lekton\":[2,4,5],\"singularity\":[4,9,2,11,5],\"statement\":[5,10,3,7,9,13],\"history\":[9,1,2,4,5,3,7,11,13,6,14,12],\"urbanism\":[9,1,2,3,5,6,8,10,11,12,4,13,16],\"event\":[10,1,2,3,4,5,8],\"fault line\":[10,4,5],\"birth\":[2,4,5,6,8,11,12,1,3],\"street\":[3,4,12,5,8,6,9,10,11,13,1,2,7,16],\"police\":[3,5,2,10,12],\"palimpsest in action\":[4],\"disappearance\":[4,11,12,9],\"accidental intertwining\":[1],\"ideal city\":[1,2,4,9],\"evil\":[2,3,12,16,9,11,8],\"chance\":[2,4,11,9,10],\"archaeological method\":[3],\"conspiracy\":[3,1,2,4,12,5,6],\"aesthetics\":[3,1,7,9,6,8,10,11],\"ethics\":[4,1,2,7,8,12,3,5,6,9,10],\"provenance\":[5,6,11],\"immanent\":[10,7],\"public domain\":[11,13],\"public space\":[11,12],\"polis\":[12,7,1,3,4,9],\"machine\":[1,2,11,13,4,9],\"concatenation\":[1],\"savoir\":[2,3,5,11,4,9,10,8,12,13,6,1,7],\"medical topography\":[4],\"exercise\":[5,3,11,12,2],\"ventilation\":[6,8,9,11,12],\"problematisations\":[7,10],\"rupture\":[7,4,5,8],\"concatenations\":[1],\"historical subject\":[2],\"vector\":[7,13,3],\"aesthetic\":[8,2,10,12,11],\"focal point\":[10,11,12,1,2,5],\"political territory\":[12,13],\"\":[13],\" as institution\":[13],\"street as institution\":[13],\"arsenal\":[2],\"mathēsis\":[1,5,9,16,4,7],\"wisconst\":[1,5,6,9,16,4,7,8],\"resemblance\":[2,5,13,14,15,7],\"‘as if’\":[2,5],\"ars combinatoria\":[5,6],\"civil life\":[5,12,16,1,9,3,4,6,7,8],\"expert\":[5,6,7,9],\"constancy\":[5,6,4,7,8,9,10,11,12,1,2,3],\"dissimulation\":[8,9],\"vital ascesis\":[12,1],\"subject of initiative\":[3],\"dispositif\":[3,11],\"myth\":[4],\"gemüt\":[5,8],\"technologies of the self\":[5,6,8,2],\"structural dissidence\":[11],\"inertia\":[12],\"indifference\":[10],\"vita politica\":[1,4],\"passivum\":[10],\"ghemoed\":[8],\"hypermodern dilettante\":[9]}",
indexJSON = window.localStorage.getItem('the-riddle-index'),
index = (indexJSON) ? JSON.parse(indexJSON) : JSON.parse(dummyIndexJSON),
indexContainer = document.querySelector('#index'),
keys = Object.keys(index);
keys.sort();
for (var k = 0; k < keys.length; k++) {
var key = keys[k],
pages = index[key];
pages.sort(function (a, b) {
if (a < b) {
return -1;
} else {
if (a > b) {
return 1;
}
return 0;
}
});
console.log(pages);
var entry = document.createElement('section'),
entryLabel = document.createElement('span'),
entryLabelText = document.createTextNode(key);
entry.classList.add('index-entry');
entryLabel.classList.add('index-entry-label');
entryLabel.appendChild(entryLabelText);
entry.appendChild(entryLabel);
for (var i=0; i < pages.length; i++) {
var pageNum = document.createElement('span'),
pageNumText = document.createTextNode(pages[i]);
pageNum.classList.add('index-pagenum');
pageNum.appendChild(pageNumText);
entry.appendChild(pageNum);
}
indexContainer.appendChild(entry);
}
callback();
};
})();
\ No newline at end of file
......@@ -455,6 +455,11 @@
page-break-inside: avoid;
-webkit-region-break-inside: avoid;
&.stacked {
clear: none;
margin-right: 9mm;
}
&.full {
max-width: @page-width;
}
......@@ -564,9 +569,18 @@
font-family: 'Dauphine';
font-size: 80%;
}
}
/* Specific modifications */
#I-1-4 {
#main {
p:nth-of-type(2) {
-webkit-region-break-before: always;
}
}
}
span.img_ref, #main section.excursion span.img_ref{
display: none;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -131,6 +131,7 @@
div.header, div.footer {
background-color: white;
}
.header {
height: 10mm;
width:30%;
......@@ -315,7 +316,6 @@ em {
// text-decoration: underline;
font-weight: 400;
text-shadow: 0 1px 0 #fff, 0 2px 0 #fff, 0 -1px 0 #fff, 0 -2px 0 #fff, -1px 1px 0 #fff, -1px 2px 0 #fff, 1px 1px 0 #fff, 1px 2px 0 #fff, -1px 0 0 #fff, 0 -3px 0 #fff;
background: linear-gradient(#000000, #000000);
background-size: 1px 1px;
background-position: 0 92%;
......@@ -338,55 +338,66 @@ strong::after {
content: "\00a0 \00a0 \00a0 \00a0"!important;
}
h1 {
font-family: "dauphine";
font-size: 16pt !important;
border-right: 2px solid black;
border-right: 2px solid black;
border-bottom: 2px solid black;
text-align: center;
margin-bottom: -9pt;
margin-right: 6px;
float: left;
position: relative;
display: block;
}
h1, h1 span {
font-family: "dauphine";
font-size: 16pt !important;
text-align: center;
text-transform: uppercase;
letter-spacing: 1pt;
line-height: 21pt;
display: block;
padding:3px 13px 0px 10pt;
color:black;
float: left;
position: relative;
display: block;
}
h2#problematisation-and-essayism {
// margin-top: 7px;
}
<<<<<<< HEAD
h2 {
=======
}
h2, h2 span {
>>>>>>> df363a7ff56841f9b7695555e12079bc5ab3b16c
font-family: "dauphine" !important;
margin-top: -3px;
font-weight: "regular";
font-size: 23pt !important;
line-height: 21pt;
letter-spacing: -0.02em;
text-align: left;
}
h2 {
margin-top: -3px;
padding: 8pt 8pt 8pt 18pt;
text-align: left;
border-top: 3px solid black !important;
}
h2:first-line::before {
content: "\00a0" !important;
}
h4{
h4 {
padding : 0px 18px;
margin-top : 16px;
margin-bottom : 6px;
font-family: "dauphine" !important;
// font-family: 'Garamond12' !important;
}
h4, h4 span {
font-family: "dauphine" !important;
font-size: 13.5pt !important;
line-height: 13.25pt;
text-align: left !important;
......@@ -445,6 +456,7 @@ blockquote {
font-size: 10pt !important;
font-style: regular;
text-decoration: none;
<<<<<<< HEAD
// text-shadow: none;
// background: none;
text-shadow: 0 1px 0 #fff, 0 2px 0 #fff, 0 -1px 0 #fff, 0 -2px 0 #fff, -1px 1px 0 #fff, -1px 2px 0 #fff, 1px 1px 0 #fff, 1px 2px 0 #fff, -1px 0 0 #fff, 0 -3px 0 #fff;
......@@ -453,6 +465,8 @@ blockquote {
background-position: 0 92%;
background-repeat: repeat-x;
=======
>>>>>>> df363a7ff56841f9b7695555e12079bc5ab3b16c
}
}
......
This diff is collapsed.
<html>
<head>
<style type="text/css">
#viewport {
position: fixed;
width: 100%;
height: -webkit-calc(100% - 25px);
height: calc(100% - 25px);
border: none;
}
</style>
</head>
<body>
<iframe id="viewport"></iframe>
<script>
(function () {
'use strict';
var chapters = [
"/chapters/book1/I.1.1 + Exc 1 def.html",
"/chapters/book1/I.1.2 def.html",
"/chapters/book1/I.1.3 + Exc 2 en 3 def.html",
"/chapters/book1/I.1.4 + 4a def.html",
"/chapters/book1/I.1.5 The Emergence of the Engineer and His Unexcelled Theoretical Background+ Exc 5a def.html",
"/chapters/book1/I.1.6 Politics of the Street def.html",
"/chapters/book1/I.1.7 The Street Machine.html",
"/chapters/book1/I.1.8 Boosting the City or the Principle of Conditioned Ground def.html",
"/chapters/book1/I.1.9 The Power of Expressiveness and Wil to Direct + Exc 7def.html",
"/chapters/book1/I.2.1 On the Ordering of Cities.html",
"/chapters/book1/I.2.2 + Exc 7.html",
"/chapters/book1/I.2.3 + Exc 8.html",
"/chapters/book1/I.2.4 + Exc 9.html",
"/chapters/book1/I.2.5 + Exc 10.html",
"/chapters/book1/I.2.6 + Exc 11.html",
"/chapters/book1/I.2.7 Wealth and Representation.html",
"/chapters/book2/II.1 The Image of the City and the Process of Planning.html",
"/chapters/book2/II.2 City Frontiers and Their Disappearance.html",
"/chapters/book2/II.3 Passion for the Hiatus and the Liquidisation of Architecture.html",
"/chapters/book2/II.4 Information Cloud and the Rise of the Omnipolis.html",
"/chapters/book2/II.5 Solidification of History.html",
"/chapters/book2/II.6 Compulsion to Sit.html",
"/chapters/book3/3-all.html"
];
var c = 0, intervalId,
viewport = document.getElementById('viewport');
function checkChapterReady () {
if (viewport.contentDocument.layoutcomplete) {
window.clearInterval(intervalId);
loadNextChapter();
}
}
function loadNextChapter () {
if (c < chapters.length) {
viewport.src = chapters[c];
c++;
} else {
window.location.href = 'http://html2print/chapters/book0/index.html';
console.log('ready');
}
}
viewport.addEventListener("load", function () {
intervalId = window.setInterval(checkChapterReady, 500);
});
loadNextChapter();
})();
</script>
</body>
</html>
\ No newline at end of file
......@@ -3,7 +3,7 @@
bookfolder=${1%/}
total=0
for pdffile in $bookfolder/pdfs/*-downsampled.pdf; do
for pdffile in $bookfolder/pdfs/*.pdf; do
pages=$(pdfinfo "${pdffile}" | awk '/Pages/ {print $2}')
echo "${pdffile} - ${pages}"
let total+=pages
......
replace_patt = '++$1++'
for k in keywords:
patt = '[^|\s]{0}[\s|$]'.format(k)
md = re.subn(patt, replace_patt, md)
\+\+(.[^\+]+)\+\+
<span class="keyword"></span>
#! /bin/bash
sourcefolder=${1%/}
for book in $sourcefolder/book*; do
echo "Reading ${book}"
for htmlfile in $book/*.html; do
echo "<article data-src=\"${htmlfile}\"></article>"
done;
done;
echo "Applying extra line breaks"
\ No newline at end of file
......@@ -11,7 +11,7 @@ for bookfolder in $storiesfolder/book*; do
mkdir $chaptersfolder/$bookname
fi
for storypath in $bookfolder/*.html; do
\I+\.\d+
# \I+\.\d+
storyname=$(basename "${storypath}")
if [ ! -f "${chaptersfolder}/${bookname}/${storyname}" ]; then
echo "Making chapter for ${storyname}"
......
#! /bin/bash
path=$1
folder=$(dirname "${path}")
htmlfile=$(basename "${path}")
pdffile="${htmlfile%.html}.pdf"
OSPKitPDF "http://html2print/${path}" "${folder}/pdfs/${pdffile}"
\ No newline at end of file
#! /bin/bash
bookfolder=${1%/}
for htmlfile in $bookfolder/*.html; do
basefilename=$(basename "${htmlfile%.html}")
if [ "${basefilename}" != "template" ]; then
#echo "${chapterfile%.*}".pdf
OSPKitPDF "http://html2print/${htmlfile}" "${bookfolder}/pdfs/${basefilename}.pdf"
fi
done
\ No newline at end of file
#! /bin/bash
bookfolder=${1%/}
rm ${bookfolder}/pdfs/*-downsampled.pdf
for pdffile in $bookfolder/pdfs/*.pdf; do
gs \
-o "${pdffile%.pdf}-downsampled.pdf" \
-sDEVICE=pdfwrite \
-dDownsampleColorImages=true \
-dDownsampleGrayImages=true \
-dDownsampleMonoImages=true \
-dColorImageResolution=150 \
-dGrayImageResolution=150 \
-dMonoImageResolution=150 \
-dColorImageDownsampleThreshold=1.0 \
-dGrayImageDownsampleThreshold=1.0 \
-dMonoImageDownsampleThreshold=1.0 \
"${pdffile}"
done
\ No newline at end of file
......@@ -20,5 +20,6 @@ python big_break_paragraphs.py $storiesfolder
python transform_keywords.py $storiesfolder
# python reintroduce_image_references.py $storiesfolder
python modify_images.py $storiesfolder
python wrap_last_sentence_paragraphs.py $storiesfolder/$book
bash build_src.sh $chaptersfolder ../js/src.js
\ No newline at end of file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import glob
import codecs
import os.path
import argparse
parser = argparse.ArgumentParser("Wrap last sentence of paragraphs. To deal with orphans")
parser.add_argument('folder', help="Stories folder, with HTML files")
args = parser.parse_args()
def wrap_last_sentence (m):
content = m.group('content')
interpunctions = [m for m in re.finditer('[\.\?\!\:]\s*(?!$)', content)]
if (interpunctions):
splitindex = interpunctions[-1].end()
else:
splitindex = content.find(u' ', -80) + 1
head = content[:splitindex]
tail = content[splitindex:]
if '>' in tail and not re.match(".*\<(\w+)(?:[^\>])*>.+\</\\1\>.*", tail):
splitindex += [m for m in re.finditer('>\s*', tail)][-1].end()
head = content[:splitindex]
tail = content[splitindex:]
return u'{0}<span class="last-line">{1}</span>'.format(head, tail)
for htmlpath in glob.glob("{0}/*.html".format(os.path.normpath(args.folder))):
print "\t{0}".format(htmlpath)
htmlstring = None
with codecs.open(htmlpath, mode='r', encoding='utf-8') as htmlfile:
htmlstring = htmlfile.read()
htmlstring = re.sub(u'(?P<content>.{170}[\.\?\!\)]\s*)(?=<\/p>)', wrap_last_sentence, htmlstring)
if htmlstring:
with codecs.open(htmlpath, mode='w', encoding='utf-8') as htmlfile:
htmlfile.write(htmlstring)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment