Difference between pages "Template:CelestialRef" and "Template:CelestialRef/sandbox"

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
imported>Plastikspork
(Use trim)
 
imported>Frze
(== References == <references />)
 
Line 1: Line 1:
<includeonly><!--
+
{{#if:{{{link|}}}{{{2|}}}
***Displayed object name section***
+
  |{{#if:{{{2|}}}
-->{{#ifeq:{{{2|NoName}}}|NoName|<!-- Has user entered second parameter?
+
    |[[{{{2}}}|{{{1}}}]]
* Here NoName as preset value for param 2 makes the test possible
+
    |[[{{{1}}}]]
* 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.
+
  |{{{1}}}
+
}}{{#tag:ref|{{cite simbad |title={{{simbad name|{{{1|}}}}}} |accessdate={{{accessdate<includeonly>|</includeonly>}}} }}}}
* Case: no second param
+
<noinclude>
+
{{reflist}}
-->{{#ifeq:{{{link}}}|no<!-- link=no?
 
 
 
*  link = no, param 1 as name only
 
-->|{{trim|{{{1}}}}}<!--
 
 
 
* link=anything else, or not set, param 1 as internal link, but can be
 
* overriden with internal=... (this is useful in case where SIMBAD id and display
 
* name are the same but internal name is different)
 
-->|[[<!--
 
-->{{trim|<!--
 
--->{{#ifeq:{{{internal|}}}|<!-- internal blank, or not set
 
---->|{{{1}}}<!--
 
---->|{{{internal}}}{{!}}{{{1}}}<!--
 
--->}}<!-- end of internal=?
 
--->}}<!-- end of trim
 
-->]]<!--
 
-->}}<!-- end of link = no?
 
 
 
-->|<!--
 
 
 
* Case: second param
 
-->{{#ifeq:{{trim|{{{2|}}}}}||<!-- Is it blank?
 
 
 
* Second param is blank, e.g. {{CelestialRef|Object Name|}}
 
* no name section at all just bare ref.
 
 
 
* Second param entered by user, and not blank
 
-->|{{#ifeq:{{{link}}}|no|<!--
 
-->{{trim|{{{2}}}}}<!-- link=no, param 2 as name only
 
 
 
*  link=yes or not set, param 2 as internal link
 
-->|[[{{trim|<!--
 
 
 
* User can enter a 3rd param for the display name
 
* as: simbad name | internal link | internal link displayed as
 
--->{{#ifeq:{{{3|}}}||{{{2}}}|{{{2}}}{{!}}{{{3}}}}}}}<!--
 
--->]]<!--
 
-->}}<!-- end of link=?
 
-->}}<!-- end of test that param 2 is blank
 
-->}}<!-- end of test to see if user entered param 2 at all
 
 
 
* This adds a non breaking space before the <ref> tag but
 
* if user entered a blank value for param 2, no space at all
 
* because no previous name
 
-->{{#ifeq:{{{2|NoName}}}|||<!--
 
 
 
-->{{#ifeq:{{{inline}}}|yes|&#58;&#160;|&#160;}}<!--for inline need a :&#160;
 
 
 
-->}}<!-- Ends test of param 2 == NoName for non breaking white space
 
 
 
-->{{#ifeq:{{{inline}}}|yes|<!--
 
 
 
* Note the code here is repeated twice, seems unavoidable because of the
 
* lack of variable assignment in templates
 
* first for Inline version then for the Footnote version
 
* so any changes in one section should also be made
 
* in the other section
 
* The main complication is the test for extrasep
 
* which I've made into a subsidiary template called
 
* with extrasep, radio and newline as params
 
 
 
* Inline version
 
-->{{CelestialRef/Extras<!--
 
-->|{{{1}}}<!--
 
-->|{{{2}}}<!--
 
-->|cds={{{cds|}}}<!--
 
 
 
* Check for extrasep, used to create new line or other
 
* content before the extras such as bibliography, ids etc.
 
* extrasep overrides radio and radio overrides newline
 
* The logic for that takes a fair number of lines of code
 
* so put in CelestialRef/ExtraSep
 
 
 
-->|extrasep=<!--
 
--->{{CelestialRef/ExtraSep<!--
 
---->|radio={{{radio|}}}<!--
 
---->|newline={{{newline|no}}}<!--
 
---->|extrasep={{{extrasep|}}}<!--
 
--->}}<!--
 
 
 
-->|simbad={{{simbad|short}}}<!--
 
-->|ids={{#ifeq:{{{all}}}|show|show|{{{ids|}}}}}<!--
 
-->|bib={{#ifeq:{{{all}}}|show|show|{{{bib|}}}}}<!--
 
-->|siblings={{{siblings|}}}<!--
 
-->|plot={{{plot|}}}<!--
 
-->|units={{{units|arcmin}}}<!--
 
 
 
* here images=hide is an override you can call to hide images
 
* useful when combined with all=show, currently all=show|images=hide
 
* has same effect as ids=show|bib=show
 
-->|image={{#ifeq:{{{images|show}}}|hide||{{#ifeq:{{{all}}}|show|show|{{{image|}}}}}}}<!--
 
-->|bwimage={{{bwimage|}}}<!--
 
-->|sep={{{sep|&#32;-&#32;}}}<!--
 
-->|at={{{at|yes}}}<!--
 
-->}}<!-- end CelestialRef/Extras
 
 
 
* Footnote version, wrapped in {{*tag:ref|...}}
 
-->|{{#tag:ref|<!--
 
-->{{CelestialRef/Extras<!--
 
-->|{{{1}}}<!--
 
-->|{{{2}}}<!--
 
-->|cds={{{cds|}}}<!--
 
 
 
* Check for extrasep, used to create new line or other
 
* content before the extras such as bibliography, ids etc.
 
* extrasep overrides radio and radio overrides newline
 
* The logic for that takes a fair number of lines of code
 
* so put in CelestialRef/ExtraSep
 
 
 
-->|extrasep=<!--
 
--->{{CelestialRef/ExtraSep<!--
 
---->|radio={{{radio|}}}<!--
 
---->|newline={{{newline|no}}}<!--
 
---->|extrasep={{{extrasep|}}}<!--
 
--->}}<!--
 
 
 
-->|simbad={{{simbad|short}}}<!--
 
-->|ids={{#ifeq:{{{all}}}|show|show|{{{ids|}}}}}<!--
 
-->|bib={{#ifeq:{{{all}}}|show|show|{{{bib|}}}}}<!--
 
-->|siblings={{{siblings|}}}<!--
 
-->|plot={{{plot|}}}<!--
 
-->|units={{{units|arcmin}}}<!--
 
 
 
* here images=hide is an override you can call to hide images
 
* useful when combined with all=show, currently all=show|images=hide
 
* has same effect as ids=show|bib=show
 
-->|image={{#ifeq:{{{images|show}}}|hide||{{#ifeq:{{{all}}}|show|show|{{{image|}}}}}}}<!--
 
-->|bwimage={{{bwimage|}}}<!--
 
-->|sep={{{sep|&#32;-&#32;}}}<!--
 
-->|at={{{at|yes}}}<!--
 
-->}}<!-- end CelestialRef/Extras
 
-->}}<!-- end #tag:ref
 
-->}}<!-- end inline=yes?
 
--></includeonly><noinclude>
 
 
{{documentation}}
 
{{documentation}}
[[Category:Astronomy templates]]
 
 
</noinclude>
 
</noinclude>
 +
<references />