willkg / douglas

DEAD PROJECT: File based static rendering blog system
Other
2 stars 3 forks source link

implement an "ignore_future" plugin #10

Closed willkg closed 10 years ago

willkg commented 10 years ago

Need to implement (and enable by default) a plugin that removes entries with mtimes that are in the future so they don't get rendered unless explicitly referenced.

It might be interesting to list them all in future/ kind of like drafts.

willkg commented 10 years ago

Ugh. There's no good way to do this with the existing processing model. The problem is that a bunch of plugins use tools.walk to get a list of all the things in the blog, but that returns a list of file paths and you can't determine from those file paths what's a blog entry in the future or not without opening each file, parsing it and reading the published_date. That's a whole lot of work that's then thrown away.

I think I'll toy with reworking walk so that it runs the results through a callback letting plugins add to or remove items. That'll be a messy callback, but walk is pretty messy. We really want a "get_entries" tools function. Maybe I'll implement that first.

Then implement an ignore_future plugin that looks at a data file to see which file paths were published when and nixes anything in the future. It can call filestat on each file path that isn't in the data file.

willkg commented 10 years ago

Implemented in 6667e262caa1f6fc26fcd0ba0e99e98672268af5

It's easy to use--just add it to the load_plugins list.

However, to implement this, I had to do a bunch of reworking of the internals, so it's possible I broke some things.