Skip to content

Commit

Permalink
added more sphinx refs, fixed a couple of typos, enabled intersphinx …
Browse files Browse the repository at this point in the history
…(yay!)
  • Loading branch information
beniwohli committed Apr 8, 2011
1 parent e1c6ef3 commit 6768cea
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 195 deletions.
7 changes: 6 additions & 1 deletion docs/_ext/djangocms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ def setup(app):
directivename = "setting",
rolename = "setting",
indextemplate = "pair: %s; setting",
)
)
app.add_crossref_type(
directivename = "templatetag",
rolename = "ttag",
indextemplate = "pair: %s; template tag"
)
27 changes: 15 additions & 12 deletions docs/advanced/i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Example::
It also adds this prefix automatically to every ``href`` and ``form`` tag.
To install it, include
``'cms.middleware.multilingual.MultilingualURLMiddleware'`` in your project's
``MIDDLEWARE_CLASSES`` setting.
:setting:`MIDDLEWARE_CLASSES` setting.

****************
Language Chooser
****************

The ``language_chooser`` template tag will display a language chooser for the
The :ttag:`language_chooser` template tag will display a language chooser for the
current page. You can modify the template in ``menu/language_chooser.html`` or
provide your own template if necessary.

Expand All @@ -39,7 +39,7 @@ URL you may use the ``set_language_changer`` function in the view that handles
the current URL.

In the models of the current object add an optional language parameter to the
``get_absolute_url`` function::
:meth:`~django.db.models.Model.get_absolute_url` method::

from django.utils.translation import get_language

Expand All @@ -49,7 +49,7 @@ In the models of the current object add an optional language parameter to the
return reverse("product_view", args=[self.get_slug(language=language)])


In the view pass the ``get_absolute_url`` function to the
In the view pass the :meth:`get_absolute_url` method to the
``set_language_chooser`` function::

from menus.utils import set_language_changer
Expand All @@ -64,17 +64,19 @@ If the current URL is not handled by the CMS and no ``set_language_changer``
function is provided it will take the exact same URL as the current one and
will only change the language prefix.

For the language chooser to work the Multilingual URL Middleware
must be enabled.
For the language chooser to work the
:class:`cms.middleware.multilingual.MultilingualURLMiddleware` must be enabled.


*****************
page_language_url
*****************

This template_tag returns the URL of the current page in another language.
This template tag returns the URL of the current page in another language.

Example::
Example:

.. code-block:: html+django

{% page_language_url "de" %}

Expand All @@ -83,10 +85,11 @@ Example::
CMS_HIDE_UNTRANSLATED
*********************

If you put ``CMS_HIDE_UNTRANSLATED = False`` in your ``settings.py`` all pages
will be displayed in all languages even if they are not translated yet.
If you put :setting:`CMS_HIDE_UNTRANSLATED` to ``False`` in your
``settings.py`` all pages will be displayed in all languages even if they are
not translated yet.

If ``CMS_HIDE_UNTRANSLATED = True`` is in your ``settings.py``.
And you are on a page that hasn't got a english translation yet and you view the
If :setting:`CMS_HIDE_UNTRANSLATED` is ``True`` is in your ``settings.py``
and you are on a page that hasn't got a english translation yet and you view the
german version then the language chooser will redirect to ``/``. The same goes
for urls that are not handled by the cms and display a language chooser.
16 changes: 9 additions & 7 deletions docs/advanced/sitemap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@ Sitemap
Sitemaps are XML files used by Google to index your website by using their
**Webmaster Tools** and telling them the location of your sitemap.

The CMSSitemap will create a sitemap with all the published pages of your cms
The :class:`CMSSitemap` will create a sitemap with all the published pages of
your CMS


*************
Configuration
*************

Add ``django.contrib.sitemaps`` to your project's ``INSTALLED_APPS`` setting.
Add ``from cms.sitemaps import CMSSitemap`` to the top of your main `urls.py`.
Add ``url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': CMSSitemap}})``
to your urlpatterns.
* Add :mod:`django.contrib.sitemaps` to your project's :setting:`INSTALLED_APPS`
setting.
* Add ``from cms.sitemaps import CMSSitemap`` to the top of your main ``urls.py``.
* Add ``url(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': CMSSitemap}})``
to your urlpatterns.


***********************
Django.contrib.sitemaps
django.contrib.sitemaps
***********************

More information about ``django.contrib.sitemaps`` can be found in the official
More information about :mod:`django.contrib.sitemaps` can be found in the official
`Django documentation <http://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/>`_.


35 changes: 27 additions & 8 deletions docs/advanced/templatetags.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
############
Templatetags
############
#############
Template Tags
#############

.. highlightlang:: html+django

Expand All @@ -9,6 +9,8 @@ top of your template::

{% load cms_tags menu_tags %}

.. templatetag:: placeholder

***********
placeholder
***********
Expand All @@ -33,7 +35,7 @@ Example::
{% placeholder "content" or %}There is no content.{% endplaceholder %}

If you want to add extra variables to the context of the placeholder, you
should use Django's ``with`` tag. For instance, if you want to resize images
should use Django's :ttag:`with` tag. For instance, if you want to resize images
from your templates according to a context variable called ``width``, you can
pass it as follows::

Expand All @@ -53,9 +55,11 @@ pages have plugins that generate content::

{% placeholder "content" inherit or %}There is no spoon.{% endplaceholder %}

See also the ``PLACEHOLDER_CONF`` setting where you can also add extra context
variables and change some other placeholder behavior.
See also the :setting:`CMS_PLACEHOLDER_CONF` setting where you can also add extra
context variables and change some other placeholder behavior.


.. templatetag:: show_placeholder

****************
show_placeholder
Expand Down Expand Up @@ -118,11 +122,13 @@ inherit the content of its root-level ancestor::
{% endplaceholder %}


.. templatetag:: show_uncached_placeholder

*************************
show_uncached_placeholder
*************************

The same as ``show_placeholder``, but the placeholder contents will not be
The same as :ttag:`show_placeholder`, but the placeholder contents will not be
cached.

Arguments:
Expand All @@ -137,6 +143,8 @@ Example::
{% show_uncached_placeholder "footer" "footer_container_page" %}


.. templatetag:: plugins_media

*************
plugins_media
*************
Expand All @@ -156,7 +164,7 @@ Arguments:
information)

