ZorkFox
I would like to have special wiki pages that can be used as templates on other pages. As just a simple example, if I create a menu internal to the wiki, I want to be able to change it in one spot rather than on all ten, fifty, or one hundred pages of my wiki that also use that menu. This is a staple of MediaWiki, so I don't know if that puts a kibosh on using it for Obsidian Portal.
Edit: this was meant to go on the reforging beta forum, but I seem to have erred in how to go about posting to it.
Comments
One of the main reasons I want to do this is that it would help people deal with any breaking changes that we make in the reforging. I don't think we're going to be able to do what we want without fundamentally changing the underlying HTML structure, which will break a lot of carefully crafted pages. Like you say, if that involves editing 100s of pages, then it's a real chore. But, if you could edit a template...
So, I can't promise anything right now, but I will definitely be looking into some form of templating. It will probably be much less fancy than anyone is hoping (like no fancy variable substitution or embedded scripting), and perhaps a little rough around the edges, but if it can ease the pain of migrating to the new layout, that's a huge plus.
Also, thanks for referencing MediaWiki. If you can point me to examples of where others are doing things, that really helps me research things. If there is anything in particular that you like or dislike about MediaWiki's implementation, please say so. For example, if their way of including or referencing a template is good or bad, tell me why.
Then, when rendering, it basically invokes the renderer again on the referenced page and dumps the content into the local page. I think it only lets you render one level deep, so you can avoid having to do any sort of depth analysis or cycle breaking logic. (Even though multi-level embeds could be useful, I really don't think it's a necessary feature.)
* The ability to request a page as a template (?template=true) whereupon only its content would be served
* A client script which does a replace of a properly formed tag (as above) with the above, fetched AJAX style
Supporting static token replacement would be easy enough in that context, as you can simply have the script extract additional parameters from the tag (maybe structure the tag as JSON?) and replace them in for tokens. You could even support things like variable row counts in a templated table that way as a little stretch.
Edit: Possible down sides to this approach would be slightly longer rendering time for pages (probably not even noticeable for most users), and some extra requests to the server (which may or may not be a thing you care about).
The more I think about it, the more workable that sounds... I'd probably even have fun whipping up a working example if you're interested.
I think I see the idea here, with serving the template and the content separately and then combining them client side. I'm not sure that's the route I would take because it's much easier (for me) to do heavy lifting on the server side. But any final product will probably be a combination of server and client side. I really want to make the overall UX much nicer, and that usually means more javascript.