Skip to content

Commit 2e3b70a

Browse files
committed
add 'fork me' banner after epub is created
1 parent c03bdec commit 2e3b70a

File tree

3 files changed

+75
-3
lines changed

3 files changed

+75
-3
lines changed

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ CONV = texi2any lib/Texinfo/Convert/HTML.pm # Texinfo converter scripts
1515
MATH = get-math.js put-math.js mathcell.xhtml # LaTeX -> MathML converter
1616
HIGHL = $(DIR)js/highlight/
1717
PRETTY = $(HIGHL)prettify.js $(HIGHL)lang-lisp.js batch-prettify.js
18-
COVER = index.xhtml $(DIR)fig/coverpage.std.svg $(DIR)fig/bookwheel.jpg
18+
COVER = index.in.xhtml $(DIR)fig/coverpage.std.svg $(DIR)fig/bookwheel.jpg
1919
THUMB = $(DIR)fig/cover.png # thumbnail cover image
2020
SHELL = /bin/bash
2121

2222
JQ = <script src=\"js/jquery.min.js\" type=\"text/javascript\"></script>
2323
FT = <script src=\"js/footnotes.js\" type=\"text/javascript\"></script>
2424
BR = <script src=\"js/browsertest.js\" type=\"text/javascript\"></script>
2525

26+
GITHUB = <a href=\"https://github.com/sarabander/sicp\"><img style=\"position: absolute; top: 0; right: 0; border: 0; width: 149px; height: 149px; z-index: 10; opacity: 0.5;\" src=\"http://aral.github.com/fork-me-on-github-retina-ribbons/right-red\@2x.png\" alt=\"Fork me on GitHub\" /></a>
27+
2628
all: $(GOAL)
2729
# Add scripts to the unpacked HTML5 version that is to be read in a browser.
2830
@if ! grep -m 1 -l 'browsertest' $(NEXUS); then \
@@ -31,7 +33,10 @@ all: $(GOAL)
3133
"s{\s*</head>}{\n\n$(JQ)\n$(FT)\n$(BR)\n</head>}" $$file; \
3234
done; \
3335
rm $(DIR)*.bak; \
34-
fi
36+
fi; \
37+
perl -0p -i.bak -e \
38+
"s{<!-- Fork me banner -->}{$(GITHUB)}" index.xhtml; \
39+
rm *.bak
3540

3641
html: $(NEXUS)
3742

@@ -90,6 +95,7 @@ $(GOAL): $(META) $(THUMB) $(FIG) $(CSS) $(FONT) mimetype META-INF/* LICENSE
9095
rm $(DIR)*.bak; \
9196
fi; \
9297
zip -0Xq $(GOAL) mimetype; \
98+
cp index.in.xhtml index.xhtml; \
9399
zip -Xr9Dq $(GOAL) $(META) $(HTML) META-INF/* LICENSE \
94100
index.xhtml $(DIR)css/* $(DIR)fig/* ; \
95101
echo "done."

content.opf

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<dc:identifier id="bookid">urn:uuid:a412368e-e0ac-42ce-8c01-0f0da52f5731</dc:identifier>
99
<dc:language>en-US</dc:language>
1010
<meta name="cover" content="cover-image"/>
11-
<meta property="dcterms:modified">2014-02-16T00:04:08Z</meta>
11+
<meta property="dcterms:modified">2014-02-17T16:58:38Z</meta>
1212
</metadata>
1313
<manifest>
1414
<item id="css-style" href="html/css/style.css" media-type="text/css"/>

index.in.xhtml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE html>
3+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
4+
<head>
5+
<title>Structure and Interpretation of Computer Programs, 2e</title>
6+
7+
<meta name="description" content="Structure and Interpretation of Computer Programs, 2e"/>
8+
<meta name="keywords" content="Structure and Interpretation of Computer Programs, 2e"/>
9+
<meta name="Generator" content="texi2any"/>
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
11+
<meta charset="utf-8"/>
12+
13+
<link href="html/css/style.css" rel="stylesheet"/>
14+
<style type="text/css">
15+
html {
16+
height: 100%;
17+
}
18+
/* This is taken from:
19+
http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/
20+
http://coding.smashingmagazine.com/2013/05/22/centering-elements-with-flexbox/
21+
*/
22+
body {
23+
background-color: #f0f0f0;
24+
display: -webkit-box;
25+
display: -moz-box;
26+
display: -ms-flexbox;
27+
display: -webkit-flex;
28+
display: flex;
29+
-webkit-box-align: center;
30+
-moz-box-align: center;
31+
-ms-flex-align: center;
32+
ebkit-align-items: center;
33+
align-items: center;
34+
-webkit-box-pack: center;
35+
-moz-box-pack: center;
36+
-ms-flex-pack: center;
37+
-webkit-justify-content: center;
38+
justify-content: center;
39+
margin: 0;
40+
height: 100%;
41+
width: 100%
42+
}
43+
section {
44+
max-width: 94%;
45+
}
46+
@media (max-width: 480px) {
47+
section {
48+
max-width: 97%;
49+
}
50+
}
51+
</style>
52+
</head>
53+
54+
<body>
55+
<section>
56+
57+
<a class="cover" href="html/index.xhtml">
58+
<figure>
59+
<object data="html/fig/coverpage.std.svg" type="image/svg+xml">SVG</object>
60+
</figure>
61+
</a>
62+
63+
</section>
64+
<!-- Fork me banner -->
65+
</body>
66+
</html>

0 commit comments

Comments
 (0)