User:Robertinventor/CelestialRef/doc

Documentation
User:Robertinventor/CelestialRef 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: cite simbad if you just want to add the SIMBAD footnote, without these extra options.

Examples
Any identifier recognized by Simbad for its sim-basic will do.

So, these are all possible:, , etc.

Displayed as:, ,.

This shows all the features in use: Example:

yields

Same example with commas instead of dashes :

yields

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.

yields:

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

Yields:

You can miix with other named parameters in any order, e.g.:

(same idea but added an extra named parameter at the end) Yields:

Which you could then add to some text as Test

Test

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:

yields:

yields:

Siblings
You can add a link for siblings e.g.

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:

yields  to plot stars within 5 arcmins of HD 189733b

Example:

yields  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:

Data from Giant Planets around Late K Dwarf Stars - Table 1

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:

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*** // 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:

yields

Example:

yields

Example: for ref only

yields

Example: to display as Andromeda Galaxy but look up as M 31

yields

Same example, name only, no internal link:

yields

Final example shows all the features in one ref

Example:

yields