Template talk:R

From Citizendium
Revision as of 13:38, 1 November 2008 by imported>J. Noel Chiappa (Move some useful stuiff here from User talk:Aleta Curry)
Jump to navigation Jump to search

Extra newline

Can anyone explain to me why there is an extra newline after this template's contents? Can anyone remove it, please?? --Larry Sanger 13:24, 6 May 2008 (CDT)

To answer my own question, it's caused by the fact that we place newlines between each use of the template, like this:

{{r|Biology}}
{{r|Microbiology}}
{{r|Cell Biology}}

That outputs:

But the r template itself adds an asterisk, which adds its own newline (before the asterisk). That's two newlines. To eliminate extra newlines, you could do this:

{{r|Biology}}{{r|Microbiology}}{{r|Cell Biology}}

which outputs:

--Larry Sanger 13:55, 6 May 2008 (CDT)

Just want to point out that the real reason for the problem above was an extra font tag that got removed in the following edit. Also this template has changed a lot since the above was written so those examples may not look the same as when it was written on May 6th. Chris Day 11:52, 20 May 2008 (CDT)

Formatting troubles

Moved here from User talk:Aleta Curry as it's of general interest

The high-level question (whether to organize things by lists of books, or authors) I obviously don't have any solution for! For your formatting issues, however, I can offer some help...

