Code

Ticket #13188: 13188.diff

File 13188.diff, 10.8 KB (added by dwillis, 4 years ago)
Line 
1From c4da211c0e07ecd408d4256d3b4305afdb8ea569 Mon Sep 17 00:00:00 2001
2From: Derek Willis <dwillis@gmail.com>
3Date: Sun, 1 Aug 2010 21:03:18 -0400
4Subject: [PATCH] Move custom format documentation from now tag to date filter
5
6---
7 docs/ref/templates/builtins.txt |  143 ++++++++++++++++++++-------------------
8 1 files changed, 74 insertions(+), 69 deletions(-)
9
10diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
11index 002aa3f..0477653 100644
12--- a/docs/ref/templates/builtins.txt
13+++ b/docs/ref/templates/builtins.txt
14@@ -640,75 +640,12 @@ See :ref:`Custom tag and filter libraries <howto-custom-template-tags>` for more
15 now
16 ~~~
17 
18-Display the date, formatted according to the given string.
19+Display the current date and/or time, according to the given string.
20 
21-Uses the same format as PHP's ``date()`` function (http://php.net/date)
22-with some custom extensions.
23-
24-Available format strings:
25-
26-    ================  ========================================  =====================
27-    Format character  Description                               Example output
28-    ================  ========================================  =====================
29-    a                 ``'a.m.'`` or ``'p.m.'`` (Note that       ``'a.m.'``
30-                      this is slightly different than PHP's
31-                      output, because this includes periods
32-                      to match Associated Press style.)
33-    A                 ``'AM'`` or ``'PM'``.                     ``'AM'``
34-    b                 Month, textual, 3 letters, lowercase.     ``'jan'``
35-    B                 Not implemented.
36-    c                 ISO 8601 Format.                          ``2008-01-02T10:30:00.000123``
37-    d                 Day of the month, 2 digits with           ``'01'`` to ``'31'``
38-                      leading zeros.
39-    D                 Day of the week, textual, 3 letters.      ``'Fri'``
40-    f                 Time, in 12-hour hours and minutes,       ``'1'``, ``'1:30'``
41-                      with minutes left off if they're zero.
42-                      Proprietary extension.
43-    F                 Month, textual, long.                     ``'January'``
44-    g                 Hour, 12-hour format without leading      ``'1'`` to ``'12'``
45-                      zeros.
46-    G                 Hour, 24-hour format without leading      ``'0'`` to ``'23'``
47-                      zeros.
48-    h                 Hour, 12-hour format.                     ``'01'`` to ``'12'``
49-    H                 Hour, 24-hour format.                     ``'00'`` to ``'23'``
50-    i                 Minutes.                                  ``'00'`` to ``'59'``
51-    I                 Not implemented.
52-    j                 Day of the month without leading          ``'1'`` to ``'31'``
53-                      zeros.
54-    l                 Day of the week, textual, long.           ``'Friday'``
55-    L                 Boolean for whether it's a leap year.     ``True`` or ``False``
56-    m                 Month, 2 digits with leading zeros.       ``'01'`` to ``'12'``
57-    M                 Month, textual, 3 letters.                ``'Jan'``
58-    n                 Month without leading zeros.              ``'1'`` to ``'12'``
59-    N                 Month abbreviation in Associated Press    ``'Jan.'``, ``'Feb.'``, ``'March'``, ``'May'``
60-                      style. Proprietary extension.
61-    O                 Difference to Greenwich time in hours.    ``'+0200'``
62-    P                 Time, in 12-hour hours, minutes and       ``'1 a.m.'``, ``'1:30 p.m.'``, ``'midnight'``, ``'noon'``, ``'12:30 p.m.'``
63-                      'a.m.'/'p.m.', with minutes left off
64-                      if they're zero and the special-case
65-                      strings 'midnight' and 'noon' if
66-                      appropriate. Proprietary extension.
67-    r                 RFC 2822 formatted date.                  ``'Thu, 21 Dec 2000 16:01:07 +0200'``
68-    s                 Seconds, 2 digits with leading zeros.     ``'00'`` to ``'59'``
69-    S                 English ordinal suffix for day of the     ``'st'``, ``'nd'``, ``'rd'`` or ``'th'``
70-                      month, 2 characters.
71-    t                 Number of days in the given month.        ``28`` to ``31``
72-    T                 Time zone of this machine.                ``'EST'``, ``'MDT'``
73-    u                 Microseconds.                             ``0`` to ``999999``
74-    U                 Seconds since the Unix Epoch
75-                      (January 1 1970 00:00:00 UTC).
76-    w                 Day of the week, digits without           ``'0'`` (Sunday) to ``'6'`` (Saturday)
77-                      leading zeros.
78-    W                 ISO-8601 week number of year, with        ``1``, ``53``
79-                      weeks starting on Monday.
80-    y                 Year, 2 digits.                           ``'99'``
81-    Y                 Year, 4 digits.                           ``'1999'``
82-    z                 Day of the year.                          ``0`` to ``365``
83-    Z                 Time zone offset in seconds. The          ``-43200`` to ``43200``
84-                      offset for timezones west of UTC is
85-                      always negative, and for those east of
86-                      UTC is always positive.
87-    ================  ========================================  =====================
88+Given format can be one of the predefined ones ``DATE_FORMAT``,
89+``DATETIME_FORMAT``, ``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``,
90+or a custom format, same as the :tfilter:`date` filter. Note that predefined formats
91+may vary depending on the current locale.
92 
93 Example::
94 
95@@ -1134,6 +1071,74 @@ date
96 
97 Formats a date according to the given format.
98 
99+Uses the same format as PHP's ``date()`` function (http://php.net/date)
100+with some custom extensions.
101+
102+Available format strings:
103+
104+    ================  ========================================  =====================
105+    Format character  Description                               Example output
106+    ================  ========================================  =====================
107+    a                 ``'a.m.'`` or ``'p.m.'`` (Note that       ``'a.m.'``
108+                      this is slightly different than PHP's
109+                      output, because this includes periods
110+                      to match Associated Press style.)
111+    A                 ``'AM'`` or ``'PM'``.                     ``'AM'``
112+    b                 Month, textual, 3 letters, lowercase.     ``'jan'``
113+    B                 Not implemented.
114+    c                 ISO 8601 Format.                          ``2008-01-02T10:30:00.000123``
115+    d                 Day of the month, 2 digits with           ``'01'`` to ``'31'``
116+                      leading zeros.
117+    D                 Day of the week, textual, 3 letters.      ``'Fri'``
118+    f                 Time, in 12-hour hours and minutes,       ``'1'``, ``'1:30'``
119+                      with minutes left off if they're zero.
120+                      Proprietary extension.
121+    F                 Month, textual, long.                     ``'January'``
122+    g                 Hour, 12-hour format without leading      ``'1'`` to ``'12'``
123+                      zeros.
124+    G                 Hour, 24-hour format without leading      ``'0'`` to ``'23'``
125+                      zeros.
126+    h                 Hour, 12-hour format.                     ``'01'`` to ``'12'``
127+    H                 Hour, 24-hour format.                     ``'00'`` to ``'23'``
128+    i                 Minutes.                                  ``'00'`` to ``'59'``
129+    I                 Not implemented.
130+    j                 Day of the month without leading          ``'1'`` to ``'31'``
131+                      zeros.
132+    l                 Day of the week, textual, long.           ``'Friday'``
133+    L                 Boolean for whether it's a leap year.     ``True`` or ``False``
134+    m                 Month, 2 digits with leading zeros.       ``'01'`` to ``'12'``
135+    M                 Month, textual, 3 letters.                ``'Jan'``
136+    n                 Month without leading zeros.              ``'1'`` to ``'12'``
137+    N                 Month abbreviation in Associated Press    ``'Jan.'``, ``'Feb.'``, ``'March'``, ``'May'``
138+                      style. Proprietary extension.
139+    O                 Difference to Greenwich time in hours.    ``'+0200'``
140+    P                 Time, in 12-hour hours, minutes and       ``'1 a.m.'``, ``'1:30 p.m.'``, ``'midnight'``, ``'noon'``, ``'12:30 p.m.'``
141+                      'a.m.'/'p.m.', with minutes left off
142+                      if they're zero and the special-case
143+                      strings 'midnight' and 'noon' if
144+                      appropriate. Proprietary extension.
145+    r                 RFC 2822 formatted date.                  ``'Thu, 21 Dec 2000 16:01:07 +0200'``
146+    s                 Seconds, 2 digits with leading zeros.     ``'00'`` to ``'59'``
147+    S                 English ordinal suffix for day of the     ``'st'``, ``'nd'``, ``'rd'`` or ``'th'``
148+                      month, 2 characters.
149+    t                 Number of days in the given month.        ``28`` to ``31``
150+    T                 Time zone of this machine.                ``'EST'``, ``'MDT'``
151+    u                 Microseconds.                             ``0`` to ``999999``
152+    U                 Seconds since the Unix Epoch
153+                      (January 1 1970 00:00:00 UTC).
154+    w                 Day of the week, digits without           ``'0'`` (Sunday) to ``'6'`` (Saturday)
155+                      leading zeros.
156+    W                 ISO-8601 week number of year, with        ``1``, ``53``
157+                      weeks starting on Monday.
158+    y                 Year, 2 digits.                           ``'99'``
159+    Y                 Year, 4 digits.                           ``'1999'``
160+    z                 Day of the year.                          ``0`` to ``365``
161+    Z                 Time zone offset in seconds. The          ``-43200`` to ``43200``
162+                      offset for timezones west of UTC is
163+                      always negative, and for those east of
164+                      UTC is always positive.
165+    ================  ========================================  =====================
166+
167 Given format can be one of the predefined ones ``DATE_FORMAT``,
168 ``DATETIME_FORMAT``, ``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``,
169 or a custom format, same as the :ttag:`now` tag. Note that predefined formats
170@@ -1784,7 +1789,7 @@ time
171 Formats a time according to the given format.
172 
173 Given format can be the predefined one ``TIME_FORMAT``, or a custom format,
174-same as the :ttag:`now` tag. Note that the predefined format is locale-
175+same as the :tfilter:`date` filter. Note that the predefined format is locale-
176 dependant.
177 
178 The time filter will only accept parameters in the format string that relate
179--
1801.6.5.7
181