Skip to content

Commit

Permalink
[svn] Using HyperText instead of XML for code-block directive.
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
bbangert committed Aug 11, 2006
1 parent 24da37a commit 650647d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions docs/flickrsearch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The ``javascripts_app`` WSGI application maps any requests to ``/javascripts/``

Knowing that we don't need to worry about JavaScript files, edit the file ``templates/autohandler`` with the following content:

.. code-block:: XML
.. code-block:: HyperText

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Expand Down Expand Up @@ -101,7 +101,7 @@ It should be pretty straight forward, we import the ``flickr`` API module, set t

Time to create the two templates. Create ``templates/flickr.myt`` with this content:

.. code-block:: XML
.. code-block:: HyperText

<% h.form_remote_tag(
url = h.url(action="search"),
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ If you visit http://127.0.0.1:5000/ you will see the welcome page (``127.0.0.1``

Try creating a new file named ``test.html`` in the ``helloworld/public`` directory with the following content:

.. code-block:: XML
.. code-block:: HyperText

<html>
<body>
Expand Down
2 changes: 1 addition & 1 deletion docs/interactive_debugger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ You can change the theme by creating a new template. For example, a very simple

The values are automatically substituted by the error middleware. You can also add ``%(prefix)s`` which is replaced by the path to your application so you can include CSS files or images. For example if your application had a file called ``style.css`` in a directory called ``css`` within your ``public`` directory, you could add the following line to your template to ensure that the CSS file was always correctly found:

.. code-block:: XML
.. code-block:: HyperText

<link rel="stylesheet" href="%(prefix)s/css/style.css" type="text/css" media="screen" />

Expand Down
2 changes: 1 addition & 1 deletion docs/internationalization.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Translations Within Templates

You can also use the ``h._()`` command within templates in exactly the same way you do in code. For example:

.. code-block:: XML
.. code-block:: HyperText

<% h._('Hello') %>

Expand Down
28 changes: 14 additions & 14 deletions docs/quick_wiki.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Templates

We will make use of a feature of the Myghty templating language called inheritance for our project. Add the main page template in ``templates/autohandler``:

.. code-block:: XML
.. code-block:: HyperText

<html>
<head>
Expand Down Expand Up @@ -339,7 +339,7 @@ Replace the existing ``index()`` action with this:

Add a template called ``templates/page.myt`` that looks like this:

.. code-block:: XML
.. code-block:: HyperText

<h1 class="main"><% c.title %></h1>
<% c.content %>
Expand All @@ -350,7 +350,7 @@ This template simply displays the page title and content.

We also need a template for pages that don't already exist. They need to display a message and link to the edit action so that they can be created. Add a template called ``templates/new_page.myt`` that looks like this:

.. code-block:: XML
.. code-block:: HyperText

<h1 class="main"><% c.title %></h1>
<p>This page doesn't exist yet.
Expand Down Expand Up @@ -402,7 +402,7 @@ To edit the wiki page we need to get the content from the database without chang

and the create the ``templates/edit.myt`` file:

.. code-block:: XML
.. code-block:: HyperText

<h1 class="main">Editing <% c.title %></h1>

Expand Down Expand Up @@ -463,7 +463,7 @@ Add the ``list()`` action:

The ``list()`` action simply gets all the pages from the database. Create the ``templates/titles.myt`` file to display the list:

.. code-block:: XML
.. code-block:: HyperText

<h1 class="main">Title List</h1>

Expand All @@ -477,7 +477,7 @@ The ``list()`` action simply gets all the pages from the database. Create the ``

Finally edit ``templates/autohandler`` to add a link to the title list so that the footer looks like this:

.. code-block:: XML
.. code-block:: HyperText

<p class="footer">
Return to the <% h.link_to('FrontPage', h.url_for(action="index", title="FrontPage")) %>
Expand All @@ -496,13 +496,13 @@ Since this tutorial is designed to get you familiar with as much of Pylons core

Add this line to ``templates/autohandler`` before ``</head>``:

.. code-block:: XML
.. code-block:: HyperText

<% h.javascript_include_tag('/javascripts/effects.js', builtins=True) %>

.. Note:: The ``h.javascript_include_tag()`` helper will create links to all the built-in JavaScripts we need and also add ``/javascripts/effects.js`` creating HTML that looks like this when you access it from a browser:

.. code-block:: XML
.. code-block:: HyperText

<script src="/javascripts/prototype.js" type="text/javascript"></script>
<script src="/javascripts/scriptaculous.js" type="text/javascript"></script>
Expand All @@ -520,13 +520,13 @@ The ``javascripts_app`` WSGI application maps any requests to ``/javascripts/``

Now for the AJAX! We want all the titles in the titles list to be draggable so we enclose each of them with a ``<span>`` element with a unique ID. Edit ``templates/titles.myt`` to replace this line:

.. code-block:: XML
.. code-block:: HyperText

<% title %>&nbsp;[<% h.link_to('visit', h.url_for(title=title, action="index")) %>]

with this:

.. code-block:: XML
.. code-block:: HyperText

<span id="page-<% title %>"><% title %></span>
&nbsp;[<% h.link_to('visit', h.url_for(title=title, action="index")) %>]
Expand All @@ -536,7 +536,7 @@ This marks each of the titles as a draggable element that reverts to its origina

We better have somewhere to drop the titles to delete them so add this before the ``<ul id="titles">`` line in ``templates/titles.myt`` :

.. code-block:: XML
.. code-block:: HyperText

<div id="trash">
Delete a page by dragging its title here
Expand Down Expand Up @@ -571,7 +571,7 @@ When a title is dropped on the ``trash`` box an AJAX request will be made to the

The title of the page is obtained from the ``id`` element and the object is loaded and then deleted. The change is saved ``objectstore.flush()`` before the list of remaining titles is rendered by the template ``templates/list.myt`` which you should create with the following content:

.. code-block:: XML
.. code-block:: HyperText

% for title in c.titles:
<li>
Expand All @@ -586,7 +586,7 @@ Visit http://127.0.0.1:5000/page/list and have a go at deleting some pages. You

One last tidy up we can make before we finish. You might have noticed that the ``list.myt`` and ``titles.myt`` use the same code to produce the lists. In the interests of keeping code duplication to a minimum edit ``templates/titles.myt`` to replace this code:

.. code-block:: XML
.. code-block:: HyperText

% for title in c.titles:
<li>
Expand All @@ -597,7 +597,7 @@ One last tidy up we can make before we finish. You might have noticed that the `

With this code:

.. code-block:: XML
.. code-block:: HyperText

<% render('/list.myt', fragment=True) %>

Expand Down

0 comments on commit 650647d

Please sign in to comment.