`` .
Please avoid using the quote sign (``"`` ) for quoting, and use the relevant html tags (```` ) -- it is impossible to distinguish right and left quotes with the quote sign, and some more sophisticated output methods work better with that distinction.
Multi-line Code Snippets
------------------------
Multi-line code snippets should be delimited with a
tag, with a mandatory "class" attribute. The
conventionalized classes are "python" , "python-interpreter" ,
and "shell" . For example:
"python"
~~~~~~~~
Original markup:
::
For example, this is how one defines a Resource:
from twisted.web import resource
class MyResource(resource.Resource):
def render_GET(self, request):
return "Hello, world!"
Rendered result:
For example, this is how one defines a Resource:
.. code-block:: python
from twisted.web import resource
class MyResource(resource.Resource):
def render_GET(self, request):
return "Hello, world!"
Note that you should never have leading indentation inside a
block -- this makes it hard for readers to
copy/paste the code.
"python-interpreter"
~~~~~~~~~~~~~~~~~~~~
Original markup:
::
>>> from twisted.web import resource
>>> class MyResource(resource.Resource):
... def render_GET(self, request):
... return "Hello, world!"
...
>>> MyResource().render_GET(None)
"Hello, world!"
Rendered result:
.. code-block:: pycon
>>> from twisted.web import resource
>>> class MyResource(resource.Resource):
... def render_GET(self, request):
... return "Hello, world!"
...
>>> MyResource().render_GET(None)
"Hello, world!"
"shell"
~~~~~~~
Original markup:
::
$ twistd web --path /var/www
Rendered result:
.. code-block:: console
$ twistd web --path /var/www
Code inside paragraph text
--------------------------
For single-line code-snippets and attribute, method, class,
and module names, use the tag, with a class of
"API" or "python" . During processing, module or class-names
with class "API" will automatically be looked up in the API
reference and have a link placed around it referencing the
actual API documents for that module/classname. If you wish to
reference an API document, then make sure you at least have a
single module-name so that the processing code will be able to
figure out which module or class you're referring to.
You may also use the ``base`` attribute in conjunction
with a class of "API" to indicate the module that should be prepended
to the module or classname. This is to help keep the documentation
clearer and less cluttered by allowing links to API docs that don't
need the module name.
Original markup:
::
To add a twisted.web.static.File
instance to a Resource instance, do
myResource.putChild("resourcePath",
File("/tmp")) .
Rendered result:
To add a :api:`twisted.web.static.File `
instance to a :api:`twisted.web.resource.Resource `
instance, do
``myResource.putChild("resourcePath", File("/tmp"))`` .
Headers
-------
It goes without mentioning that you should use in
a sane way -- should only appear once in the
document, to specify the title. Sections of the document should
use , sub-headers , and so on.
XHTML
-----
XHTML is mandatory. That means tags that don't have a
closing tag need a "/" ; for example, `` ``
. Also, tags which have "optional" closing tags in HTML
*need* to be closed in XHTML; for example,
``foo``
Tag Case
--------
All tags will be done in lower-case. XHTML demands this, and
so do I. :-)
Footnotes
---------
Footnotes are enclosed inside
```` . They must not
contain any markup.
Suggestions
-----------
Use ``lore -o lint`` to check your documentation
is not broken. ``lore -o lint`` will never change
your HTML, but it will complain if it doesn't like it.
Don't use tables for formatting. 'nuff said.
__all__
-------
``__all__`` is a module level list of strings, naming
objects in the module that are public. Make sure publically exported classes,
functions and constants are listed here.
|