Replace doc code

In the ReStructuredText (*.txt) files, many of the copies of Python code were out of date. Replaced copies of Python code with links to sections of the corresponding files. This dramatically reduced the number of lines of code to maintain. This will help keep documentation in sync with code (but will not guarantee synchronization). Renamed two ReStructuredText files to match corresponding Python files. Modified code files for improved readability. Modified .gitignore to ignore tmp directories.
Thanks for the pep8 fixes.
There are still a couple of "W291 trailing whitespace" and "E203 whitespace before ':'" in the lines you've added. If you could take care of those, that would be great.
We will have to take care of a full pep8 pass on the code at some point, though.