User:Davidruben/sandbox2#Part dates and free text

If you have made any changes to the code of this template you need to {{purge|purge this page}} to see the changes in these examples.

=none=

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01}}

Generates: {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01}}

==Current coding error==

NO red-linked dates, i.e. 2008-01-01, if a user has no date preference set, in this example where hard coded date stylining (so why previously failed using a metatemplate for simpler coding ?) David Ruben Talk 17:37, 14 July 2008 (UTC)

NB meta:Help:Date_formatting_and_linking#Accessibility of date preference for branching states "The date format cannot be detected with #ifeq, because the date format is converted after expansion of parser functions." so not possible, it seems to detect user date format within a parser function. Is this why pervious metatemplate works on its own but not within another parser fuction ? Get rid of format test therefore in this example - hence entries either:

  1. Wikified showing user-preference but for majority of users (who have not set ther preference and the case for all anons) as a blue linked ISO YYYY MM-DD
  2. Else one of 3 editor-selected unlinked fixed formats.

=blank=

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=}}

Generates: {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=}}

=DMY=

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=dmy}}

Generates: {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=dmy}}

=MDY=

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=mdy}}

Generates: {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=mdy}}

=YMD=

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=ymd}}

Generates: {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=ymd}}

=Pre 1970 issue=

Because Unix cannot handle dates before 1970, these can not be converted into date styles by the wikipedia parserfunction {{#time: }} function:

:Hence {{#time:Y-m-d|1975-09-15}}| shows as {{#time:Y-m-d|1975-09-15}} but {{#time:Y-m-d|1935-09-15}}| shows as {{#time:Y-m-d|1935-09-15}}

However early dates can be wikified:

:Hence 1935-09-15 shows as 1935-09-15

Hence where datestyle is defined, we need to trap dates before 1970. This is done by an initial test date styling and seeing if the outcome is 1970-01-01, in which case no formating is applied and the date is shown as unlinked free text:

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=1935-01-01|date=1935-01-01|datestyle=dmy}}

Generates: {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=1935-01-01|date=1935-01-01|datestyle=dmy}}

=Mis-formated dates=

Some examples of where dates wrongly formated or presented already partly wikilinked (datestyle set to "mdy" throughout). All result in some form of a date being shown (ie no "error" is seen to occur). In practice any date value that can not be formated (as is the case if already manually part wikilinked) is show directly as that parameter value (i.e. the wikilinked value itself). Hence in examples below "3rd February 2008" can be formated and so this is undertaken, but the template and parser functions do not reconginse say "20 May 2007", "20 May,2007" or "20 May of the year 2007" and these are shown directly as entered. This show as-is if any sort of error is needed to cope with MediaWiki's bugs of not being able to handle dates before 1901.

  • date=20 May 2007
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=20 May 2007 |datestyle=mdy}}
  • date=20 May 2007
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=20 May 2007 |datestyle=mdy}}
  • date=May 20 2007
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=May 20 2007|datestyle=mdy}}
  • date=3rd February 2008
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=3rd February 2008|datestyle=mdy}}
  • date=20 May 1968
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=20 May 1968|datestyle=mdy}}
  • date=2007-04-13
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=2007-04-13 |datestyle=mdy}}

Finally compare handling for a pre-1901 date:

  • date=20 May 1884 & datestyle=mdy not a date format and so shown as-is
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=20 May 1884|datestyle=mdy}}
  • but date=1884-05-20 & datestyle=mdy - cannot be formated as pre-1901
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=1884-05-20|datestyle=mdy}}
  • but date=1884-05-20 & datestyle blank (i.e. forcing wikified dates)
    {{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|date=1884-05-20|datestyle=}}

=Part dates and free text=

