[tutorial] removing blank lines and leading whitespace in code excerpts

In Chapters 2 to 4:
 - Removing unnecessary blank lines at the end of some code excerpts.
 - Removing leading whitespace so that all code samples are consistent
with Chapter (which has no leading space for, e.g., HTML excerpts).
 - Other minor code excerpt cleanup.
Merge pull request #7 from chalin/patch-9-chap-02-code-excerpt-cleanup

[tutorial] removing blank lines and leading whitespace in code excerpts (Chap. 2 to 4)
Merge remote-tracking branch 'upstream/master'

Merge upstream/master.