If you need to include the media from another page, for instance if you are
using a placeholder from another page using the `show_placeholder`_ tag, you
using a placeholder from another page using the :ttag:`show_placeholder` tag, you
can supply the ``page_lookup`` attribute to indicate the page in question::

{% plugins_media "teaser" %}
Expand All @@ -165,6 +173,8 @@ For a reference on what plugin media is required by a specific plugin, look at
that plugin's reference.


.. templatetag:: page_url

********
page_url
********
Expand All @@ -180,6 +190,7 @@ Example::
<a href="{% page_url "help" %}">Help page</a>
<a href="{% page_url request.current_page.parent %}">Parent page</a>

.. templatetag:: page_attribute

**************
page_attribute
Expand Down Expand Up @@ -213,6 +224,8 @@ Example::
{% page_attribute "slug" request.current_page.get_root %}


.. templatetag:: show_menu

*********
show_menu
*********
Expand Down Expand Up @@ -267,6 +280,8 @@ Navigation with a custom template::
{% show_menu 0 100 100 100 "myapp/menu.html" %}


.. templatetag:: show_menu_below_id

******************
show_menu_below_id
******************
Expand All @@ -285,6 +300,7 @@ You can give it the same optional parameters as ``show_menu``::
{% show_menu_below_id "meta" 0 100 100 100 "myapp/menu.html" %}
</ul>

.. templatetag:: show_sub_menu

*************
show_sub_menu
Expand All @@ -304,6 +320,7 @@ Or with a custom template::
{% show_sub_menu 1 "myapp/submenu.html" %}
</ul>

.. templatetag:: show_breadcrumb

***************
show_breadcrumb
Expand Down Expand Up @@ -344,6 +361,7 @@ And then in your app template::
<li>My current page</li>
{% endblock %}

.. templatetag:: page_language_url

*****************
page_language_url
Expand All @@ -361,6 +379,7 @@ function with the set_language_changer function in cms.utils.

For more information, see :doc:`i18n`.

.. templatetag:: language_chooser

****************
language_chooser
Expand Down
6 changes: 5 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
#extensions = ['sphinx.ext.autodoc']

extensions = ["djangocms"]
extensions = ['djangocms', 'sphinx.ext.intersphinx']
intersphinx_mapping = {
'python': ('http://docs.python.org/2.6', None),
'django': ('http://docs.djangoproject.com/en/1.3/', 'http://docs.djangoproject.com/en/1.3/_objects/'),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['templates']
Expand Down
12 changes: 6 additions & 6 deletions docs/extending_cms/api_references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Functions and constants

:param string title: Title of the page
:param string template: Template to use for this page. Must be in :setting:`CMS_TEMPLATES`
:param string language: Language code for this page. Must be in ``LANGUAGES``
:param string language: Language code for this page. Must be in :setting:`LANGUAGES`
:param string menu_title: Menu title for this page
:param string slug: Slug for the page, by default uses a slugified version of *title*
:param apphook: Application to hook on this page, must be a valid apphook
Expand Down Expand Up @@ -80,7 +80,7 @@ Functions and constants

Creates a :class:`cms.models.titlemodel.Title` instance and returns it.

:param string language: Language code for this page. Must be in ``LANGUAGES``
:param string language: Language code for this page. Must be in :setting:`LANGUAGES`
:param string title: Title of the page
:param page: The page for which to create this title
:type page: :class:`cms.models.pagemodel.Page` instance
Expand All @@ -104,7 +104,7 @@ Functions and constants
:type placeholder: :class:`cms.models.placeholdermodel.Placeholder` instance
:param plugin_type: What type of plugin to add
:type plugin_type: string or :class:`cms.plugin_base.CMSPluginBase` subclass, must be a valid plugin
:param string language: Language code for this plugin, must be in ``LANGUAGES``
:param string language: Language code for this plugin, must be in :setting:`LANGUAGES`
:param string position: Position to add this plugin to the placeholder, must be a valid django-mptt position
:param kwargs data: Data for the plugin type instance

Expand Down Expand Up @@ -196,12 +196,12 @@ cms.plugin_base
.. attribute:: model

Is the CMSPlugin model we created earlier. If you don't need a model
because you just want to display some template logic, use CMSPlugin from
``cms.models`` as the model instead.
because you just want to display some template logic, use ``CMSPlugin``
from ``cms.models`` as the model instead.

.. attribute:: module

Will be group the plugin in the plugin editor. If module is None,
Will be group the plugin in the plugin editor. If module is ``None``,
plugin is grouped "Generic" group.

.. attribute:: name
Expand Down
Loading

0 comments on commit 6768cea

Please sign in to comment.