:Current {{cite web |title=Title |url=http://example.org |date=2007-10-16 |accessdate=2008-07-20}}

::Gives: {{cite web |title=Title |url=http://example.org |date=2007-10-16 |accessdate=2008-07-20}}

::and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=2007-10-16 |accessdate=2008-07-20}}

:::for: {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=2007-10-16 |accessdate=2008-07-20 |datestyle=}} - nolonger link true ISO dates after 1970

:Part date{{cite web |title=Title |url=http://example.org |date=August 2007 |accessdate=July 2008 }}

::Gives: {{cite web |title=Title |url=http://example.org |date=August 2007 |accessdate=July 2008 }}

::and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=August 2007 |accessdate=July 2008 |datestyle=}}

:::for: {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=August 2007 |accessdate=July 2008 |datestyle=}}

:Just year{{cite web |title=Title |url=http://example.org |date=2007 |accessdate=2008}}

::Gives: {{cite web |title=Title |url=http://example.org |date=2007 |accessdate=2008}}

::and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=2007 |accessdate=2008}}

:::for: {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=2007 |accessdate=2008|datestyle=}}

:Free text{{cite web |title=Title |url=http://example.org |date=pre 2007 |accessdate=last week}}

::Gives: {{cite web |title=Title |url=http://example.org |date=pre 2007 |accessdate=last week}}

::and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=pre 2007 |accessdate=last week}}

:::for: {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=pre 2007 |accessdate=last week|datestyle=}}

:Ok so that is where the new proposal overlinked (valid) values for "date" and redlinked invalid date formats (something that seemed a useful feature, except "undated" was not considered as a possible valid value). But if the approach was to be extended to {{tl|cite book}}, then issue of coping with pre-1970 & pre-1901 dates:

:Pre 1970:{{cite web |title=Title |url=http://example.org |date=1960-01-27 |accessdate=1965-05-16}}

::Gives: {{cite web |title=Title |url=http://example.org |date=1960-01-27 |accessdate=1965-05-16}}

::and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=1960-01-27 |accessdate=1965-05-16|datestyle=}}

:::for: {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=1960-01-27 |accessdate=1965-05-16|datestyle=}}

:But pre-1901:{{cite web |title=Title |url=http://example.org |date=1860-01-27 |accessdate=1965-05-16}}

::Gives: {{cite web |title=Title |url=http://example.org |date=1860-01-27 |accessdate=1965-05-16}}

::and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=1860-01-27 |accessdate=1965-05-16|datestyle=}}

:::for: {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=1860-01-27 |accessdate=1965-05-16|datestyle=}}

{{

  1. if: {{#if: {{{url|}}} | {{#if: {{{title|}}} |1}}}}

||You must specify title = and url = when using {{cite web}}.

{{#if: {{NAMESPACE}}|| Category:Articles with broken citations}}

}}{{

  1. if: {{{archiveurl|}}}{{{archivedate|}}}

| {{#if: {{#if: {{{archiveurl|}}}| {{#if: {{{archivedate|}}} |1}}}}

||You must specify archiveurl = and archivedate = when using {{cite web}}.

{{#if: {{NAMESPACE}}|| Category:Articles with broken citations}}

}}

}}{{#if: {{{author|}}}{{{last|}}}

| {{#if: {{{authorlink|}}}

| [[{{{authorlink}}}|{{#if: {{{last|}}}

| {{{last}}}{{#if: {{{first|}}} | , {{{first}}} }}

| {{{author}}}

}}]]

| {{#if: {{{last|}}}

| {{{last}}}{{#if: {{{first|}}} | , {{{first}}} }}

| {{{author}}}

}}

}}

}}{{#if: {{{author|}}}{{{last|}}}

| {{#if: {{{coauthors|}}}| ; {{{coauthors}}} }}

}}{{#if: {{{author|}}}{{{last|}}}|

{{#if: {{{date|}}}

| ({{User:Davidruben/sandbox|{{{datestyle|}}}|{{{date|}}}}})

| {{#if: {{{year|}}}

| {{#if: {{{month|}}}

| ({{{month}}} {{{year}}})

| ({{{year}}})

}}

}}

}}

}}{{#if: {{{last|}}}{{{author|}}}

| . }}{{

#if: {{{editor|}}}

| {{{editor}}}:

}}{{#if: {{{curly|}}}|“|"

}}{{#if: {{{archiveurl|}}}

| {{#if: {{{archiveurl|}}} | {{#if: {{{title|}}} | [{{{archiveurl}}} {{{title}}}] }}}}

| {{#if: {{{url|}}} | {{#if: {{{title|}}} | [{{{url}}} {{{title}}}] }}}}

}}{{#if: {{{curly|}}}|”|"

}}{{#if: {{{format|}}} | ({{{format}}})

}}{{#if: {{{language|}}} | ({{{language}}})

}}{{#if: {{{work|}}}

| . {{{work}}}

}}{{#if: {{{pages|}}}

| {{{pages}}}

}}{{#if: {{{publisher|}}}

| . {{{publisher}}}{{#if: {{{author|}}}{{{last|}}}

|

| {{#if: {{{date|}}}{{{year|}}}{{{month|}}} || }}

}}

}}{{#if: {{{author|}}}{{{last|}}}

| | {{#if: {{{date|}}}| ({{User:Davidruben/sandbox|{{{datestyle|}}}|{{{date|}}}}})| {{#if: {{{year|}}}

| {{#if: {{{month|}}}

| ({{{month}}} {{{year}}})

| ({{{year}}})

}}

}}

}}

}}.{{#if: {{{archivedate|}}}

| Archived from [{{{url}}} the original] on {{User:Davidruben/sandbox|{{{datestyle|}}}|{{{archivedate|}}}}}.

}}{{#if: {{{doi|}}}

| DOI:[http://dx.doi.org/{{{doi|{{{doilabel|}}}}}} {{{doi}}}].

}}{{#if: {{{accessdate|}}}

| Retrieved on {{User:Davidruben/sandbox|{{{datestyle|}}}|{{{accessdate|}}}}}{{#if: {{{accessyear|}}} | , {{{accessyear}}} }}.

}}{{#if: {{{accessmonthday|}}}

| Retrieved on {{{accessmonthday}}}{{#if: {{{accessyear|}}} | , {{{accessyear|}}} }}.

}}{{#if: {{{accessdaymonth|}}}

| Retrieved on {{{accessdaymonth}}}{{#if: {{{accessyear|}}} | {{{accessyear|}}} }}.

}}{{#if: {{{quote|}}}

|  “{{{quote}}}”

}}