HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2384Define 'week' syntax. Details coming later.2008-10-30 01:56
@@ -2029,23 +2029,23 @@
    title="">position</var> is not a U+002D HYPHEN-MINUS character,
    then fail. Otherwise, move <var title="">position</var> forwards
    one character.</p></li>
 
    <li><p><span>Collect a sequence of characters</span> in the range
    U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
    sequence is not exactly two characters long, then fail. Otherwise,
    interpret the resulting sequence as a base-ten integer. Let that
    number be the <var title="">month</var>.</p></li>
 
-   <li>If <var title="">month</var> is not a number in the range
+   <li><p>If <var title="">month</var> is not a number in the range
    1&nbsp;&le;&nbsp;<var title="">month</var>&nbsp;&le;&nbsp;12, then
-   fail.</li>
+   fail.</p></li>
 
    <li><p>Return <var title="">year</var> and <var
    title="">month</var>.</p></li>
 
   </ol>
 
 
   <h5>Dates</h5>
 
   <p>A <dfn title="concept-date">date</dfn> consists of a specific
@@ -2294,23 +2294,23 @@
      title="">second</var> instead of its previous value.</p></li>
 
     </ol>
 
    </li>
 
    <li><p>Interpret <var title="">second</var> as a base-ten number
    (possibly with a fractional part). Let <var title="">second</var>
    be that number instead of the string version.</p></li>
 
-   <li>If <var title="">second</var> is not a number in the range
+   <li><p>If <var title="">second</var> is not a number in the range
    0&nbsp;&le;&nbsp;<var title="">second</var>&nbsp;&lt;&nbsp;60, then
-   fail.</li>
+   fail.</p></li>
 
    <li><p>Return <var title="">hour</var>, <var title="">minute</var>,
    and <var title="">second</var>.</p></li>
 
   </ol>
 
 
 
   <h5>Local dates and times</h5>
 
@@ -2633,24 +2633,99 @@
 
   <h5>Weeks</h5>
 
   <p>A <dfn title="concept-week">week</dfn> consists of a specific
   Gregorian date with no timezone information and no date information
   beyond a year and a week. <a
   href="#refsGREGORIAN">[GREGORIAN]</a></p>
 
   <!-- XXX ISO week information -->
 
-  <p class="XXX">... <dfn>valid week string</dfn></p>
+  <p class="XXX">The <dfn>week number</dfn> of a day is ...</p>
+
+  <p class="XXX">The <dfn>week number of the last day</dfn> of a year ...</p>
+
+  <p>A string is a <dfn>valid week string</dfn> representing a year
+  <var title="">year</var> and week <var title="">week</var> if it
+  consists of the following components in the given order:</p>
+
+  <ol>
+
+   <li>Four or more <span
+   title="concept-datetime-digit">digits</span>, representing <var
+   title="">year</var></li>
+
+   <li>A U+002D HYPHEN-MINUS character (-)</li>
+
+   <li>A U+0057 LATIN CAPITAL LETTER W character</li>
+
+   <li>Two <span title="concept-datetime-digit">digits</span>,
+   representing the week <var title="">week</var>, in the range
+   1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var
+   title="">maxweek</var>, where <var title="">maxweek</var> is the
+   <span>week number of the last day</span> of year <var
+   title="">year</var></li>
+
+  </ol>
 
-  <p class="XXX">... rules to <dfn>parse a week string</dfn></p>
+  <p>The rules to <dfn>parse a week string</dfn> are as follows. This
+  will either return a year and week, or nothing. If at any point the
+  algorithm says that it "fails", this means that it is aborted at
+  that point and returns nothing.</p>
+
+  <ol>
+
+   <li><p>Let <var title="">input</var> be the string being
+   parsed.</p></li>
+
+   <li><p>Let <var title="">position</var> be a pointer into <var
+   title="">input</var>, initially pointing at the start of the
+   string.</p></li>
 
+   <li><p><span>Collect a sequence of characters</span> in the range
+   U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+   sequence is not at least four characters long, then
+   fail. Otherwise, interpret the resulting sequence as a base-ten
+   integer. Let that number be the <var title="">year</var>.</p></li>
+
+   <li><p>If <var title="">position</var> is beyond the end of <var
+   title="">input</var> or if the character at <var
+   title="">position</var> is not a U+002D HYPHEN-MINUS character,
+   then fail. Otherwise, move <var title="">position</var> forwards
+   one character.</p></li>
+
+   <li><p>If <var title="">position</var> is beyond the end of <var
+   title="">input</var> or if the character at <var
+   title="">position</var> is not a 0057 LATIN CAPITAL LETTER W
+   character, then fail. Otherwise, move <var title="">position</var>
+   forwards one character.</p></li>
+
+   <li><p><span>Collect a sequence of characters</span> in the range
+   U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected
+   sequence is not exactly two characters long, then fail. Otherwise,
+   interpret the resulting sequence as a base-ten integer. Let that
+   number be the <var title="">week</var>.</p></li>
+
+   <li><p>Let <var title="">maxweek</var> be the <span>week number of
+   the last day</span> of year <var title="">year</var>.</p></li>
+
+   <li><p>If <var title="">week</var> is not a number in the range
+   1&nbsp;&le;&nbsp;<var title="">week</var>&nbsp;&le;&nbsp;<var
+   title="">maxweek</var>, then fail.</p></li>
+
+   <li><p>If <var title="">position</var> is <em>not</em> beyond the
+   end of <var title="">input</var>, then fail.</p></li>
+
+   <li><p>Return <var title="">year</var> and <var
+   title="">week</var>.</p></li>
+
+  </ol>
 
 
   <h5>Vaguer moments in time</h5>
 
   <p>This section defines <dfn title="date or time string">date or
   time strings</dfn>. There are two kinds, <dfn title="date or time
   string in content">date or time strings in content</dfn>, and <dfn
   title="date or time string in attributes">date or time strings in
   attributes</dfn>. The only difference is in the handling of
   whitespace characters.</p>

|