Difference between revisions of "Template:CelestialRef/test/doc"
imported>Robertinventor (←Created page with '{{Documentation subpage}} <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> {{Documentation subpage}} <!-- Categories go at the b...') |
imported>Robertinventor |
||
| Line 1: | Line 1: | ||
| − | |||
| − | |||
| − | |||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> | <!-- Categories go at the bottom of this page and interwikis go in Wikidata. --> | ||
| Line 51: | Line 48: | ||
Any identifier recognized by Simbad for its sim-basic will do. | Any identifier recognized by Simbad for its sim-basic will do. | ||
| − | So, these are all possible: <nowiki>{{ | + | So, these are all possible: <nowiki>{{CelestialRefTest | M 31}}, {{CelestialRefTest | Crab Nebula}}, {{CelestialRefTest | HD 189733b}}</nowiki> etc. |
| − | Displayed as: {{ | + | Displayed as: {{CelestialRefTest | M 31}}, {{CelestialRefTest | Crab Nebula}}, {{CelestialRefTest | HD 189733b}}. |
| − | This shows all the features in use: Example: <nowiki>{{ | + | This shows all the features in use: Example: <nowiki>{{CelestialRefTest| Crab Nebula | cds=short | ids=show | bib=show | plot=10 |units=arcsec | image=show | bwimage=show }}</nowiki> |
| − | yields {{ | + | yields {{CelestialRefTest| Crab Nebula | cds=short | ids=show | bib=show | plot=10 |units=arcsec | image=show | bwimage=show }} |
| − | Same example with commas instead of dashes : <nowiki>{{ | + | Same example with commas instead of dashes : <nowiki>{{CelestialRefTest| Crab Nebula | sep=, |cds=short | ids=show | bib=show | plot=10 |units=arcsec | image=show | bwimage=show }}</nowiki> |
| − | yields {{ | + | yields {{CelestialRefTest| Crab Nebula | sep= , | cds=short | ids=show | bib=show | plot=10 |units=arcsec | image=show | bwimage=show }} |
That might be useful in an article for a single celestial object, for instance, to add all those links in a footnote for the object which is the subject of the article. | That might be useful in an article for a single celestial object, for instance, to add all those links in a footnote for the object which is the subject of the article. | ||
| Line 69: | Line 66: | ||
You can use a different name for the internal link and the SIMBAD lookup. | You can use a different name for the internal link and the SIMBAD lookup. | ||
| − | <nowiki> {{ | + | <nowiki> {{ CelestialRefTest | M 31 |Andromeda Galaxy }}</nowiki> |
| − | yields: {{ | + | yields: {{ CelestialRefTest | M 31 |Andromeda Galaxy }} |
===Ref only=== | ===Ref only=== | ||
| Line 77: | Line 74: | ||
If you just want the ref without the name, use the same approach, but make the different name for the internal link blank, as in | If you just want the ref without the name, use the same approach, but make the different name for the internal link blank, as in | ||
| − | <nowiki>{{ | + | <nowiki>{{ CelestialRefTest | M 42 | }}</nowiki><br> |
Yields:<br> | Yields:<br> | ||
| − | {{ | + | {{CelestialRefTest | M 42 | }} |
You can miix with other named parameters in any order, e.g.: | You can miix with other named parameters in any order, e.g.: | ||
| − | <nowiki>{{ | + | <nowiki>{{ CelestialRefTest | M 42 | | bib=show }}</nowiki> (same idea but added an extra named parameter at the end)<br> |
Yields:<br> | Yields:<br> | ||
| − | {{ | + | {{CelestialRefTest | M 42 | | bib=show }} |
| − | Which you could then add to some text as Test <nowiki>{{ | + | Which you could then add to some text as Test <nowiki>{{ CelestialRefTest | M 42 | | bib=show }}</nowiki> |
| − | Test {{ | + | Test {{CelestialRefTest | M 42 | | bib=show }} |
It doesn't matter where you put this blank field amongst the other parameters, so long as it goes after the object name. | It doesn't matter where you put this blank field amongst the other parameters, so long as it goes after the object name. | ||
| Line 97: | Line 94: | ||
===No internal link=== | ===No internal link=== | ||
| − | If you just want the name without an internal link, add ''link=no'' as: <nowiki>{{ | + | If you just want the name without an internal link, add ''link=no'' as: <nowiki>{{ CelestialRefTest | M 31 |Andromeda Galaxy | link=no}}</nowiki> |
| − | yields: {{ | + | yields: {{ CelestialRefTest | M 31 |Andromeda Galaxy | link=no}} |
| − | <nowiki>{{ | + | <nowiki>{{ CelestialRefTest | M 31 | link=no}}</nowiki> |
| − | yields: {{ | + | yields: {{ CelestialRefTest | M 31 | link=no}} |
===Siblings=== | ===Siblings=== | ||
| − | You can add a link for siblings e.g. <nowiki>{{ | + | You can add a link for siblings e.g. <nowiki>{{ CelestialRefTest | GL 146 |siblings = show}} </nowiki> |
This may be useful if the object is part of a larger group and this is relevant to the article citing it, in this case the Hyades super cluster. | This may be useful if the object is part of a larger group and this is relevant to the article citing it, in this case the Hyades super cluster. | ||
| − | {{ | + | {{ CelestialRefTest | Gliese 146 |siblings = show}} |
===Star plot=== | ===Star plot=== | ||
| Line 117: | Line 114: | ||
The advantage of the star plot extra link is that it lets the author of the page preset the radius for the plot. For some objects this needs to be large, e.g. 20 arcmins or more. For others, that shows far too many objects and a smaller radius in arcsecs is appropriate. | The advantage of the star plot extra link is that it lets the author of the page preset the radius for the plot. For some objects this needs to be large, e.g. 20 arcmins or more. For others, that shows far too many objects and a smaller radius in arcsecs is appropriate. | ||
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | HD 189733b | plot = 5 }}</nowiki> |
| − | yields {{ | + | yields {{ CelestialRefTest | HD 189733b | plot = 5 }} to plot stars within 5 arcmins of [[HD 189733b]] |
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | Alpha Centauri | plot = 50 | units = arcsec }}</nowiki> |
| − | yields {{ | + | yields {{ CelestialRefTest | Alpha Centauri | plot = 50 | units = arcsec }} to plot stars within 50 arcsecs of Alpha Centauri |
==Use in tables== | ==Use in tables== | ||
| Line 135: | Line 132: | ||
All entries are set to add the extra Bibliography link to the refs. | All entries are set to add the extra Bibliography link to the refs. | ||
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | bib=show | WASP-80b }}</nowiki> |
{|class="wikitable" | {|class="wikitable" | ||
| Line 141: | Line 138: | ||
!Planet!!Mass (MJ)!!Period (d)!!SpT!!B - V!!Te? | !Planet!!Mass (MJ)!!Period (d)!!SpT!!B - V!!Te? | ||
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|WASP-43b}}||2.03||0.813||K7||1.0||4400d |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|HAT-P-20b}}||7.25||2.88||K3||—||4619 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|GJ 439 c}}||0.41e||32.0||K4||1.11||4640 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|GJ 439 d}}||0.53e||431.7||-||-||- |
|- | |- | ||
| − | ||{{ | + | ||{{CelestialRefTest|bib=show|WASP-59b}}||0.0.86||7.92||K5||0.92||4650h |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|HD 113538b}}||0.27e||263.3||K9f||-||- |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|HD 113538c}}||0.71e||1657||-||-||- |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|BD-17 63b}}||5.12e||655.6||K4||1.14||4714 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|WASP-10b}}||3.06||3.09||K5||—||- |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|BD-08 2823b}}||0.33||237.6||K3||1.07||4746 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|HD 20868b}}||1.99||380.85||K3/4||1.04||4795 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|HD 63454b}}||0.38e||2.82||K4||1.06||4840 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|Qatar 1b}}||1.09||1.42||N/A||1.06||4861 |
|- | |- | ||
| − | |{{ | + | |{{CelestialRefTest|bib=show|CD-23 395b}}||1.44e||345.6||K5||1.08||4962 |
|} | |} | ||
| Line 199: | Line 196: | ||
{{#ifeq:{{{2|}}}| | {{#ifeq:{{{2|}}}| | ||
| − | | // Case: second param is blank, e.g. {{ | + | | // Case: second param is blank, e.g. {{CelestialRefTest|Object Name|}} |
// no name section at all just bare ref. | // no name section at all just bare ref. | ||
| Line 219: | Line 216: | ||
Included mainly to check all the features are working correctly, check this after editing the code and add more test cases if nec if you add new features. | Included mainly to check all the features are working correctly, check this after editing the code and add more test cases if nec if you add new features. | ||
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | Barnard's star }}</nowiki> |
| − | yields {{ | + | yields {{ CelestialRefTest | Barnard's star }} |
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | Barnard's star |link=no}}</nowiki> |
| − | yields {{ | + | yields {{ CelestialRefTest | Barnard's star |link=no}} |
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | Barnard's star | }}</nowiki> for ref only |
| − | yields {{ | + | yields {{ CelestialRefTest | Barnard's star | }} |
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{ CelestialRefTest | M 31 | Andromeda Galaxy }}</nowiki> to display as Andromeda Galaxy but look up as M 31 |
| − | yields {{ | + | yields {{ CelestialRefTest | M 31 | Andromeda Galaxy }} |
| − | Same example, name only, no internal link: <nowiki>{{ | + | Same example, name only, no internal link: <nowiki>{{ CelestialRefTest | M 31 | Andromeda Galaxy |link=no}} </nowiki> |
| − | yields {{ | + | yields {{ CelestialRefTest | M 31 | Andromeda Galaxy |link=no}} |
Final example shows all the features in one ref | Final example shows all the features in one ref | ||
| − | Example: <nowiki>{{ | + | Example: <nowiki>{{CelestialRefTest| Crab Nebula | cds=short | ids=show | bib=show | plot = 10 |units = arcsec | image=show | bwimage=show }}</nowiki> |
| − | yields {{ | + | yields {{CelestialRefTest| Crab Nebula | cds=short | ids=show | bib=show | plot = 10 |units = arcsec | image=show | bwimage=show }} |
==References == | ==References == | ||
| Line 264: | Line 261: | ||
All entries are set to add the extra Bibliography link to the refs | All entries are set to add the extra Bibliography link to the refs | ||
| − | Example: <nowiki>{{CelestialRefTest| | + | Example: <nowiki>{{CelestialRefTest|CelestialRefTest|bib=show||WASP-80b}}</nowiki> |
{|class="wikitable" | {|class="wikitable" | ||
| Line 270: | Line 267: | ||
!Planet!!Mass (MJ)!!Period (d)!!SpT!!B - V!!Te? | !Planet!!Mass (MJ)!!Period (d)!!SpT!!B - V!!Te? | ||
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show||WASP-80b}} ||0.55|| 3.068|| K7-M0 ||0.94|| ~4000 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HIP 70849b}}|| > 3 ||> 5 yr|| K7 ||1.42 ||4100c |
(2011) | (2011) | ||
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|WASP-43b}}||2.03||0.813||K7||1.0||4400d |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HAT-P-20b}}||7.25||2.88||K3||—||4619 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HIP 57274c}}||0.41e||32.0||K4||1.11||4640 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HIP 57274d}}||0.53e||431.7||-||-||- |
|- | |- | ||
| − | ||{{CelestialRefTest| | + | ||{{CelestialRefTest|CelestialRefTest|bib=show|WASP-59b}}||0.0.86||7.92||K5||0.92||4650h |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HID 113538b}}||0.27e||263.3||K9f||-||- |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HID 113585c}}||0.71e||1657||-||-||- |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|BD-17 63b}}||5.12e||655.6||K4||1.14||4714 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|WASP-10b}}||3.06||3.09||K5||—||- |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|BD-08 2823b}}||0.33||237.6||K3||1.07||4746 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HID 20868b}}||1.99||380.85||K3/4||1.04||4795 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HID 63454b}}||0.38e||2.82||K4||1.06||4840 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|Qatar-1b}}||1.09||1.42||N/A||1.06||4861 |
|- | |- | ||
| − | |{{CelestialRefTest| | + | |{{CelestialRefTest|CelestialRefTest|bib=show|HIP 5158bg}}||1.44e||345.6||K5||1.08||4962 |
|} | |} | ||
| Line 330: | Line 327: | ||
| // Case: second param | | // Case: second param | ||
{{#ifeq:{{{2|}}}| | {{#ifeq:{{{2|}}}| | ||
| − | | // Second param is blank, e.g. {{ | + | | // Second param is blank, e.g. {{CelestialRefTest|Object Name|}} |
// no name section at all just bare ref. | // no name section at all just bare ref. | ||
Revision as of 21:45, 20 July 2013
| This is a documentation subpage for Template:CelestialRef/test. It contains usage information, categories and other content that is not part of the original template page. |
Contents
Documentation
CelestialRefTest creates
- Name or internal link to the celestial object in Wikipedia
- Footnote with links to the SIMBAD entry
- Optionally, extra links to other entries for the object in online databases. These are added to the footnote.
It is especially useful if you have a table of celestial objects and want to add footnotes to each one, and maybe add extra entries in the footnotes such as pre-expanded SIMBAD bibliography, star plot, or link to a photograph of the object, as appropriate.
Alternative to this template: you can use: Template:T if you just want to add the SIMBAD footnote, without these extra options.
| Parameter | Example | Usage |
|---|---|---|
| First unnamed parameter | M 31 | Name to pass to Simbad basic search |
| Second unnamed parameter | Andromeda Galaxy | Alternative name for internal link if absent uses first param If set blank, name is not shown. |
| plot | 10 | Radius of star plot (if omitted, no star plot link added) |
| units | arcsec | Measurement unit for radius, arcsec, arcmin or deg acceptable, default arcmin |
| ids | show | set to show to add link to ids section of SIMBAD page |
| bib | show | set to show to add link to pre-expanded bibliography section |
| siblings | show | set to show to add link to siblings search |
| cds | short | set to short to display as "CDS" instead of "Centre de données astronomiques de Strasbourg" |
| image | show | set to show to add link to aladin preview image, colour |
| bwimage | show | set to show to add link to aladin preview image, B&w |
| sep | , | Separator for the extra entries. Default currently is to separate with dashes |
| inline | yes | Does everything inline, not as a footnote |
Examples
Any identifier recognized by Simbad for its sim-basic will do.
So, these are all possible: {{CelestialRefTest | M 31}}, {{CelestialRefTest | Crab Nebula}}, {{CelestialRefTest | HD 189733b}} etc.
Displayed as: Template:CelestialRefTest, Template:CelestialRefTest, Template:CelestialRefTest.
This shows all the features in use: Example: {{CelestialRefTest| Crab Nebula | cds=short | ids=show | bib=show | plot=10 |units=arcsec | image=show | bwimage=show }}
yields Template:CelestialRefTest
Same example with commas instead of dashes : {{CelestialRefTest| Crab Nebula | sep=, |cds=short | ids=show | bib=show | plot=10 |units=arcsec | image=show | bwimage=show }}
yields Template:CelestialRefTest
That might be useful in an article for a single celestial object, for instance, to add all those links in a footnote for the object which is the subject of the article.
Using a different name for the internal link
You can use a different name for the internal link and the SIMBAD lookup.
{{ CelestialRefTest | M 31 |Andromeda Galaxy }}
yields: Template:CelestialRefTest
Ref only
If you just want the ref without the name, use the same approach, but make the different name for the internal link blank, as in
{{ CelestialRefTest | M 42 | }}
Yields:
Template:CelestialRefTest
You can miix with other named parameters in any order, e.g.:
{{ CelestialRefTest | M 42 | | bib=show }} (same idea but added an extra named parameter at the end)
Yields:
Template:CelestialRefTest
Which you could then add to some text as Test {{ CelestialRefTest | M 42 | | bib=show }}
Test Template:CelestialRefTest
It doesn't matter where you put this blank field amongst the other parameters, so long as it goes after the object name.
Techy details - the template recognizes your blank field as parameter 2, the second unnamed parameter.
No internal link
If you just want the name without an internal link, add link=no as: {{ CelestialRefTest | M 31 |Andromeda Galaxy | link=no}}
yields: Template:CelestialRefTest
{{ CelestialRefTest | M 31 | link=no}}
yields: Template:CelestialRefTest
Siblings
You can add a link for siblings e.g. {{ CelestialRefTest | GL 146 |siblings = show}}
This may be useful if the object is part of a larger group and this is relevant to the article citing it, in this case the Hyades super cluster.
Star plot
The advantage of the star plot extra link is that it lets the author of the page preset the radius for the plot. For some objects this needs to be large, e.g. 20 arcmins or more. For others, that shows far too many objects and a smaller radius in arcsecs is appropriate.
Example: {{ CelestialRefTest | HD 189733b | plot = 5 }}
yields Template:CelestialRefTest to plot stars within 5 arcmins of HD 189733b
Example: {{ CelestialRefTest | Alpha Centauri | plot = 50 | units = arcsec }}
yields Template:CelestialRefTest to plot stars within 50 arcsecs of Alpha Centauri
Use in tables
The template can be used in tables. This was the original motivation for this template - to have an easy way to add footnotes anad add extra links to the footnotes, for every entry in a table.
Here is an example to test it.
Confirmed Giant Planets around Mid- and Late-K-type Dwarf Stars
All entries are set to add the extra Bibliography link to the refs.
Example: {{ CelestialRefTest | bib=show | WASP-80b }}
| Planet | Mass (MJ) | Period (d) | SpT | B - V | Te? |
|---|---|---|---|---|---|
| Template:CelestialRefTest | 2.03 | 0.813 | K7 | 1.0 | 4400d |
| Template:CelestialRefTest | 7.25 | 2.88 | K3 | — | 4619 |
| Template:CelestialRefTest | 0.41e | 32.0 | K4 | 1.11 | 4640 |
| Template:CelestialRefTest | 0.53e | 431.7 | - | - | - |
| Template:CelestialRefTest | 0.0.86 | 7.92 | K5 | 0.92 | 4650h |
| Template:CelestialRefTest | 0.27e | 263.3 | K9f | - | - |
| Template:CelestialRefTest | 0.71e | 1657 | - | - | - |
| Template:CelestialRefTest | 5.12e | 655.6 | K4 | 1.14 | 4714 |
| Template:CelestialRefTest | 3.06 | 3.09 | K5 | — | - |
| Template:CelestialRefTest | 0.33 | 237.6 | K3 | 1.07 | 4746 |
| Template:CelestialRefTest | 1.99 | 380.85 | K3/4 | 1.04 | 4795 |
| Template:CelestialRefTest | 0.38e | 2.82 | K4 | 1.06 | 4840 |
| Template:CelestialRefTest | 1.09 | 1.42 | N/A | 1.06 | 4861 |
| Template:CelestialRefTest | 1.44e | 345.6 | K5 | 1.08 | 4962 |
Data from Giant Planets around Late K Dwarf Stars - Table 1
Code Documentation
The code for the displayed name section is complex and may be difficult for future coders to update. It also needs to be done all as a single line since otherwise it breaks table formatting when including in tables.
So, here is a commented version. Sadly, there doesn't seem to be any way to include comments inside of a wikipedia template but hopefully this will make it clear how it works.
I use a c like convention here // for comments.
Everything from the // to end of line needs to be ignored. Also though, because of the sensitivity of templates to new lines and white space, all white space before and after the comment also needs to be ignored
// ***Displayed object name section***
{{#ifeq:{{{2|NoName}}}|NoName // Has user entered second parameter?
// Here NoName as preset value for param 2 makes the test possible
// if it remains at preset value then they didn't enter a second parameter at all.
// Preset value here can be anything not suitable for a SIMBAD search.
| // Case: no second param (param 2 was left as NoName in the test above)
|{{#ifeq:{{{link}}}|no| // link=no?
{{{1}}} // link = no, param 1 as name only
|[[{{{1}}}]] // link=anything else, or not set, param 1 as internal link
}}// end of link = no?
| // Case: second param
{{#ifeq:{{{2|}}}|
| // Case: second param is blank, e.g. {{CelestialRefTest|Object Name|}}
// no name section at all just bare ref.
| // Case: second param entered by user, and not blank
|{{#ifeq:{{{link}}}|no
|{{{2}}} // // link=no, param 2 as name only
|[[{{{2}}}]] // link=yes or not set, param 2 as internal link
}} // end of link=?
}} // end of test that param 2 is blank
}} // end of test to see if user entered param 2 at all
{{#ifeq:{{{2|NoName}}}||| }} // This adds a space before the footnote number
// Tests to see if user added param 2 as an empty field
// If so, there is no preceeding name, so no space needed
Test cases
Included mainly to check all the features are working correctly, check this after editing the code and add more test cases if nec if you add new features.
Example: {{ CelestialRefTest | Barnard's star }}
yields Template:CelestialRefTest
Example: {{ CelestialRefTest | Barnard's star |link=no}}
yields Template:CelestialRefTest
Example: {{ CelestialRefTest | Barnard's star | }} for ref only
yields Template:CelestialRefTest
Example: {{ CelestialRefTest | M 31 | Andromeda Galaxy }} to display as Andromeda Galaxy but look up as M 31
yields Template:CelestialRefTest
Same example, name only, no internal link: {{ CelestialRefTest | M 31 | Andromeda Galaxy |link=no}}
yields Template:CelestialRefTest
Final example shows all the features in one ref
Example: {{CelestialRefTest| Crab Nebula | cds=short | ids=show | bib=show | plot = 10 |units = arcsec | image=show | bwimage=show }}
yields Template:CelestialRefTest
References
See also
Use in tables
The template can be used in tables. Here is an example to test it. Data from Giant Planets around Late K Dwarf Stars - Table 1:
Confirmed Giant Planets around Mid- and Late-K-type Dwarf Stars
All entries are set to add the extra Bibliography link to the refs
Example: {{CelestialRefTest|CelestialRefTest|bib=show||WASP-80b}}
| Planet | Mass (MJ) | Period (d) | SpT | B - V | Te? |
|---|---|---|---|---|---|
| Template:CelestialRefTest | 0.55 | 3.068 | K7-M0 | 0.94 | ~4000 |
| Template:CelestialRefTest | > 3 | > 5 yr | K7 | 1.42 | 4100c
(2011) |
| Template:CelestialRefTest | 2.03 | 0.813 | K7 | 1.0 | 4400d |
| Template:CelestialRefTest | 7.25 | 2.88 | K3 | — | 4619 |
| Template:CelestialRefTest | 0.41e | 32.0 | K4 | 1.11 | 4640 |
| Template:CelestialRefTest | 0.53e | 431.7 | - | - | - |
| Template:CelestialRefTest | 0.0.86 | 7.92 | K5 | 0.92 | 4650h |
| Template:CelestialRefTest | 0.27e | 263.3 | K9f | - | - |
| Template:CelestialRefTest | 0.71e | 1657 | - | - | - |
| Template:CelestialRefTest | 5.12e | 655.6 | K4 | 1.14 | 4714 |
| Template:CelestialRefTest | 3.06 | 3.09 | K5 | — | - |
| Template:CelestialRefTest | 0.33 | 237.6 | K3 | 1.07 | 4746 |
| Template:CelestialRefTest | 1.99 | 380.85 | K3/4 | 1.04 | 4795 |
| Template:CelestialRefTest | 0.38e | 2.82 | K4 | 1.06 | 4840 |
| Template:CelestialRefTest | 1.09 | 1.42 | N/A | 1.06 | 4861 |
| Template:CelestialRefTest | 1.44e | 345.6 | K5 | 1.08 | 4962 |
Code Documentation
The code for the displayed name section is complex and may be difficult for future coders to update. It also needs to be done all as a single line since otherwise it breaks table formatting when including in tables.
So, here is a commented version. Sadly, there doesn't seem to be any way to include comments inside of a wikipedia template but hopefully this will make it clear how it works.
I use a c like convention here // for comments.
Everything from the /// to end of line ignored, also though, any preceding and following white space also ignored including previous and following returns
// ***Displayed object name section***
{{#ifeq:{{{2|NoName}}}|NoName// Has user entered second parameter?
// Here NoName as preset value for param 2 makes the test possible
// if it remains at preset value then they didn't enter a second parameter at all.
// Preset value here can be anything that's not suitable for a SIMBAD id.
| // Case: no second param
|{{#ifeq:{{{link}}}|no| // link=no?
{{{1}}} // link = no, param 1 as name only
|[[{{{1}}}]] // link=anything else, or not set, param 1 as internal link
}}// end of link = no?
| // Case: second param
{{#ifeq:{{{2|}}}|
| // Second param is blank, e.g. {{CelestialRefTest|Object Name|}}
// no name section at all just bare ref.
| // Second param entered by user, and not blank
//
|{{#ifeq:{{{link}}}|no
|{{{2}}} // // link=no, param 2 as name only
|[[{{{2}}}]] // link=yes or not set, param 2 as internal link
}}// end of link=?
}}// end of test that param 2 is blank
}}// end of test to see if user entered param 2 at all
Test cases
Included mainly to check all the features are working correctly, check this after editing the code and add more test cases if nec if you add new features.
Example: {{ CelestialRefTest | Barnard's star }}
yields Template:CelestialRefTest
Example: {{ CelestialRefTest | Barnard's star |link=no}}
yields Template:CelestialRefTest
Example: {{ CelestialRefTest | Barnard's star | }} for ref only
yields Template:CelestialRefTest
Example: {{ CelestialRefTest | M 31 | Andromeda Galaxy }} to display as Andromeda Galaxy but look up as M 31
yields Template:CelestialRefTest
Same example, name only, no internal link: {{ CelestialRefTest | M 31 | Andromeda Galaxy |link=no}}
yields Template:CelestialRefTest
Final example shows all the features in one ref
Example: {{CelestialRefTest| M 31 | cds=short | ids=show | bib=show | plot = 10 |units = arcsec | image=show | bwimage=show }}
yields Template:CelestialRefTest