Fabian Büchler avatar Fabian Büchler committed ab27929

Added documentation about installation and settings.

Also removed the RESTRUCTUREDTET_FILTERS setting, because that seems to be useless.

Comments (0)

Files changed (3)

docs/installation.rst

 
 .. _pip: http://www.pip-installer.org/
 .. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall
+
+Requirements
+------------
+
+django-markupmirror depends on:
+
+* `Django`_ 1.4+ (for now tested with 1.4 only), obviously.
+
+* `FeinCMS`_ 1.5+ (for now tested with 1.5.3 only), if you want to use the page
+  content-type.
+
+* `Markdown 2.1+`_, if you want to use the ``MarkdownMarkup`` converter.
+
+* `Docutils 0.8+`_, if you want to use the ``ReStructuredTextMarkup``
+  converter.
+
+* `Textile 2.1+`_, if you want to use the ``TextileMarkup`` converter.
+
+The three latter will be available automatically if the respective dependencies
+are met.
+
+.. _Django: http://pypi.python.org/pypi/Django
+.. _FeinCMS: http://pypi.python.org/pypi/FeinCMS
+.. _Markdown 2.1+: http://pypi.python.org/pypi/Markdown
+.. _Docutils 0.8+: http://pypi.python.org/pypi/docutils
+.. _Textile 2.1+: http://pypi.python.org/pypi/textile
+
+Markup Types
+------------
+
+The markup-types available by default are:
+
+``plaintext``
+    Plain text markup. Converts URLs to links and linebreaks to breaks and
+    paragraphs.
+
+``html``
+    Allows HTML. Therefore potentially unsafe.
+
+``markdown``
+    Converts `Markdown`_ to HTML.
+
+``restructuredtext``
+    Converts `reStructuredText`_ to HTML.
+
+``textile``
+    Converts `Textile`_ to HTML.
+
+Settings & Configuration
+------------------------
+
+Use the configuration variables below in your ``settings.py`` to customize the
+behaviour of django-markupmirror:
+
+.. py:data:: MARKUPMIRROR_DEFAULT_MARKUP_TYPE
+
+   Defines any of the above markup-types as default for fields where no
+   ``markup_type`` or ``default_markup_type`` has been set explicitly.
+
+   Defaults to ``plaintext``.
+
+.. py:data:: MARKUPMIRROR_MARKDOWN_EXTENSIONS
+
+   Defines the extensions to load for `Markdown`_. Markdown's package
+   documentation contains `a list of available extensions`_.
+
+   Defaults to ``['extra', 'headerid(level=2)']``.
+
+.. py:data:: MARKUPMIRROR_MARKDOWN_OUTPUT_FORMAT
+
+   Defines the output format for Markdown. One of ``HTML4``, ``XHTML`` and
+   ``HTML5``.
+
+   Defaults to ``HTML5``.
+
+.. py:data:: MARKUPMIRROR_TEXTILE_SETTINGS
+
+   Dictionary of arguments passed directly to the Textile converter defined in
+   ``textile.functions.textile``.
+
+   The converter's default function signature is:
+   ``head_offset=0, html_type='xhtml', auto_link=False, encoding=None,
+   output=None``.
+
+   Defaults to: ``{'encoding': 'utf-8', 'output': 'utf-8'}``
+
+.. py:data:: MARKUPMIRROR_FEINCMS_INIT_TEMPLATE
+
+   Defines the template used by FeinCMS to initialize Pages with
+   ``MarkupMirrorContent`` blocks.
+
+   .. deprecated:: 0.1a2
+      This will soon be obsolete due to a generic jQuery plugin to initialize
+      the CodeMirror editor anywhere.
+
+.. py:data:: MARKUPMIRROR_FEINCMS_INIT_CONTEXT
+
+   Context passed to the ``MARKUPMIRROR_FEINCMS_INIT_TEMPLATE``.
+
+   .. deprecated:: 0.1a2
+      This will soon be obsolete due to a generic jQuery plugin to initialize
+      the CodeMirror editor anywhere.
+
+.. _Markdown: http://daringfireball.net/projects/markdown/
+.. _reStructuredText: http://docutils.sourceforge.net/rst.html
+.. _Textile: http://www.textism.com/tools/textile/
+.. _Markdown's package documentation: http://packages.python.org/Markdown/
+.. _a list of available extensions:
+    http://packages.python.org/Markdown/extensions/

markupmirror/markup/restructuredtext.py

 from django.utils.encoding import smart_str
 from django.utils.translation import ugettext_lazy as _
 
-from markupmirror import settings
 from markupmirror.markup.base import BaseMarkup
 from markupmirror.markup.base import register_markup
 
     title = _(u"reStructuredText")
 
     def __init__(self):
-        self.filter_settings = settings.RESTRUCTUREDTEXT_FILTER
         self.restructuredtext = publish_parts
 
     def convert(self, markup):
         parts = self.restructuredtext(
             source=smart_str(markup),
-            writer_name='html4css1',
-            settings_overrides=self.filter_settings)
+            writer_name='html4css1')
         # Intentionally return ``html_body`` instead of ``fragment`` as
         # Django's templatetag does. ``html_body`` also includes the document's
         # title and subtitle, and if the first parts of ``markup`` are

markupmirror/settings.py

     'MARKUPMIRROR_MARKDOWN_OUTPUT_FORMAT',
     'html5')
 
-# Filter settings for reStructuredText
-RESTRUCTUREDTEXT_FILTER = getattr(settings,
-    'MARKUPMIRROR_RESTRUCTUREDTEXT_FILTER',
-    {})
-
 # Textile settings
 TEXTILE_SETTINGS = getattr(settings,
     'MARKUPMIRROR_TEXTILE_SETTINGS',
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.