syegulalp / mercury

Pure Python CMS and blogging solution using static HTML
http://mercury.genjipress.com
Other
18 stars 2 forks source link

Alternative way to do include expansion #81

Closed syegulalp closed 9 years ago

syegulalp commented 9 years ago

Since we changed to the new include model, one of the problems we have with this is it doesn't easily make it possible to expand the list of includes for a given template, since they can be references dynamically (e.g., by way of a variable).

I'd still like to have include expansion, but it looks like we'll need to find a new way to do it.

syegulalp commented 9 years ago

Possibility: Do include expansions ONLY for includes that are statically described, and which map to a valid name. This seems like the easiest approach.

syegulalp commented 9 years ago

I'm planning on doing one of a few possible things:

1) expand by way of a context. This defaults to the most recent fileinfo available for the template, but I plan to make that modifiable. 2) expand by way of simple regex. This only works if you're dealing with includes that have static strings. Anything that doesn't evaluate simply gets ignored. 3) same as 1), but we loop through all available fileinfos for the template and create an aggregate. This could be incredibly slow on big sites, though. Probably not worth it. 4) same as 2), but for anything we don't recognize, we drop back to the 1) context.

syegulalp commented 9 years ago

2) may be the simplest approach for the expand-collapse functionality we're planning to build. 1) is the most sophisticated, but may make it difficult for people to figure out what they're ultimately going to end up with if they use a lot of computed includes.

syegulalp commented 9 years ago

Another, potentially farfetched solution, is to list includes as generated for each fileinfo. But this could get really unwieldly.

syegulalp commented 9 years ago

I'm going to stick with the solution we have now for cross-template inclusion, and add a template function specifically for doing SSI-type includes. That way there will be no conflict of function between them. Also, I will want to have some notes about how to optimize for SSIs on servers that support it, but that can come later.