Difference between revisions of "Template:APOD"

From blackwiki
Jump to navigation Jump to search
blackwiki>Primefac
(TFD closed as Keep (using TFDcloser))
blackwiki>Tom.Reding
(Accept a wider range of date formats (taken from {{Cite APOD}}))
Line 1: Line 1:
 +
<includeonly>[http://apod.nasa.gov/apod/ap{{#iferror: {{#expr:{{str sub|{{{date|}}}|0|4}} * 1}}|<!--
  
<includeonly>[http://apod.nasa.gov/apod/ap{{#if:{{{date|}}}|{{str sub|{{date|{{{date|}}}|iso}}|2|2}}{{str sub|{{date|{{{date|}}}|iso}}|5|2}}{{str sub|{{date|{{{date|}}}|iso}}|8|2}}.html}} NASA's APOD: {{{title|}}} ({{{date|}}})]</includeonly><noinclude>
+
!YMD (yyyy is not in front): -->{{#if:{{{date|}}}|{{str sub|{{date|{{{date|}}}|iso}}|2|2}}{{str sub|{{date|{{{date|}}}|iso}}|5|2}}{{str sub|{{date|{{{date|}}}|iso}}|8|2}}.html}}|<!--
 +
 
 +
Y *is* in front. Now check month: m & mm ok, mmm & mmmm bad.
 +
-->{{#iferror: {{#expr:{{str sub|{{{date|}}}|5|2}} * 1}}|<!--
 +
 
 +
mmm & mmmm bad:
 +
{{date|yyyy mmm d|iso}} doesn't work, so YMD needs to be reformatted to an acceptable format.
 +
YMD: --> {{#if:{{{date|}}}|<!--
 +
YMD input Y-->{{str sub|{{date|{{str sub|{{{date|}}}|0|4}}-<!--
 +
YMD input M-->{{MONTHNUMBER|{{str sub|{{{date|}}}|5|3}}}}-<!--
 +
YMD input D-->{{str rightc|{{{date|}}}|2}}<!--
 +
YMD output Y-->|iso}}|2|2}}<!--
 +
YMD input Y-->{{str sub|{{date|{{str sub|{{{date|}}}|0|4}}-<!--
 +
YMD input M-->{{MONTHNUMBER|{{str sub|{{{date|}}}|5|3}}}}-<!--
 +
YMD input D-->{{str rightc|{{{date|}}}|2}}|iso}}<!--
 +
YMD output M-->|5|2}}<!--
 +
YMD input Y-->{{str sub|{{date|{{str sub|{{{date|}}}|0|4}}-<!--
 +
YMD input M-->{{MONTHNUMBER|{{str sub|{{{date|}}}|5|3}}}}-<!--
 +
YMD input D-->{{str rightc|{{{date|}}}|2}}|iso}}<!--
 +
YMD output D-->|8|2}}<!--
 +
Finish URL-->.html}}|<!--
 +
 
 +
m & mm ok:
 +
-->{{#if:{{{date|}}}|{{str sub|{{date|{{{date|}}}|iso}}|2|2}}{{str sub|{{date|{{{date|}}}|iso}}|5|2}}{{str sub|{{date|{{{date|}}}|iso}}|8|2}}.html}} }} }} NASA's APOD: {{{title|}}} ({{{date|}}})]</includeonly><noinclude>
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 12:38, 26 September 2016

Template documentation[view] [edit] [history] [purge]

Usage

This template aids in the creation and standardization of an external link to NASA's Astronomy Picture of the Day (APOD).

The following 2 named parameters are required:

  • |date= is the date the picture appeared on APOD.
  • |title= refers to the title of the |date='s APOD image, which normally appears immediately below the image. Do not use |title=Astronomy Picture of the Day.

Empty template with all parameters: {{APOD |date= |title=}}

Examples

{{APOD |date=19 January 2014 |title=Spiral Galaxies in Collision}}
Template:Str subTemplate:Str subTemplate:Str sub.html NASA's APOD: Spiral Galaxies in Collision (19 January 2014)

See also

  • {{Cite APOD}} — for the citation version of this template