Skip to content

Commit 6fc9f61

Browse files
UWEditorPythonCHB
authored andcommitted
Html tutorial review (#166)
* finished! the html_render tutorial * a couple typos * added more -- specifically generator comprehensions (#164) * remove file * Update README.rst * Update README.rst requirements also has ipython.. which wasn't installed on my system * a little copy-editing * Update html_renderer_tutorial.rst * Update html_renderer_tutorial.rst * Update html_renderer_tutorial.rst * Update html_renderer_tutorial.rst * Proof of tutorial Did a light proof, focusing on spelling and obvious issues with grammar (lack of capitalization, periods for sentences), and formatting of code terms. I only removed -- when they were used in an obvious incorrect way, such as substituting for an opening comma, or for the beginning of a sentence. * a bit of copy-editing
1 parent b37a128 commit 6fc9f61

File tree

11 files changed

+1211
-118
lines changed

11 files changed

+1211
-118
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ These documents are written in `Restructured Text <http://docutils.sourceforge.n
1919

2020
To build the docs, you need Python, Sphinx, and sphinx-rtd-theme::
2121

22-
python3 -m pip install sphinx, sphinx-rtd-theme
22+
pip3 install -r requirements.txt
2323

2424
Should do it.
2525

source/examples/html_render/run_html_render.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ def render_page(page, filename, indent=None):
190190

191191
# render_page(page, "test_html_output7.html")
192192

193-
# # Step 8
194-
# ########
193+
# # Step 8 and 9
194+
# ##############
195195

196196
# page = hr.Html()
197197

source/examples/html_render/test_html_render.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def test_render_element():
184184

185185
# #####################
186186
# # indentation testing
187+
# # Uncomment for Step 9 -- adding indentation
187188
# #####################
188189

189190

@@ -192,11 +193,12 @@ def test_render_element():
192193
# Tests that the indentation gets passed through to the renderer
193194
# """
194195
# html = Html("some content")
195-
# file_contents = render_result(html, ind=" ")
196+
# file_contents = render_result(html, ind=" ").rstrip() #remove the end newline
196197

197198
# print(file_contents)
198199
# lines = file_contents.split("\n")
199200
# assert lines[0].startswith(" <")
201+
# print(repr(lines[-1]))
200202
# assert lines[-1].startswith(" <")
201203

202204

@@ -230,7 +232,7 @@ def test_render_element():
230232

231233
# assert lines[4].startswith(3 * Element.indent + "some")
232234

233-
# this is for testing indenting -- we'll wait 'till we get to that
235+
234236
# def test_element_indent1():
235237
# """
236238
# Tests whether the Element indents at least simple content

source/exercises/html_renderer.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ where ``link`` is the link, and ``content`` is what you see. It can be called li
377377

378378
A("http://google.com", "link to google")
379379

380+
and it should render like::
381+
382+
<a href="http://google.com">link to google</a>
383+
384+
380385
You should be able to subclass from ``Element``, and only override the ``__init__`` --- calling the ``Element`` ``__init__`` from the ``A`` ``__init__``
381386

382387
You can now add a link to your web page.

source/exercises/html_renderer_tutorial.rst

Lines changed: 240 additions & 76 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)