Skip to content

Commit

Permalink
Add local cover image because Amazon URLs are so unstable. Also, add …
Browse files Browse the repository at this point in the history
…cover image to every page.
  • Loading branch information
Mark Pilgrim committed May 12, 2010
1 parent 56be794 commit 3e31f38
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
Binary file added i/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1>Dive Into Python 3</h1>

<h2>Table of Contents (<a href=table-of-contents.html>expand</a>)</h2>

<p style="float:right;width:242px;text-align:center;margin:0 0 0 1.75em"><a style="border:0" href="http://www.amazon.com/gp/product/1430224150?ie=UTF8&amp;tag=diveintomark-20&amp;creativeASIN=1430224150" title="Affiliate link = I earn an extra buck"><em>Also available on dead trees!</em><br><img src=http://ecx.images-amazon.com/images/I/51-59wc2s6L.jpg alt="Dive Into Python 3" width=242 height=300></a>
<p style="float:right;width:245px;text-align:center;margin:0 0 0 1.75em"><a style="border:0" href="http://www.amazon.com/gp/product/1430224150?ie=UTF8&amp;tag=diveintomark-20&amp;creativeASIN=1430224150" title="Affiliate link = I earn an extra buck"><em>Also available on dead trees!</em><br><img src="i/cover.jpg" alt="Dive Into Python 3" width=245 height=300></a>

<!-- toc -->
<ol start=-1>
Expand Down
1 change: 1 addition & 0 deletions installing-python.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.i{list-style:none;margin:0;padding:0}
#which{padding-top:1.75em}
h2,.i>li{clear:both}
#divingin,#which{clear:none}
</style>
<link rel=stylesheet media='only screen and (max-device-width: 480px)' href=mobile.css>
<link rel=stylesheet media=print href=print.css>
Expand Down
1 change: 1 addition & 0 deletions j/plug.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p style='float:right;width:245px;text-align:center;margin:0 0 0 1.75em'><a style='border:0' href='http://www.amazon.com/gp/product/1430224150?ie=UTF8\&amp;tag=diveintomark-20\&amp;creativeASIN=1430224150' title='Affiliate link = I earn an extra buck'><em>Also available on dead trees!</em><br><img src=i/cover.jpg alt='Dive Into Python 3' width=245 height=300></a>
7 changes: 4 additions & 3 deletions publish
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,22 @@ java -jar util/yuicompressor-2.4.2.jar build/dip3.css > build/$revision.css && \
# put CSS inline and remove unused CSS properties on a page-by-page basis
# minimize URLs by stripping "http:" prefix
# add asynchronous Google Analytics script in head (after inline styles)
echo "inlining CSS, minimizing URLs, adding evil tracking code"
echo "inlining CSS, minimizing URLs, adding evil tracking code and affiliate links"
ga=`cat j/ga.js`
plug=`cat j/plug.html`
for f in build/*.html; do
css=`python2.5 util/lesscss.py "$f" "build/$revision.css"` || die "Failed to remove unused CSS"
mobilecss=`python2.5 util/lesscss.py "$f" "build/m-$revision.css"` || die "Failed to remove unused CSS"
printcss=`python2.5 util/lesscss.py "$f" "build/p-$revision.css"` || die "Failed to remove unused CSS"
sed -i -e "s|<link rel=stylesheet href=dip3.css>|<style>${css}</style>|g" -e "s|<link rel=stylesheet media='only screen and (max-device-width: 480px)' href=mobile.css>|<style>@media screen and (max-device-width:480px){${mobilecss}}</style>|g" -e "s|<link rel=stylesheet media=print href=print.css>|<style>@media print{${printcss}}</style>|g" -e "s|</style><style>||g" -e "s|href=index.html|href=/|g" -e "s|</style>|</style>${ga}|g" "$f" || die "Failed to inline CSS"
sed -i -e "s|<link rel=stylesheet href=dip3.css>|<style>${css}</style>|g" -e "s|<link rel=stylesheet media='only screen and (max-device-width: 480px)' href=mobile.css>|<style>@media screen and (max-device-width:480px){${mobilecss}}</style>|g" -e "s|<link rel=stylesheet media=print href=print.css>|<style>@media print{${printcss}}</style>|g" -e "s|</style><style>||g" -e "s|href=index.html|href=/|g" -e "s|</style>|</style>${ga}|g" -e "s|<p id=toc>|${plug}<p id=toc>|g" "$f" || die "Failed to inline CSS"
done

# set file permissions (hg resets these, don't know why)
chmod 755 build/examples build/j build/i build/d && \
chmod 644 build/*.html build/*.css build/*.txt build/*.zip build/examples/* build/examples/.htaccess build/j/* build/j/.htaccess build/i/* build/i/.htaccess build/d/.htaccess build/.htaccess || die "Failed to reset file permissions"

# ship it!
#die "Aborting without publishing"
die "Aborting without publishing"
echo -n "publishing"
rsync -essh -a build/d/.htaccess build/*.zip diveintomark.org:~/web/diveintopython3.org/d/ && \
echo -n "." && \
Expand Down
6 changes: 3 additions & 3 deletions strings.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ <h2 id=common-string-methods>Other Common String Methods</h2>

<pre class=screen>
<samp class=p>>>> </samp><kbd class=pp>query = 'user=pilgrim&amp;database=master&amp;password=PapayaWhip'</kbd>
<a><samp class=p>>>> </samp><kbd class=pp>a_list = query.split('&amp;')</kbd> <span class=u>&#x2460;</span></a>
<a><samp class=p>>>> </samp><kbd class=pp>a_list = query.split('&amp;')</kbd> <span class=u>&#x2460;</span></a>
<samp class=p>>>> </samp><kbd class=pp>a_list</kbd>
<samp class=pp>['user=pilgrim', 'database=master', 'password=PapayaWhip']</samp>
<a><samp class=p>>>> </samp><kbd class=pp>a_list_of_lists = [v.split('=', 1) for v in a_list]</kbd> <span class=u>&#x2461;</span></a>
<a><samp class=p>>>> </samp><kbd class=pp>a_list_of_lists = [v.split('=', 1) for v in a_list if '=' in v]</kbd> <span class=u>&#x2461;</span></a>
<samp class=p>>>> </samp><kbd class=pp>a_list_of_lists</kbd>
<samp class=pp>[['user', 'pilgrim'], ['database', 'master'], ['password', 'PapayaWhip']]</samp>
<a><samp class=p>>>> </samp><kbd class=pp>a_dict = dict(a_list_of_lists)</kbd> <span class=u>&#x2462;</span></a>
<a><samp class=p>>>> </samp><kbd class=pp>a_dict = dict(a_list_of_lists)</kbd> <span class=u>&#x2462;</span></a>
<samp class=p>>>> </samp><kbd class=pp>a_dict</kbd>
<samp class=pp>{'password': 'PapayaWhip', 'user': 'pilgrim', 'database': 'master'}</samp></pre>

Expand Down

0 comments on commit 3e31f38

Please sign in to comment.