Skip to content

Commit

Permalink
added replace docs + fixed typo in docs + \n in filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoepp committed Dec 8, 2014
1 parent 8756d5e commit e3aef4f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion acrylamid/filters/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def transform(self, content, entry, *args):

for k,v in self._db.items():
content = content.replace(k, v)
return content
return content
34 changes: 31 additions & 3 deletions docs/filters/post.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,34 @@ INTRO_IGNORE : a list of tags

see ``SUMMARIZE_IGNORE``

.. _filters-post-replace:

replace
-------

Replaces user-defined strings with assigned values. This can be used to
include arbitrary information or to replace common symbols like ``:-)``
into proper HTML code matching with the theme.

In order to know what to replace, an additional :doc:`conf.py` parameter is
required for configuration of the filter.

REPLACE_RULES : a dict (may be empty)

The keys of the dictionary are describing the strings to replace with
their corresponding value. A missing or empty dict raises a warning
within the logs and disables the filter even when it is included in
the filter chain.

An example of how a typical rule-set for this filter may look like:

::

REPLACE_RULES = {
':-)' : '<i class="fa fa-smile-o"></i>',
'$last_compilation_date$' : datetime.now().strftime("%Y-%m-%d"),
}

.. _filters-post-hyphenate:

hyphenate
Expand Down Expand Up @@ -138,7 +166,7 @@ All filters are applied in the order as they are written down.

.. code-block:: python
TYPOGRAPHY_MODE = "2" # in your conf.oy
TYPOGRAPHY_MODE = "2" # in your conf.py
`Smarty Pants`_ has modes that let you customize the modification. See `their
options`_ for reference. Acrylamid adds a custom mode ``"a"`` that behaves like
Expand All @@ -163,8 +191,8 @@ acronyms
This filter is a direct port of `Pyblosxom's acrynoms plugin
<http://pyblosxom.bluesock.org/1.5/plugins/acronyms.html>`_, that marks acronyms
and abbreviations in your text based on either a built-in acronyms list or a
user-specified. To use a custom list just add the FILE to your conf.py like
this:
user-specified. To use a custom list just add the FILE to your :doc:`conf.py`
like this:

::

Expand Down

0 comments on commit e3aef4f

Please sign in to comment.