#pattern
* Common microsyntaxes
#ja
$1 共通マイクロ構文
#en
There are various places in HTML that accept particular data types, such
as dates or numbers. This section describes what the conformance criteria
for content in those formats is, and how to parse them.
#ja
HTML 中のいろいろな場所で、日付や数値のような特定のデータ型を使うことができます。
この節では、そのような書式の内容の適合基準は何か、
どう構文解析するかを説明します。
#en
Need to go through the whole spec and make sure all the
attribute values are clearly defined either in terms of microsyntaxes or
in terms of other specs, or as "Text" or some such.
#ja
仕様書全体について、すべての属性値がマイクロ構文を使ってか他の仕様書を使ってか「文章」などとして定義されるようにする必要があります。
#pattern
* Common parser idioms
#ja
$1 構文解析器共通慣用句
#en
The space characters, for
the purposes of this specification, are U+0020 SPACE, U+0009 CHARACTER
TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D
CARRIAGE RETURN (CR).
#ja
間隔文字は、
この仕様書においては、 U+0020 SPACE, U+0009 CHARACTER
TABULATION (tab)、U+000A LINE FEED (LF)、U+000C FORM FEED (FF)、 U+000D
CARRIAGE RETURN (CR) です。
#en
Some of the micro-parsers described below follow the pattern of having
an input variable that holds the string being parsed,
and having a position variable pointing at the next
character to parse in input.
#ja
これ以降で説明するマイクロ構文解析器のいくつかは、構文解析される文字列を保持する
input 変数を持ち、 input
中で次に構文解析する文字を指す position
変数を持つというパターンに従っています。
#en
For parsers based on this pattern, a step that requires the user agent
to collect a sequence of characters means that the
following algorithm must be run, with characters being
the set of characters that can be collected:
#ja
このパターンに従う構文解析器において、利用者エージェントが文字列を集めることを要求している段階は、
次の算法を、 characters
が収集できる文字の集合であるとして実行しなければ[[MUST:ならない]]ことを意味しています。
#en
Let input and position be the
same variables as those of the same name in the algorithm that invoked
these steps.
#ja
input と position
を、これらの段階を呼び出した算法中の同名の変数と同じものとします。
#en
Let result be the empty string.
#ja
result を空文字列とします。
#en
While position doesn't point past the end of input and the character at position
is one of the characters, append that character to
the end of result and advance position to the next character in input.
#ja
position が input の終わりの更に先を指しておらず、 position
の文字が characters のうちの1つである間、
その文字を result の終わりに追加し、 position を input の次の文字に進めます。
#en
Return result.
#ja
result を返します。
#en
The step skip whitespace means that the
user agent must collect a sequence of characters
that are space characters.
The step skip Zs characters means that the user agent
must collect a sequence of characters that are in
the Unicode character class Zs. In both cases, the collected characters
are not used. [UNICODE]
#ja
空白を飛ばす段階は、
利用者エージェントが間隔文字である文字列を集めなければ[[MUST:ならない]]ことを意味します。
Zs 文字を飛ばす段階は、
利用者エージェントが Unicode 文字クラス Zs に含まれる文字列を集めなければ[[MUST:ならない]]ことを意味します。文字列を集めなければ[[MUST:ならない]]ことを意味します。
どちらの場合も、集めた文字は使いません。 [UNICODE]
#pattern
* Boolean attributes
#ja
$1 ブール型属性
#en
A number of attributes in HTML5 are boolean attributes. The presence of a boolean attribute
on an element represents the true value, and the absence of the attribute
represents the false value.
#ja
HTML5 の数々の属性はブール型属性です。要素にブール型属性が存在すると真の値を表し、
存在しないと偽の値を表します。
#en
If the attribute is present, its value must either be the empty string
or a value that is an ASCII case-insensitive match
for the attribute's canonical name, with no leading or trailing
whitespace.
#ja
属性が存在する場合、その値は空文字列か、または
ASCII 大文字・小文字不区別で属性の正準名と一致するような
(先頭にも末尾にも空白がない) 値のいずれかでなければ[[MUST:なりません]]。
#pattern
* Numbers
#ja
$1 数値
#pattern
* Unsigned integers
#ja
$1 符号無し整数
#en
A string is a valid non-negative integer if it
consists of one of more characters in the range U+0030 DIGIT ZERO (0) to
U+0039 DIGIT NINE (9).
#ja
文字列は、範囲 U+0030 DIGIT ZERO (0) ~ U+0039 DIGIT NINE (9)
の文字1文字以上で構成される場合、妥当な非負整数です。
#en
The rules for parsing non-negative integers are as
given in the following algorithm. When invoked, the steps must be followed
in the order given, aborting at the first step that returns a value. This
algorithm will either return zero, a positive integer, or an error.
Leading spaces are ignored. Trailing spaces and indeed any trailing
garbage characters are ignored.
#ja
非負整数を構文解析する規則は次の算法で与えられるものです。
この算法が呼び出された時には、与えられた順に段階に従い、
値を返す最初の段階で中断しなければ[[MUST:なりません]]。
この算法は零か正整数か誤りを返します。
先頭の間隔は無視されます。末尾の空白、というかごみ文字列はすべて無視されます。
#en
Let input be the string being parsed.
#ja
input を構文解析される文字列とします。
#en
Let position be a pointer into input, initially pointing at the start of the string.
#ja
position を input 中の指示子とし、初期位置を文字列の始めとします。
#en
Let value have the value 0.
#ja
value を値 0 にします。
#en
Skip whitespace.
#ja
空白を読み飛ばします。
#en
If position is past the end of input, return an error.
#ja
position が input の終わりを過ぎていれば、誤りを返します。
#en
If the next character is not one of U+0030 DIGIT ZERO (0) .. U+0039
DIGIT NINE (9), then return an error.
#ja
次の文字が U+0030 DIGIT ZERO (0) 〜 U+0039
DIGIT NINE (9) のうちの1つでない場合、誤りを返します。
#en
If the next character is one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT
NINE (9):
#ja
次の文字が U+0030 DIGIT ZERO (0) 〜 U+0039
DIGIT NINE (9) のうちの1つである場合:
#en
Multiply value by ten.
#ja
value を10倍します。
#en
Add the value of the current character (0..9) to value.
#ja
現在の文字の値 (0〜9) を value に加えます。
#en
Advance position to the next character.
#ja
position を次の文字に進めます。
#pattern
If position is not past the end of input, return to the top of step * in the overall
algorithm (that's the step within which these substeps find
themselves).
#ja
position が input の終わりを過ぎていなければ、
算法全体の段階 $1 (これらの部分段階自体が含まれている段階) の先頭に返ります。
#en
Return value.
#ja
value を返します。
#pattern
* Signed integers
#ja
$1 符号付き整数
#en
A string is a valid integer if it consists of one
of more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE
(9), optionally prefixed with a U+002D HYPHEN-MINUS ("-") character.
#ja
文字列は、範囲 U+0030 DIGIT ZERO (0) ~ U+0039 DIGIT NINE
(9) の文字1文字以上で構成され、任意選択で接頭辞として U+002D HYPHEN-MINUS ("-")
文字がある場合、妥当な整数です。
#en
The rules for parsing integers are similar to the
rules for non-negative integers, and are as given in the following
algorithm. When invoked, the steps must be followed in the order given,
aborting at the first step that returns a value. This algorithm will
either return an integer or an error. Leading spaces are ignored. Trailing
spaces and trailing garbage characters are ignored.
#ja
整数を構文解析する規則は、非負整数用の規則と似ており、
次の算法により与えられます。これらの段階は、呼び出された場合、
与えられた順序に従い実行し、初めて値を返す段階で停止しなければ[[MUST:なりません]]。
この算法は整数か誤りのいずれかを返します。先頭の間隔は無視されます。
末尾の間隔や末尾のごみ文字は無視されます。
#en
Let sign have the value "positive".
#ja
sign を、「正」という値を持つようにします。
#en
If the character indicated by position (the first
character) is a U+002D HYPHEN-MINUS ("-") character:
#ja
position が示す文字 (最初の文字)
が U+002D HYPHEN-MINUS ("-") 文字である場合、
#en
Let sign be "negative".
#ja
sign を「負」とします。
#en
If sign is "positive", return value, otherwise return 0-value.
#ja
sign が「正」の場合、 value を返します。そうでない場合、
0-value を返します。
#pattern
* Real numbers
#ja
$1 実数
#en
A string is a valid floating point number if it
consists of one of more characters in the range U+0030 DIGIT ZERO (0) to
U+0039 DIGIT NINE (9), optionally with a single U+002E FULL STOP (".")
character somewhere (either before these numbers, in between two numbers,
or after the numbers), all optionally prefixed with a U+002D HYPHEN-MINUS
("-") character.
#ja
文字列は、範囲 U+0030 DIGIT ZERO (0) ~
U+0039 DIGIT NINE (9) の文字1文字以上で構成され、
任意選択で U+002E FULL STOP (".") 文字1文字がどこか (数字の前か、
2つの数字の間か、数字の後のいずれか) を含み、その全体について任意選択で接頭辞として
U+002D HYPHEN-MINUS ("-") 文字がある場合、妥当な浮動小数点数です。
#en
The rules for parsing floating point number values
are as given in the following algorithm. As with the previous algorithms,
when this one is invoked, the steps must be followed in the order given,
aborting at the first step that returns a value. This algorithm will
either return a number or an error. Leading spaces are ignored. Trailing
spaces and garbage characters are ignored.
#ja
浮動小数点数値を構文解析する規則は次の算法により与えられる通りです。
前述の算法と同様で、この算法が呼び出された時も、
与えられた順序に従い実行し、値を返す最初の段階で停止しなければ[[MUST:なりません]]。
この算法は、数か誤りのいずれかを返します。先頭の間隔は無視されます。
末尾の間隔とごみ文字は無視されます。
#en
If the next character is not one of U+0030 DIGIT ZERO (0) .. U+0039
DIGIT NINE (9) or U+002E FULL STOP ("."), then return an error.
#ja
次の文字が U+0030 DIGIT ZERO (0) ~ U+0039
DIGIT NINE (9) か U+002E FULL STOP (".") のいずれかでなければ、
誤りを返します。
#en
If the next character is U+002E FULL STOP ("."), but either that is
the last character or the character after that one is not one of U+0030
DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), then return an error.
#ja
次の文字が U+002E FULL STOP (".") でありながら、
これが最後の文字であるか、またはその次の文字が U+0030
DIGIT ZERO (0) ~ U+0039 DIGIT NINE (9) のいずれかではない場合、
誤りを返します。
#en
If position is past the end of input, then if sign is "positive",
return value, otherwise return 0-value.
#ja
position が input の終わりを過ぎている場合には、
sign が「正」であるなら value
を返し、そうでないなら 0-value を返します。
#en
Otherwise return to the top of step 10 in the overall algorithm
(that's the step within which these substeps find themselves).
#ja
そうでない場合、全体の算法の段階 10 (これら部分段階が含まれている段階)
の先頭に戻ります。
#en
Otherwise, if the next character is not a U+002E FULL STOP ("."), then
if sign is "positive", return value, otherwise return 0-value.
#ja
そうでない場合、次の文字が U+002E FULL STOP (".") でない場合には、
sign が「正」であるなら value
を返し、そうでないなら 0-value を返します。
#en
The next character is a U+002E FULL STOP ("."). Advance position to the character after that.
#ja
次の文字は U+002E FULL STOP (".") です。 position をその次の文字に進めます。
#en
Let divisor be 1.
#ja
divisor を 1 とします。
#en
Multiply divisor by ten.
#ja
divisor に 10 を掛けます。
#en
Add the value of the current character (0..9) divided by divisor, to value.
#ja
現在の文字の値 (0~9) を divisor で割った値を、value
に加えます。
#en
Otherwise return to the top of step 14 in the overall algorithm
(that's the step within which these substeps find themselves).
#ja
そうでない場合、全体の算法の段階 14 (これら部分段階が含まれている段階) の先頭に戻ります。
#en
Otherwise, if sign is "positive", return value, otherwise return 0-value.
#ja
そうでない場合、
sign が「正」であるなら value
を返し、そうでないなら 0-value を返します。
#pattern
* Ratios
#ja
$1 比率
#en
The algorithms described in this section are used by the
progress and meter elements.
#ja
この節で説明する算法は、 progress 要素と
meter 要素で使います。
#en
A valid denominator punctuation character is one of
the characters from the table below. There is a value
associated with each denominator punctuation character, as shown in
the table below.
#ja
妥当な分母句読点文字は、
次の表の文字のいずれかです。次の表に示すように、各分母句読点文字には関連付けられた値があります。
#en
Denominator Punctuation Character
#ja
分母句読点文字
#en
Value
#ja
値
#en
The steps for finding one or two numbers of a ratio in a
string are as follows:
#ja
文字列中の比率の1つか2つの数字を探す段階は、次の通りです。
#en
If the string is empty, then return nothing and abort these steps.
#ja
文字列が空である場合、何も返さず、これらの段階を停止します。
#en
Find a number in the string according to the
algorithm below, starting at the start of the string.
#ja
後述の算法に従い、文字列のはじめから開始して数を探します。
#en
If the sub-algorithm in step 2 returned nothing or returned an error
condition, return nothing and abort these steps.
#ja
段階 2 の部分算法が何も返さなかったか、誤り条件を返した場合には、
何も返さず、これらの段階を停止します。
#en
Set number1 to the number returned by the
sub-algorithm in step 2.
#ja
number1 を、段階 2 の部分算法が返した数とします。
#en
Starting with the character immediately after the last one examined by
the sub-algorithm in step 2, skip any characters in the string that are
in the Unicode character class Zs (this might match zero characters). [UNICODE]
#ja
段階 2 の部分算法が調べた最後の文字の直後の文字から始めて、文字列中の Unicode
文字クラス Zs の文字を飛ばします (これに一致するのは零文字かもしれません)。 [UNICODE]
#en
If there are still further characters in the string, and the next
character in the string is a valid denominator
punctuation character, set denominator to that
character.
#ja
文字列中に更に文字がまだある場合で、文字列中の次の文字が妥当な分母句読点文字である場合には、
denominator をその文字に設定します。
#en
If the string contains any other characters in the range U+0030 DIGIT
ZERO to U+0039 DIGIT NINE, but denominator was given
a value in the step 6, return nothing and abort these steps.
#ja
文字列が範囲 U+0030 DIGIT
ZERO ~ U+0039 DIGIT NINE の文字をまだ他に含んでいる場合で、
段階 6 で denominator に値が与えられた場合には、
何も返さず、これらの段階を停止します。
#en
Otherwise, if denominator was given a value in
step 6, return number1 and denominator and abort these steps.
#ja
そうでない場合、 denominator が段階 6
で値を与えられた場合には、 number1 と denominator を返し、これらの段階を停止します。
#en
Find a number in the string again, starting
immediately after the last character that was examined by the
sub-algorithm in step 2.
#ja
文字列中を更に数を探しますが、
段階 2 の部分算法で調べた最後の文字の直後からはじめます。
#en
If the sub-algorithm in step 9 returned nothing or an error condition,
return nothing and abort these steps.
#ja
段階 9 の部分算法が何も返さないか、誤り条件を返す場合、
何も返さず、これらの段階を停止します。
#en
Set number2 to the number returned by the
sub-algorithm in step 9.
#ja
number2 を、段階 9 の部分算法が返した数とします。
#en
If there are still further characters in the string, and the next
character in the string is a valid denominator
punctuation character, return nothing and abort these steps.
#ja
文字列中に更に文字がまだある場合で、文字列中の次の文字が妥当な分母句読点文字である場合、
何も返さず、これらの段階を停止します。
#en
If the string contains any other characters in the range U+0030 DIGIT
ZERO to U+0039 DIGIT NINE, return nothing and abort these steps.
#ja
文字列が範囲 U+0030 DIGIT
ZERO ~ U+0039 DIGIT NINE の文字をまだ他に含んでいる場合、
何も返さず、これらの段階を停止します。
#en
Otherwise, return number1 and number2.
#ja
そうでない場合、 number1 と number2 を返します。
#en
The algorithm to find a number is as follows. It is
given a string and a starting position, and returns either nothing, a
number, or an error condition.
#ja
数を探すための算法は次の通りです。
この算法は、文字列と開始位置を与えられ、
何も返さないか、数を返すか、誤り条件を返すかのいずれかです。
#en
Starting at the given starting position, ignore all characters in the
given string until the first character that is either a U+002E FULL STOP
or one of the ten characters in the range U+0030 DIGIT ZERO to U+0039
DIGIT NINE.
#ja
与えられた開始位置からはじめ、 U+002E FULL STOP か、範囲 U+0030 DIGIT ZERO ~ U+0039
DIGIT NINE の10文字のいずれかであるような最初の文字まで、
その文字列中のすべての文字を無視します。
#en
If there are no such characters, return nothing and abort these steps.
#ja
そのような文字がない場合には、何も返さず、これらの段階を停止します。
#en
Starting with the character matched in step 1, collect all the
consecutive characters that are either a U+002E FULL STOP or one of the
ten characters in the range U+0030 DIGIT ZERO to U+0039 DIGIT NINE, and
assign this string of one or more characters to string.
#ja
段階 1 で一致した文字からはじめ、 U+002E FULL STOP か、範囲 U+0030 DIGIT ZERO ~
U+0039 DIGIT NINE の10文字のいずれかであるような連続した文字群をすべて集め、
この1文字以上の文字からなる文字列を string に代入します。
#en
If string contains more than one U+002E FULL STOP
character then return an error condition and abort these steps.
#ja
string が U+002E FULL STOP
文字を複数含んでいる場合、誤り条件を返し、これらの段階を停止します。
#en
Parse string according to the rules for parsing floating point number values, to
obtain number. This step cannot fail (string is guaranteed to be a valid
floating point number).
#ja
string を浮動小数点数値を構文解析する規則により構文解析し、
number を得ます。この段階は失敗しません (string は妥当な浮動小数点数であることが保証されています)。
#en
Return number.
#ja
number を返します。
#pattern
*
Percentages and dimensions
#ja
$1
百分率と寸法
#pattern
* Lists of integers
#ja
$1 整数のリスト
#en
A valid list of integers is a number of valid integers separated by
U+002C COMMA characters, with no other characters (e.g. no space characters). In addition,
there might be restrictions on the number of integers that can be given,
or on the range of values allowed.
#ja
妥当な整数の並びは、 U+002C COMMA
文字で分離された数々の妥当な整数であって、
他の文字を含まない (例えば間隔文字を含まない) ものです。
加えて、与えられる整数の数や認められる値の範囲に制限が設けられることがあります。
#en
The rules for parsing a list of integers are as
follows:
#ja
整数のリストを構文解析する規則は次の通りです。