acrylamid-like filters #914

Closed
gour opened this Issue Nov 16, 2013 · 4 comments

Comments

Projects
None yet
3 participants

gour commented Nov 16, 2013

Some possible ideas for upcoming release(s) of Nikola...one is to implement filters in the way as Acrylamid does it by allowing to have them defined in three ways:

  • globally, as in:
FILTERS = [Markdown, ]
  • in a view like:
'/rss/': {'view': 'rss', filters: 'summarize'}
  • and per post, like: (In progress in a branch)

---
title: Test
filter: reST

---
Owner

Kwpolska commented Nov 16, 2013

Way 1 is already supported by Nikola:

# conf.py
from nikola import filters
FILTERS = {
    '.html': # apply to all files that *end up* as .html (i.e. all that is not .php or assets)
        [filters.typogrify],
}

We have only a tidy and typogrify filter for html, and some additional filters for images and JS/CSS (yui compressor) and we could create more.

Way 2 needs #915 first.

Way 3 may be supported:

.. title: for some weird reason, I want to tidy this up.
.. filters: ["tidy"]
import nikola.filters
for i in json.loads(self.meta[lang]['filters']):
    getattr(nikola.filters, i)(self.destination_path) # or so — this is untested sample code

gour commented Nov 16, 2013

Way 1 is already supported by Nikola:

That's clear and I just mentioned it for the sake of completeness.

Way 2 needs #915 first.

Another good reason for #915. ;)

Way 3 may be supported:

What about e.g. markdown?

Owner

Kwpolska commented Nov 16, 2013

Do you mean a filter to parse this file with markdown? That cannot be implemented around here.


Do you mean this was a reST example, what should I do for markdown?? If yes, then

<!--
.. title: the usual way
.. filters: ['tidy']
-->

gour commented Nov 16, 2013

Do you mean this was a reST example, what should I do for markdown?? If yes, then

Yes, that was what I meant. ;)

Thanks.

ralsina added the enhancement label Apr 18, 2014

@Kwpolska Kwpolska modified the milestone: Whenever, v7.0.0 May 16, 2014

@ralsina ralsina added a commit that referenced this issue Jun 13, 2015

@ralsina ralsina Per-post/page filters (Issue #914) a5fd510

Kwpolska closed this in 4bb0b0c Jun 13, 2015

@Kwpolska Kwpolska added a commit that referenced this issue Jun 13, 2015

@Kwpolska Kwpolska Fix #914
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
11cb0bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment