Forum:Introducing documentation and timeline templates
From Tardis Wiki, the free Doctor Who reference
Forums → Archive index → Panopticon archives → Introducing documentation and timeline templates
There are two new templates that have been added to the wiki.
The first is Template:Timeline, for use on, oddly enough, the timeline pages.
The old navigation code looks like this:
2061 | 21st century 2060s |
2063 |
By comparison, the new template creates the following output:
When you check out the template, you'll find instructions for how to use it on year, decade and century pages. If you're editing or surfing through the timeline pages and come across the old code, please take a few seconds to replace it with the new template. :)
Which brings us to Template:Documentation, which is intended to make creating and documenting new user templates easier.
- → Koschei:
- Life. But not as we know it. 16:56, March 26, 2010 (UTC)
- I really like the "standardization" that the documentation template will bring. Very crisp. Not so wild about the timeline thing, but it's better than what was there before. I don't visit year/century pages all that often so I was surprised to discover that the previous navigation was apparently not a template at all. So who's actually going to be doing the laborious work of putting this new temp on the hundreds of pages involved? CzechOut ☎ | ✍ 12:50, March 27, 2010 (UTC)
- The beautiful thing is that once all those pages are hit with the template, it'll be trivial to insert a new navigation panel if someone feels like designing it. Until then, the layout at least has the advantage of being easier to navigate visually for folks who have problems with closely grouped strings of text on screen.
- → Koschei:
- Life. But not as we know it. 18:22, March 29, 2010 (UTC)
- The beautiful thing is that once all those pages are hit with the template, it'll be trivial to insert a new navigation panel if someone feels like designing it. Until then, the layout at least has the advantage of being easier to navigate visually for folks who have problems with closely grouped strings of text on screen.
- Oh, absolutely. And I applaud you for introducing a template. The only thing I worry about is that the task gets completed. Are you actually going to be physically putting that template on each page, or you want me to call out the bot to help you? I played around a little with it, and haven't got quite the right regular expression going, but I'm sure it's possible. Some editors like to have a bot help them along; some really enjoy the act of physically seeing every page their template goes on. Lemme know if you want me to wave a magic wand. CzechOut ☎ | ✍ 21:15, March 29, 2010 (UTC)
- In the mean time, just change 'em here and there as you see 'em. I've changed a few over here and there thus far myself. -- sulfur 21:46, March 29, 2010 (UTC)
- Yeah I noticed your post about the bot. How would it handle (a) parsing the values (prev, next, decade, century) from the old html to the template on pre-existing pages, and (b) interpreting those values from scratch, plus adding the appropriate category tags?
- → Koschei:
- Life. But not as we know it. 14:19, March 30, 2010 (UTC)
- Yeah I noticed your post about the bot. How would it handle (a) parsing the values (prev, next, decade, century) from the old html to the template on pre-existing pages, and (b) interpreting those values from scratch, plus adding the appropriate category tags?
- Well, my plan with the bot was merely to find every line that began with a "<" and delete it. This is the difficult bit, kinda. I spent a few hours a few days ago looking at it, and Python, the language of the bot, doesn't seem to have a simple delete feature, but I could be wrong. In any case, somwhere there is a solution to that; because line deletion is too obviously useful not to be possible. So, after I solve that, the thing key then would be just put the template on every page in that category, which is a one-line command in Python. Super easy, that part.
- As for the prev, next, decade, century stuff, well that'll probably best be achieved by simple mathematical expressions in the template itself. So you start with using {{PAGENAME}} to determine the base for your calculations. Prev is thus {{PAGENAME}}-1, Next is {{PAGENAME+1}}. There's probably functionality on here to convert the pagename into an actual number (as opposed to a text string that PAGENAME returns). Then you just do a li'l series of calculations to relate that number to a particular century, and relate that to a name of an article with a century number. I haven't looked into that side, but I can't imagine it's all that difficult to completely automate — and more importantly, idiotproof — the template. Might require the template "timeline" to be a shell template for another template that actually does all the work. Anyway, the important thing from a functional standpoint is to strip out the HTML. I'm still in disbelief over the HTML. The mind-numbing boredom of literally copying that on every page quite literally staggers the imagination. CzechOut ☎ | ✍ 15:53, March 30, 2010 (UTC)
- Eventually people will get onto adding the template when they see it out and about.
- You could put a note on the Article To Do List (something created a while back in addition to Tardis:To Do List and Tardis:BFA To-do List), whether anyone checks it is another matter, but chucking a note on there linking to here or explaining what needs to be done may help. It's where I often point people towards when they're looking for ways to contribute. --Tangerineduel 16:19, March 30, 2010 (UTC)
- Okay, I've nearly got the "auto-sensing" template done and I've got feelers out for responses on how to get rid of the HTML code with a bot. Not quite ready to show, but I wanted to tell you I was well advanced on the project so that you didn't waste a lot of time on this laborious task.
- Basically, it'll go something like this. There will be four templates. There's the main one, which I might retain under the name "timeline". That'll basically test each page it's on for what kind of page it is. If the page name divided by itself equals 1, then it's a year page. It'll then automatically call up a "year" template, that will do some calculations on the pagename and automatically create all the information you have in your current "timeline" template. If it's a century or decade page, it'll call up a "century" or "decade" template, and automatically create a navigation box there, too. So if you're rushing around trying to implement this box manually, you can stop and focus on more exciting work. CzechOut ☎ | ✍ 00:25, March 31, 2010 (UTC)
- Hey, just noticed that the excellent template:documentation interjects a few preceding lines of blank text. Thus it should only be added to the very end of a template, enclosed in <noinclude> brackets, or it will mysteriously make your template have unwanted space at the top. Doesn't really make much sense to me; noinclude should be noinclude wherever you put it, but it does solve things to include documentation only at the end of a template. CzechOut ☎ | ✍ 22:41, April 1, 2010 (UTC)
- Basically, it'll go something like this. There will be four templates. There's the main one, which I might retain under the name "timeline". That'll basically test each page it's on for what kind of page it is. If the page name divided by itself equals 1, then it's a year page. It'll then automatically call up a "year" template, that will do some calculations on the pagename and automatically create all the information you have in your current "timeline" template. If it's a century or decade page, it'll call up a "century" or "decade" template, and automatically create a navigation box there, too. So if you're rushing around trying to implement this box manually, you can stop and focus on more exciting work. CzechOut ☎ | ✍ 00:25, March 31, 2010 (UTC)