-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre and Post Filters on Autofilter functionality #189
Comments
I might have missed something, but isn't it already doable as is?
Did it not work if you try to solve the problem like this? If so, may be the auto-filter function is "copying" the |
The way that I'm working with this right now is by having a def finalize(doc):
filters = doc.get_metadata("panflute-filters", [])
prefilters = doc.get_metadata("panflute-filters-pre", [])
postfilters = doc.get_metadata("panflute-filters-post", [])
filters = [*prefilters, *filters, *postfilters]
doc.metadata["panflute-filters"] = filters This allows for Why am I doing this. I'm using But still if you had a different case, like a filter that finds and includes local file references (like lists of links and such), you could not worry about does, and leave the link normalizing step to a post filter, for instance inserting local references to The main reason I'm proposing this is that I don't see it hurting, and it's just an additive change. |
My first question would be if it works to put pre-panflute.py as the first (and only) panflute-filters? And the reaction is that it seems it shouldn’t be in panflute by default. Just like pandoc that the default metadata/args options aren’t the most general but is specific to single document generation in mind. But funny you should mention about static site generator as I was just thinking about in the last 2 hours if I should build a static site generator centering around pandoc and panflute. I have been using a few site generators including a custom make file for simple cases but I find them lacking and not “native-pandoc” enough for me. If I write one it would be a Python solution with some other dependencies including some way to have a make-like dependency generating capability and automatic parallelization (basically the advantage of my make workflow but addressing some limitations there and borrow some concepts from other site generators.) |
No, because once the autofilter starts running, you have a defined queue of filters that is already in place, changing the value of panflute-filter variable would not take any effect on the filter queue that we have currently running. I'm currently polishing my project, I might upload it to GitHub during the weekend. |
Right, that was what I meant in the beginning: shouldn't we change this behavior, that |
Ok, It sounds doable, but we would need to change the way autofilter is doing the filter lookup and filter execution, also, we could make a filter that calls himself infinitely like filters = doc.get_metadata("panflute-filters", [])
filters = [*filters, "this_filter.py"]
doc.metadata["panflute-filters"] = filters And I guess this is not desirable. I've looked on how |
I think more about it and am now thinking may be the mutating
About resolving local and global
By the way, just so I am not misunderstanding your setup. Your |
The extra metadata files are added the following way
In order to make my static site work, I inject some values calculated by my This allows to have one global file that has metadata like your Google Analytics ID, and then you can have in your template file the placeholder for it, and that's it, also it allows you to include CSS at a global scale. This metadata files, get overwritten, from left to right, meaning that if
Then the value that takes wins is the one on In reality, I'm using more than 2 metadata files plus the metadata block on the document itself.
Good point, didn't think about that. |
Hi guys, currently I'm running several filters and I had the need to create my own metadata value named
panflute-filters-pre
, what I do with that variable is to receive a list of filters that and prepend it to thepanflute-filters
variable, currently it runs with another filter that does that, but I was thinking that we can introduce this in to panflute's functionality.Having
panflute-filters-pre
andpanflute-filters-post
.If you give me a green light on this, I can write it and submit the PR.
The text was updated successfully, but these errors were encountered: