jason kirtland avatar jason kirtland committed 05d2ccf

Some more markup doc refactoring.

Comments (0)

Files changed (2)

docs/source/templating/index.rst

 .. toctree::
    :maxdepth: 2
 
+   settings
    genshi
-   jinja2
+   jinja2

docs/source/templating/jinja2.rst

 
 .. doctest:: generatorintro
 
+   >>> from flatland.out.markup import Generator
    >>> from flatland import String
-   >>> from flatland.out.markup import Generator
-
-.. doctest:: generatorintro
-
-   >>> gen = Generator()
+   >>> html = Generator()
    >>> el = String('foo', name='thinger')
-   >>> print gen.input(el)
+   >>> print html.input(el)
    <input name="thinger" value="foo" />
 
 It's quite simple to output any tag you need with flatland.
 
 .. doctest:: generatorintro
 
-   >>> print gen.tag('a', href="/", contents="Home")
+   >>> print html.tag('a', href="/", contents="Home")
    <a href="/">Home</a>
 
 Flatland markup generators can be used anywhere you'd use a Unicode
 .. doctest:: generatorintro
 
     >>> from jinja2 import Template
-    >>> template = Template('''\
-    ... {{ gen.input(el) }}
-    ... ''')
+    >>> template = Template("""\
+    ... {{ html.input(el) }}
+    ... """)
     >>> el = String(name='username')
-    >>> print template.render(gen=gen, el=el)
+    >>> print template.render(html=html, el=el)
     <input name="username" value="" />
 
 And some time-saving generation features are available.
 
 .. doctest:: generatorintro
 
-    >>> template = Template('''\
-    ... {{ gen.set(auto_domid=True, auto_for=True) -}}
-    ... {{ gen.label(el) }}
-    ... {{ gen.input(el) }}
-    ... ''')
+    >>> template = Template("""\
+    ... {{ html.set(auto_domid=True, auto_for=True) -}}
+    ... {{ html.label(el) }}
+    ... {{ html.input(el) }}
+    ... """)
     >>> el = String(name='username')
-    >>> gen = Generator(markup='html')
-    >>> print template.render(gen=gen, el=el)
+    >>> html = Generator(markup='html')
+    >>> print template.render(html=html, el=el)
     <label for="f_username"></label>
     <input name="username" value="" id="f_username">
 
 
 .. doctest:: generatorintro
 
-    >>> print gen.tag('wookie', contents="wookies are not really real")
+    >>> print html.tag('wookie', contents="wookies are not really real")
     <wookie>wookies are not really real</wookie>
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.