mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
Add local cover image because Amazon URLs are so unstable. Also, add cover image to every page.
This commit is contained in:
BIN
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
+1
-1
@@ -23,7 +23,7 @@ h1:before,h2:before{content:''}
|
||||
|
||||
<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&tag=diveintomark-20&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&tag=diveintomark-20&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>
|
||||
|
||||
@@ -8,6 +8,7 @@ body{counter-reset:h1 0}
|
||||
.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>
|
||||
|
||||
@@ -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\&tag=diveintomark-20\&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>
|
||||
@@ -115,13 +115,14 @@ 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)
|
||||
@@ -129,7 +130,7 @@ 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 "." && \
|
||||
|
||||
+3
-3
@@ -250,13 +250,13 @@ experience of years.</samp>
|
||||
|
||||
<pre class=screen>
|
||||
<samp class=p>>>> </samp><kbd class=pp>query = 'user=pilgrim&database=master&password=PapayaWhip'</kbd>
|
||||
<a><samp class=p>>>> </samp><kbd class=pp>a_list = query.split('&')</kbd> <span class=u>①</span></a>
|
||||
<a><samp class=p>>>> </samp><kbd class=pp>a_list = query.split('&')</kbd> <span class=u>①</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>②</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>②</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>③</span></a>
|
||||
<a><samp class=p>>>> </samp><kbd class=pp>a_dict = dict(a_list_of_lists)</kbd> <span class=u>③</span></a>
|
||||
<samp class=p>>>> </samp><kbd class=pp>a_dict</kbd>
|
||||
<samp class=pp>{'password': 'PapayaWhip', 'user': 'pilgrim', 'database': 'master'}</samp></pre>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user