Skip to content

Commit

Permalink
[sewtha,#5][xl]: markdown version of david mackay's sustainable energ…
Browse files Browse the repository at this point in the history
…y without the hot air.

In /sewtha/ directory. Working with the website.

* epub source
* extract.sh that does all the extraction and cleaning (quite a bit of debugging to make sure html is well-behaved for next/mdx)
* images for the text in site/public/img/sewtha (could be nicer to keep these with the text and copy over in build ...)
  • Loading branch information
rufuspollock committed Aug 17, 2021
1 parent c7df658 commit e7e5c16
Show file tree
Hide file tree
Showing 387 changed files with 21,826 additions and 0 deletions.
21,762 changes: 21,762 additions & 0 deletions sewtha/README.md

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions sewtha/src/extract.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/zsh

# Main epub version linked on https://www.withouthotair.com/epubVersions.html
# curl http://www.inference.eng.cam.ac.uk/sustainable/book/translate/SustainableEnergy-withoutthehotair-DavidJCMacKay.epub > sewtha.epub

# let's extract it with the images
mkdir -p img
pandoc without-the-hot-air.epub -t gfm -o main.md --wrap=none --extract-media=img

cp main.md tidy.md

## let's try and tidy it up ...
# remove stuff like <span id="titlepage.xhtml"></span>
sed -i '' 's/^<span.*><\/span>$//g' tidy.md
# <span class="figurenumber">Figure 1.2.</span> Are "our" fossil fuels running out? Total crude oil production from the North Sea, and oil price in 2006 dollars per barrel. [<span class="darkred">\[10\]</span>](#chap01.xhtml#ch01n10)

# remove stuff like <div class="imgcap">
# ~~in fact, let's leave for now~~
sed -i '' 's/^<div.*//g' tidy.md
sed -i '' 's/^<\/div>//g' tidy.md

# strip trailng white space
sed -i '' 's/ *$//g' tidy.md

# let's delete all 2+ blank lines
# see https://stackoverflow.com/questions/12598916/how-to-use-sed-to-remove-only-double-empty-lines
sed -i '' 'N;/^\n$/d;P;D' tidy.md

# correct quotes to normal quotes
sed -i '' 's/”/"/g' tidy.md
sed -i '' 's/“/"/g' tidy.md

# fix headings e.g. ...
# # <span class="smallfont">*Part I*</span>
sed -i '' 's/^# <span class="smallfont">\*\(.*\)\*<\/span>/# \1/g' tidy.md

# delete the nav
# sed '/PATTERN-1/,/PATTERN-2/{//!d}'

## Footnotes
# [<span class="darkred">\[13\]</span>](#chap01.xhtml#ch01n13)
sed -i '' 's/ \[<span class="darkred">\\\[[0-9]*[^#]*(#chap[0-9]*.xhtml#ch\([0-9]*\)n\([0-9]*\))/[^\1-\2]/g' tidy.md
# And fn is ... [<span class="mark">\[1\]</span>](#chap01.xhtml#ret01)*
sed -i '' 's/\[<span class="mark">\\\[[0-9*\\\][^)]*#chap\([0-9]*\).xhtml#ret\([0-9]*\))/[^\1-\2]: /g' tidy.md
# TODO: remove special span class red case ...

## fix up references section e.g.
# - <span class="smallcaps"> {OECD</span> Nuclear Energy Agency}. (2006).
sed -i '' -e 's/<span class="smallcaps">\([^<]*\)<\/span>/\1/g' tidy.md

## final hacks ...
# replace unmatched closing </div> usually looking like
# </div>\n\n</th>
# TODo: I cannot find an easy way to do multiline replace so giving up for now!
# sed -i '' -e 's/<\/div>\n\n<\/th>/<\/th>/' tidy.md

# let's fix Images which are in img/Images
mv img/Images/* img/
rm -Rf img/Images
sed -i '' 's/img\/Images/\/img\/sewtha/g' tidy.md

cp tidy.md ../README.md
mkdir -p ../../site/public/img/sewtha
cp -a img/* ../../site/public/img/sewtha/
Binary file added sewtha/src/sewtha.epub
Binary file not shown.
Binary file added site/public/img/sewtha/DoNothing5M.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/LowEManS.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/OutOfGasS.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/author.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/carbon-chart.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure10.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure100.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure1011.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure102.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure103.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure104.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure105.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure106.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure107.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure108.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure109.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure11.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure110.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure111.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure112.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure113.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure114.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure115.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure116.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/img/sewtha/figure117.gif
Binary file added site/public/img/sewtha/figure118.gif
Binary file added site/public/img/sewtha/figure119.gif
Binary file added site/public/img/sewtha/figure12.gif
Binary file added site/public/img/sewtha/figure120.gif
Binary file added site/public/img/sewtha/figure1211.gif
Binary file added site/public/img/sewtha/figure122.gif
Binary file added site/public/img/sewtha/figure123.gif
Binary file added site/public/img/sewtha/figure124.gif
Binary file added site/public/img/sewtha/figure125.gif
Binary file added site/public/img/sewtha/figure126.gif
Binary file added site/public/img/sewtha/figure127.gif
Binary file added site/public/img/sewtha/figure128.gif
Binary file added site/public/img/sewtha/figure129.gif
Binary file added site/public/img/sewtha/figure13.gif
Binary file added site/public/img/sewtha/figure130.gif
Binary file added site/public/img/sewtha/figure131.gif
Binary file added site/public/img/sewtha/figure132.gif
Binary file added site/public/img/sewtha/figure133.gif
Binary file added site/public/img/sewtha/figure134.gif
Binary file added site/public/img/sewtha/figure135.gif
Binary file added site/public/img/sewtha/figure136.gif
Binary file added site/public/img/sewtha/figure137.gif
Binary file added site/public/img/sewtha/figure138.gif
Binary file added site/public/img/sewtha/figure139.gif
Binary file added site/public/img/sewtha/figure14.gif
Binary file added site/public/img/sewtha/figure140.gif
Binary file added site/public/img/sewtha/figure141.gif
Binary file added site/public/img/sewtha/figure142.gif
Binary file added site/public/img/sewtha/figure143.gif
Binary file added site/public/img/sewtha/figure144.gif
Binary file added site/public/img/sewtha/figure145.gif
Binary file added site/public/img/sewtha/figure146.gif
Binary file added site/public/img/sewtha/figure147.gif
Binary file added site/public/img/sewtha/figure148.gif
Binary file added site/public/img/sewtha/figure149.gif
Binary file added site/public/img/sewtha/figure15.gif
Binary file added site/public/img/sewtha/figure150.gif
Binary file added site/public/img/sewtha/figure151.gif
Binary file added site/public/img/sewtha/figure152.gif
Binary file added site/public/img/sewtha/figure153.gif
Binary file added site/public/img/sewtha/figure154.gif
Binary file added site/public/img/sewtha/figure155.gif
Binary file added site/public/img/sewtha/figure156.gif
Binary file added site/public/img/sewtha/figure157.gif
Binary file added site/public/img/sewtha/figure158.gif
Binary file added site/public/img/sewtha/figure159.gif
Binary file added site/public/img/sewtha/figure16.gif
Binary file added site/public/img/sewtha/figure160.gif
Binary file added site/public/img/sewtha/figure1611.gif
Binary file added site/public/img/sewtha/figure162.gif
Binary file added site/public/img/sewtha/figure163.gif
Binary file added site/public/img/sewtha/figure164.gif
Binary file added site/public/img/sewtha/figure165.gif
Binary file added site/public/img/sewtha/figure166.gif
Binary file added site/public/img/sewtha/figure167.gif
Binary file added site/public/img/sewtha/figure168.gif
Binary file added site/public/img/sewtha/figure169.gif
Binary file added site/public/img/sewtha/figure17.gif
Binary file added site/public/img/sewtha/figure170.gif
Binary file added site/public/img/sewtha/figure171.gif
Binary file added site/public/img/sewtha/figure172.gif
Binary file added site/public/img/sewtha/figure173.gif
Binary file added site/public/img/sewtha/figure174.gif
Binary file added site/public/img/sewtha/figure175.gif
Binary file added site/public/img/sewtha/figure176.gif
Binary file added site/public/img/sewtha/figure177.gif
Binary file added site/public/img/sewtha/figure178.gif
Binary file added site/public/img/sewtha/figure179.gif
Binary file added site/public/img/sewtha/figure18.gif
Binary file added site/public/img/sewtha/figure180.gif
Binary file added site/public/img/sewtha/figure181.gif
Binary file added site/public/img/sewtha/figure182.gif
Binary file added site/public/img/sewtha/figure183.gif
Binary file added site/public/img/sewtha/figure184.gif
Binary file added site/public/img/sewtha/figure185.gif
Binary file added site/public/img/sewtha/figure186.gif
Binary file added site/public/img/sewtha/figure187.gif
Binary file added site/public/img/sewtha/figure188.gif
Binary file added site/public/img/sewtha/figure189.gif
Binary file added site/public/img/sewtha/figure19.gif
Binary file added site/public/img/sewtha/figure190.gif
Binary file added site/public/img/sewtha/figure191.gif
Binary file added site/public/img/sewtha/figure192.gif
Binary file added site/public/img/sewtha/figure193.gif
Binary file added site/public/img/sewtha/figure194.gif
Binary file added site/public/img/sewtha/figure195.gif
Binary file added site/public/img/sewtha/figure196.gif
Binary file added site/public/img/sewtha/figure197.gif
Binary file added site/public/img/sewtha/figure198.gif
Binary file added site/public/img/sewtha/figure199.gif
Binary file added site/public/img/sewtha/figure2.gif
Binary file added site/public/img/sewtha/figure20.gif
Binary file added site/public/img/sewtha/figure200.gif
Binary file added site/public/img/sewtha/figure201.gif
Binary file added site/public/img/sewtha/figure202.gif
Binary file added site/public/img/sewtha/figure203.gif
Binary file added site/public/img/sewtha/figure204.gif
Binary file added site/public/img/sewtha/figure205.gif
Binary file added site/public/img/sewtha/figure206.gif
Binary file added site/public/img/sewtha/figure207.gif
Binary file added site/public/img/sewtha/figure208.gif
Binary file added site/public/img/sewtha/figure209.gif
Binary file added site/public/img/sewtha/figure21.gif
Binary file added site/public/img/sewtha/figure210.gif
Binary file added site/public/img/sewtha/figure211.gif
Binary file added site/public/img/sewtha/figure212.gif
Binary file added site/public/img/sewtha/figure213.gif
Binary file added site/public/img/sewtha/figure214.gif
Binary file added site/public/img/sewtha/figure215.gif
Binary file added site/public/img/sewtha/figure216.gif
Binary file added site/public/img/sewtha/figure217.gif
Binary file added site/public/img/sewtha/figure218.gif
Binary file added site/public/img/sewtha/figure219.gif
Binary file added site/public/img/sewtha/figure22.gif
Binary file added site/public/img/sewtha/figure220A.gif
Binary file added site/public/img/sewtha/figure221.gif
Binary file added site/public/img/sewtha/figure222.gif
Binary file added site/public/img/sewtha/figure223.gif
Binary file added site/public/img/sewtha/figure224.gif
Binary file added site/public/img/sewtha/figure225.gif
Binary file added site/public/img/sewtha/figure226.gif
Binary file added site/public/img/sewtha/figure227A.gif
Binary file added site/public/img/sewtha/figure228.gif
Binary file added site/public/img/sewtha/figure229.gif
Binary file added site/public/img/sewtha/figure230.gif
Binary file added site/public/img/sewtha/figure231.gif
Binary file added site/public/img/sewtha/figure232.gif
Binary file added site/public/img/sewtha/figure233.gif
Binary file added site/public/img/sewtha/figure234.gif
Binary file added site/public/img/sewtha/figure235.gif
Binary file added site/public/img/sewtha/figure236.gif
Binary file added site/public/img/sewtha/figure237.gif
Binary file added site/public/img/sewtha/figure238.gif
Binary file added site/public/img/sewtha/figure239.gif
Binary file added site/public/img/sewtha/figure24.gif
Binary file added site/public/img/sewtha/figure240.gif
Binary file added site/public/img/sewtha/figure241.gif
Binary file added site/public/img/sewtha/figure242.gif
Binary file added site/public/img/sewtha/figure243.gif
Binary file added site/public/img/sewtha/figure244.gif
Binary file added site/public/img/sewtha/figure245.gif
Binary file added site/public/img/sewtha/figure2451.gif
Binary file added site/public/img/sewtha/figure246.gif
Binary file added site/public/img/sewtha/figure247.gif
Binary file added site/public/img/sewtha/figure248.gif
Binary file added site/public/img/sewtha/figure249.gif
Binary file added site/public/img/sewtha/figure25.gif
Binary file added site/public/img/sewtha/figure250.gif
Binary file added site/public/img/sewtha/figure251.gif
Binary file added site/public/img/sewtha/figure252.gif
Binary file added site/public/img/sewtha/figure253.gif
Binary file added site/public/img/sewtha/figure254.gif
Binary file added site/public/img/sewtha/figure255.gif
Binary file added site/public/img/sewtha/figure256.gif
Binary file added site/public/img/sewtha/figure257.gif
Binary file added site/public/img/sewtha/figure258.gif
Binary file added site/public/img/sewtha/figure259.gif
Binary file added site/public/img/sewtha/figure26.gif
Binary file added site/public/img/sewtha/figure260.gif
Binary file added site/public/img/sewtha/figure261.gif
Binary file added site/public/img/sewtha/figure262.gif
Binary file added site/public/img/sewtha/figure264.gif
Binary file added site/public/img/sewtha/figure265.gif
Binary file added site/public/img/sewtha/figure266.gif
Binary file added site/public/img/sewtha/figure268.gif
Binary file added site/public/img/sewtha/figure269.gif
Binary file added site/public/img/sewtha/figure27.gif
Binary file added site/public/img/sewtha/figure270.gif
Binary file added site/public/img/sewtha/figure271.gif
Binary file added site/public/img/sewtha/figure272.gif
Binary file added site/public/img/sewtha/figure274.gif
Binary file added site/public/img/sewtha/figure275-2-0.gif
Binary file added site/public/img/sewtha/figure276.gif
Binary file added site/public/img/sewtha/figure277.gif
Binary file added site/public/img/sewtha/figure278.gif
Binary file added site/public/img/sewtha/figure279.gif
Binary file added site/public/img/sewtha/figure28.gif
Binary file added site/public/img/sewtha/figure280.gif
Binary file added site/public/img/sewtha/figure281.gif
Binary file added site/public/img/sewtha/figure282.gif
Binary file added site/public/img/sewtha/figure283.gif
Binary file added site/public/img/sewtha/figure284.gif
Binary file added site/public/img/sewtha/figure285.gif
Binary file added site/public/img/sewtha/figure286.gif
Binary file added site/public/img/sewtha/figure287.gif
Binary file added site/public/img/sewtha/figure288.gif
Binary file added site/public/img/sewtha/figure289.gif
Binary file added site/public/img/sewtha/figure29.gif
Binary file added site/public/img/sewtha/figure290.gif
Binary file added site/public/img/sewtha/figure291.gif
Binary file added site/public/img/sewtha/figure292.gif
Binary file added site/public/img/sewtha/figure293.gif
Binary file added site/public/img/sewtha/figure294.gif
Binary file added site/public/img/sewtha/figure295.gif
Binary file added site/public/img/sewtha/figure296.gif
Binary file added site/public/img/sewtha/figure297.gif
Binary file added site/public/img/sewtha/figure298.gif
Binary file added site/public/img/sewtha/figure299.gif
Binary file added site/public/img/sewtha/figure3.gif
Binary file added site/public/img/sewtha/figure30.gif
Binary file added site/public/img/sewtha/figure300.gif
Binary file added site/public/img/sewtha/figure301.gif
Binary file added site/public/img/sewtha/figure302A.gif
Binary file added site/public/img/sewtha/figure303.gif
Binary file added site/public/img/sewtha/figure304.gif
Binary file added site/public/img/sewtha/figure305.gif
Binary file added site/public/img/sewtha/figure306.gif
Binary file added site/public/img/sewtha/figure307.gif
Binary file added site/public/img/sewtha/figure308.gif
Binary file added site/public/img/sewtha/figure309-0-0.gif
Binary file added site/public/img/sewtha/figure31.gif
Binary file added site/public/img/sewtha/figure310.gif
Binary file added site/public/img/sewtha/figure311.gif
Binary file added site/public/img/sewtha/figure312.gif
Binary file added site/public/img/sewtha/figure313.gif
Binary file added site/public/img/sewtha/figure314.gif
Binary file added site/public/img/sewtha/figure315.gif
Binary file added site/public/img/sewtha/figure316.gif
Binary file added site/public/img/sewtha/figure317.gif
Binary file added site/public/img/sewtha/figure318.gif
Binary file added site/public/img/sewtha/figure319.gif
Binary file added site/public/img/sewtha/figure32.gif
Binary file added site/public/img/sewtha/figure320.gif
Binary file added site/public/img/sewtha/figure321.gif
Binary file added site/public/img/sewtha/figure322.gif
Binary file added site/public/img/sewtha/figure323.gif
Binary file added site/public/img/sewtha/figure324.gif
Binary file added site/public/img/sewtha/figure325.gif
Binary file added site/public/img/sewtha/figure326.gif
Binary file added site/public/img/sewtha/figure327.gif
Binary file added site/public/img/sewtha/figure328.gif
Binary file added site/public/img/sewtha/figure329.gif
Binary file added site/public/img/sewtha/figure33.gif
Binary file added site/public/img/sewtha/figure330.gif
Binary file added site/public/img/sewtha/figure331.gif
Binary file added site/public/img/sewtha/figure332.gif
Binary file added site/public/img/sewtha/figure333.gif
Binary file added site/public/img/sewtha/figure334.gif
Binary file added site/public/img/sewtha/figure335-416.gif
Binary file added site/public/img/sewtha/figure336-415.gif
Binary file added site/public/img/sewtha/figure34.gif
Binary file added site/public/img/sewtha/figure340.gif
Binary file added site/public/img/sewtha/figure341.gif
Binary file added site/public/img/sewtha/figure342.gif
Binary file added site/public/img/sewtha/figure343.gif
Binary file added site/public/img/sewtha/figure344.gif
Binary file added site/public/img/sewtha/figure346.gif
Binary file added site/public/img/sewtha/figure347.gif
Binary file added site/public/img/sewtha/figure348.gif
Binary file added site/public/img/sewtha/figure349.gif
Binary file added site/public/img/sewtha/figure35.gif
Binary file added site/public/img/sewtha/figure36.gif
Binary file added site/public/img/sewtha/figure37.gif
Binary file added site/public/img/sewtha/figure38.gif
Binary file added site/public/img/sewtha/figure39.gif
Binary file added site/public/img/sewtha/figure4.gif
Binary file added site/public/img/sewtha/figure40.gif
Binary file added site/public/img/sewtha/figure400.gif
Binary file added site/public/img/sewtha/figure406.gif
Binary file added site/public/img/sewtha/figure407.gif
Binary file added site/public/img/sewtha/figure408.gif
Binary file added site/public/img/sewtha/figure409.gif
Binary file added site/public/img/sewtha/figure41.gif
Binary file added site/public/img/sewtha/figure410.gif
Binary file added site/public/img/sewtha/figure411.gif
Binary file added site/public/img/sewtha/figure412.gif
Binary file added site/public/img/sewtha/figure413.gif
Binary file added site/public/img/sewtha/figure418.jpg
Binary file added site/public/img/sewtha/figure42.gif
Binary file added site/public/img/sewtha/figure421.gif
Binary file added site/public/img/sewtha/figure422.gif
Loading

0 comments on commit e7e5c16

Please sign in to comment.