Hayford's I fixed (assuming what's there now is what he wanted). Yours is a bit harder to fix: the problem is that the {{r}} template seems to be inserting a 'new line' (which will terminate any active ':', '*' or '#" block) before it gets to any of the text (including the '*' it inserts), with the result that you're effectively getting:

* [[Madeleine L'Engle]]
:*
* [[A Wrinkle in Time]]

which of course gives you this:

which is what you're seeing. You'd have to talk to one of the people who fiddle with the 'R' template, and get them to take that extra new line (before the '*' they insert) out of there, and then you could say:

{{r|Madeleine L'Engle}}
:{{r|A Wrinkle in Time}}

and the right thing should happen. I think Chris is currently working with R, although Larry has worked on it on the past. I'll drop him a line, since I had another gripe about this thing anyway... :-) J. Noel Chiappa 17:57, 19 May 2008 (CDT)

Thanks for the explanation and the fixes; I'll go have a look. Aleta Curry 18:06, 19 May 2008 (CDT)
Hmmm...okay, what happens if I write...?
as opposed to:
Frankenstein A precursor science fiction novel written in 1818 by Mary Shelley.
Aleta Curry 19:13, 19 May 2008 (CDT)
okay, if you put {{def|whatever}}, the whatever definition is not editable, but if you use {{r|whatever}}, you can edit the definition. I'm assuming both these "defs" live at the same place, which, if I understand anything at all, would be [[Whatever/definition]] --right? Aleta Curry 19:13, 19 May 2008 (CDT)
Right.
I'll ask Chris about the edit link thing. Maybe we'll put together an {{edef}} that is like {{def}}, but has the edit link too. J. Noel Chiappa 20:44, 19 May 2008 (CDT)

Larry worked with R and it was originally a single purpose template. Now it is being used for many other things. Problem is that too many drastic changes will destroy the format on many related articles pages. Ideally I could take out the bullet but I'm not sure that is wise. So I have made the R default for a single bullet but that can be overridden in the cases where you need something else. For example, instead of writing:

{{r|Edgar Allan Poe}}
{{r|Jules Verne}}
**[[Journey to the Center of the Earth]] {{def|Journey to the Center of the Earth}}
**[[From the Earth to the Moon]] {{def|From the Earth to the Moon}}
**[[Twenty Thousand Leagues under the Sea]] {{def|Twenty Thousand Leagues under the Sea}}
{{r|H.G. Wells}}

it is now possible to write:

{{r|Edgar Allan Poe}}
{{r|Jules Verne}}
{{r|Journey to the Center of the Earth|indent=**}}
{{r|From the Earth to the Moon|indent=**}}
{{r|Twenty Thousand Leagues under the Sea|indent=**}}
{{r|H.G. Wells}}

To give the following:

Alternatively you could write:

{{r|Edgar Allan Poe}}
{{r|Jules Verne}}
{{r|Journey to the Center of the Earth|indent=:#}}
{{r|From the Earth to the Moon|indent=:#}}
{{r|Twenty Thousand Leagues under the Sea|indent=:#}}
{{r|H.G. Wells}}

To give the following:

Or other variation on any indentation scheme. Is the indent field the best name? At this point you can choose which ever is best for you as this has not been implemented on any page. Chris Day 01:43, 20 May 2008 (CDT)

Cool, Chris! Such a {{R}}-compatible indent scheme would also be good for pages like CZ:Biology_Workgroup#High_priority_articles. So Aleta, please name the variable, and we can start playing around with this new functionality. -- Daniel Mietchen 01:53, 20 May 2008 (CDT)

Also, notice that without a variable such as {{r|Frankenstein|indent=}} you can get rid of the bullet:

I'm not sure if that is useful but its good to know the default bullet can be lost without having to indent. Chris Day 02:14, 20 May 2008 (CDT)

I think it will be very useful. Very clever! Aleta, do let us know about the argument name - I had suggested 'fmt' to Chris (for 'format'), as being shorter, but really anything would do. I suppose we could even make it a second, optional, un-named, parameter? R never has another argument now, right? J. Noel Chiappa 07:47, 20 May 2008 (CDT)
Chris and I decided no name at all was the simplest option! See Science fiction/Related Articles‎ (and Template:R/Doc if your're up for it :-). J. Noel Chiappa 11:22, 20 May 2008 (CDT)

Oh, this is simply MARVELOUS!

Moved here from User talk:Aleta Curry as it's of general interest

Much betterer on the definitions, fellas! Thanks and well done.

Sorry, I'm just seeing this at 0830 on Wednesday, Oz time. Husband decided to completely change plans yesterday (won't bore you with details, but you know how you boys get) so of course I had to drop everything while he started doing horrible things with a 23-tonne excavator. You should see the mess!

Just one bit of confusion lingers (that's good for me, isn't it?). I'm not understanding the relationship between asterisks and colons in these formulae.

If I use "**" to indent a line, say Journey to the center of the Earth

  • Jules Verne [r]: (1828-1905) French author and science-fiction pioneer, some of whose novels involved travel through outer space and under water before technology had made these possible, and whose work has been widely translated and made into a number of films. [e]

Why do I change that to "*::" to indent twice?

  • Dog [r]: Domesticated canine often kept as a pet or as a working animal and known as 'man's best friend'. [e]
    • Terrier [r]: A member or descendant of any of several dog breeds or dog landraces originally developed for hunting or vermin routing. [e]
    Fox Terrier [r]: Small to medium-sized hunting terrier developed to rout fox and vermin. [e]

Smooth Fox Terrier aka Modern Fox Terrier [r]: Add brief definition or description Fox Terrier, Miniature ("Mini Foxie") [r]: A small Australian vermin-routing terrier, developed from 19th Century Fox Terriers and Fox Terrier types. [e]

Okay, I just "previewed". I was doing well until I tried to indent the Fox Terrier types, here Smooth Fox Terrier and Mini Foxie. Did I type the code wrong or does it not work for another level? Could I use numbering instead? ("#" - though for some reason that very rarely works for me. I always end up with things like

1 1.1 1.1

instead of

1 2 3

and I give up Aleta Curry 17:52, 20 May 2008 (CDT)

Aleta, this is more to do with the way that MediaWiki handles nested lists (both unnumbered and numbered), and not so much the {{r}} template. Basically the deal is that in a nested list you can't have any other 'lines' of text (remembering that a line in WikiMedia markup - i.e. any string of characters that doesn't include a new line character - can often be a whole paragraph) in the middle of a nested group, you can't 'mix and match'. I.e. something like:
* (stuff}
** (stuff}
** (stuff}
*** (stuff}
*** (stuff}
** (stuff}
is ok, but:
* (stuff}
** (stuff}
** (stuff}
: {other stuff}
** (stuff}
isn't, because that line starting with ':' intrudes. Once you start on a nested list, using either '*' or '#', a line starting with anything else terminates that nested list, and the next line starting with '*' or '#' starts a new nested list. (And if you start a nested list with a line starting with a "**" or something, basically anything other than a plain '*' or '#', you get something ugly.)
Exception: you can mix and match ':' and either '*' or '#' to do wierd stuff, but I can't tell you exactly what the rules for all that are - because I don't know if they are written down anywhere, and I haven't fully figured them out myself!
But basically if you stay with simple nested lists, you should be OK. If you want to try and copy stuff that uses things like "::*" that works, feel free, but it's a 'trial and error' situation if it doesn't work (for people like Chris and me too) - and this is doubly true if you mix that and use of the {{r}} template, for reasons you really don't want to think about (because it will drive you to drinkin' - not to mention unladylike cussin' of computers and computer people) - but it you really want to know more, see Template talk:R. J. Noel Chiappa 18:38, 20 May 2008 (CDT)

Oh, part of the reason your terrier example didn't work was that you had an extra '|' character in the last two lines. (Computers = stupid moronic small children who have zero common sense.) So:

{{r|dog}}
{{r|Terrier||**}}
{{r|Fox Terrier||*::}}
{{r|Fox Terrier, Smooth|Smooth Fox Terrier aka ''Modern Fox Terrier''|*:::}}
{{r|Miniature Fox Terrier|Fox Terrier, Miniature ("Mini Foxie")|*:::}}
{{r|Poodle||**}}

does produce:

The lines with the "*::" etc keep the nested group 'going' without producing bullets (cool, I had never seen that trick before) so when you later have another 2nd level bulleted entrty (the poodle) it comes out looking right. J. Noel Chiappa 18:44, 20 May 2008 (CDT)

Formatting limits

Note that even though both:

{{r|Biology}}
{{r|Cell (biology)||**}}

and:

{{r|Biology}}
**{{r|Cell (biology)||}}

work, however:

{{r|Biology}}
*{{r|Cell (biology)||*}}

doesn't. The best theory about why is that it must be that thing with an extra newline being emitted - it must be coming out after the leading '*' and before the second '*' (in the no-working cases), i.e. right at the start of the template invocation. That's why the ones with the '**' (at either end) work, that new line is not splitting the two '*'s apart. In those middle ones, the reason the naked bullet is coming out right up on the left margin is that it sees:

*
*[[link]]

not:

**[[link]]

and of course then we get two separate bullets, fully left-justified. Dont ask me why the **{{r|link||}} case works, because it should be seeing:

**
[[link]]

if my theory about when the 'rogue' new line is appearing is correct, but clearly it's not appearing then! J. Noel Chiappa 11:47, 20 May 2008 (CDT)

This makes sense %*? Chris Day 11:55, 20 May 2008 (CDT)
ROTFLMAO If it's any consolation,it doesn't make any sense to me either! :-) Bugs - they can be so wierd.
There was one at MIT once which quite literally depended on the phase of the moon - thereby stunning all the hackers, for whom phrases like 'the new memory bank usually works, depending on the phase of the moon' (i.e. totally randomly and disconnected from any external causality that could be identified, as far as anyone could tell) were stock. We were all suitably impressed when a bug appeared which really did depend on the phase of the moon! J. Noel Chiappa 12:06, 20 May 2008 (CDT)

Helpful for Core Articles

Hi Chris and Noel, just wanted to tell you that I think this third option for hierarchical arrangements makes the template especially useful for article lists like those on the CZ:Core Article pages. Thanks! -- Daniel Mietchen 12:00, 20 May 2008 (CDT)