Skip to content

Commit

Permalink
add 'fork me' banner after epub is created
Browse files Browse the repository at this point in the history
  • Loading branch information
sarabander committed Feb 17, 2014
1 parent c03bdec commit 2e3b70a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ CONV = texi2any lib/Texinfo/Convert/HTML.pm # Texinfo converter scripts
MATH = get-math.js put-math.js mathcell.xhtml # LaTeX -> MathML converter
HIGHL = $(DIR)js/highlight/
PRETTY = $(HIGHL)prettify.js $(HIGHL)lang-lisp.js batch-prettify.js
COVER = index.xhtml $(DIR)fig/coverpage.std.svg $(DIR)fig/bookwheel.jpg
COVER = index.in.xhtml $(DIR)fig/coverpage.std.svg $(DIR)fig/bookwheel.jpg
THUMB = $(DIR)fig/cover.png # thumbnail cover image
SHELL = /bin/bash

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

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>

all: $(GOAL)
# Add scripts to the unpacked HTML5 version that is to be read in a browser.
@if ! grep -m 1 -l 'browsertest' $(NEXUS); then \
Expand All @@ -31,7 +33,10 @@ all: $(GOAL)
"s{\s*</head>}{\n\n$(JQ)\n$(FT)\n$(BR)\n</head>}" $$file; \
done; \
rm $(DIR)*.bak; \
fi
fi; \
perl -0p -i.bak -e \
"s{<!-- Fork me banner -->}{$(GITHUB)}" index.xhtml; \
rm *.bak

html: $(NEXUS)

Expand Down Expand Up @@ -90,6 +95,7 @@ $(GOAL): $(META) $(THUMB) $(FIG) $(CSS) $(FONT) mimetype META-INF/* LICENSE
rm $(DIR)*.bak; \
fi; \
zip -0Xq $(GOAL) mimetype; \
cp index.in.xhtml index.xhtml; \
zip -Xr9Dq $(GOAL) $(META) $(HTML) META-INF/* LICENSE \
index.xhtml $(DIR)css/* $(DIR)fig/* ; \
echo "done."
Expand Down
2 changes: 1 addition & 1 deletion content.opf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<dc:identifier id="bookid">urn:uuid:a412368e-e0ac-42ce-8c01-0f0da52f5731</dc:identifier>
<dc:language>en-US</dc:language>
<meta name="cover" content="cover-image"/>
<meta property="dcterms:modified">2014-02-16T00:04:08Z</meta>
<meta property="dcterms:modified">2014-02-17T16:58:38Z</meta>
</metadata>
<manifest>
<item id="css-style" href="html/css/style.css" media-type="text/css"/>
Expand Down
66 changes: 66 additions & 0 deletions index.in.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">
<head>
<title>Structure and Interpretation of Computer Programs, 2e</title>

<meta name="description" content="Structure and Interpretation of Computer Programs, 2e"/>
<meta name="keywords" content="Structure and Interpretation of Computer Programs, 2e"/>
<meta name="Generator" content="texi2any"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8"/>

<link href="html/css/style.css" rel="stylesheet"/>
<style type="text/css">
html {
height: 100%;
}
/* This is taken from:
http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/
http://coding.smashingmagazine.com/2013/05/22/centering-elements-with-flexbox/
*/
body {
background-color: #f0f0f0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-moz-box-align: center;
-ms-flex-align: center;
ebkit-align-items: center;
align-items: center;
-webkit-box-pack: center;
-moz-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
margin: 0;
height: 100%;
width: 100%
}
section {
max-width: 94%;
}
@media (max-width: 480px) {
section {
max-width: 97%;
}
}
</style>
</head>

<body>
<section>

<a class="cover" href="html/index.xhtml">
<figure>
<object data="html/fig/coverpage.std.svg" type="image/svg+xml">SVG</object>
</figure>
</a>

</section>
<!-- Fork me banner -->
</body>
</html>

0 comments on commit 2e3b70a

Please sign in to comment.