Skip to content

Commit abe6f23

Browse files
committed
[css2] Added optional whitespace after hexadecimal escape sequence.
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%40858
1 parent 4ed6216 commit abe6f23

1 file changed

Lines changed: 68 additions & 139 deletions

File tree

css2/syndata.src

Lines changed: 68 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
22
<html lang="en">
3-
<!-- $Id: syndata.src,v 2.2 1998-02-10 22:28:42 ijacobs Exp $ -->
3+
<!-- $Id: syndata.src,v 2.3 1998-02-10 23:45:01 bbos Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>CSS2 syntax and basic data types</TITLE>
@@ -73,7 +73,7 @@ multiple matches, the longest match determines the token.
7373
<TR><TD>ident <TD><code><var>{nmstart}{nmchar}*</var></code>
7474
<TR><TD>nmstart <TD><code>[a-zA-Z]|<var>{nonascii}</var>|<var>{escape}</var></code>
7575
<TR><TD>nonascii<TD><code>[^\0-\4177777]</code>
76-
<TR><TD>unicode <TD><code>\\[0-9a-f]{1,6}</code>
76+
<TR><TD>unicode <TD><code>\\[0-9a-f]{1,6}[ \n\r\t\f]?</code>
7777
<TR><TD>escape <TD><code>{unicode}|\\[ -~\200-\4177777]</code>
7878
<TR><TD>nmchar <TD><code>[a-z0-9-]|<var>{nonascii}</var>|<var>{escape}</var></code>
7979
<TR><TD>num <TD><code>[0-9]+|[0-9]*\.[0-9]+</code>
@@ -82,6 +82,8 @@ multiple matches, the longest match determines the token.
8282
<TR><TD>string2 <TD><code>\'([\t !#$%&amp;(-~]|\\\n|\"|<var>{nonascii}</var>|<var>{escape}</var>)*\'</code>
8383
</TABLE>
8484

85+
<!-- optional whitespace after \unicode OIK? -->
86+
8587
<P>Below is the core syntax for CSS. The sections that follow describe
8688
how to use it. <a href="grammar.html">Appendix B</a> describes a
8789
more restrictive grammar that is closer to the CSS level 2 language.
@@ -149,15 +151,12 @@ href="#escaped-characters">escaped characters.</a>
149151
<LI> <a name="escaped-characters">The backslash</a> (\) followed
150152
by at most six hexadecimal digits (0..9A..F) stands for the <a
151153
rel="biblioentry" href="./refs.html#ref-ISO10646">[ISO10646]</a>
152-
character with that number. The first space following the
153-
hexadecimal sequence is ignored. This allows authors to avoid
154-
ambiguities between, for example, hexadecimal "\26C" and
155-
hexadecimal "\26" followed immediately by the letter "C".
154+
character with that number.
156155

157156
<LI> Any character except a hexadecimal digit can be escaped to
158157
remove its special meaning, by putting a backslash (\) in front,
159158
For example, <samp>"\""</samp> is a string consisting of one
160-
double quote.
159+
double quote.
161160

162161
<LI> The two preceding items define <span class="index-inst"
163162
title="backslash
@@ -545,16 +544,14 @@ display to a laser printer).
545544
</PRE>
546545
</div>
547546

548-
<P>The 'em' unit refers to the <span class="index-def"
549-
title="em-height"><a name="em-height"><dfn>em-height</dfn></a></span>.
550-
In CSS, the em-height is equal to the <span class="index-inst"
551-
title="font size">font size</span> used when rendering an element's
552-
text. It may be used for vertical or horizontal measurement. The 'ex'
553-
unit is equal to the font's <span class="index-def"
554-
title="x-height"><dfn>x-height</dfn></span> (the height of the letter
555-
'x') of the element's font. A font need not contain the letter "M" to
556-
have an 'em' size or the letter "x" to have an x-height; the font
557-
should still define the two units.
547+
<P>The 'em' unit, as used in CSS, is equal to the <span
548+
class="index-inst" title="font size">font size</span> used when
549+
rendering an element's text. It may be used for vertical or horizontal
550+
measurement. The 'ex' unit is equal to the font's <span
551+
class="index-def" title="x-height"><dfn>x-height</dfn></span> (the
552+
height of the letter 'x') of the element's font. A font need not
553+
contain the letter "M" to have an 'em' size or the letter "x" to have
554+
an x-height; the font should still define the two units.
558555

559556
<!-- Incomplete -->
560557

@@ -607,7 +604,7 @@ href="cascade.html#computed-value">computed values</a>. For example:</p>
607604
<PRE>
608605
BODY {
609606
font-size: 12pt;
610-
text-indent: 3em; /* i.e., 36pt */
607+
text-indent: 3em; /* i.e. 36pt */
611608
}
612609
H1 { font-size: 15pt }
613610
</PRE>
@@ -648,12 +645,9 @@ is an optional sign character ('+' or '-', with '+' being the default)
648645
immediately followed by a number immediately followed by '%'.
649646

650647
<P> Percentage values are always relative to another value, for
651-
example a length. Each property that allows percentages also defines
652-
the value to which the percentage refers. The value may be that of
653-
another property for the same element, a property for an ancestor
654-
element, or a value of the rendering context (e.g., the width of a <a
655-
href="visuren.html#containing-block">containing block</a>). When a
656-
percentage value is set for a property of the root of the <a
648+
example a length. Each property that allows percentages also
649+
defines to which value the percentage refers. When a percentage value
650+
is set for a property of the root of the <a
657651
href="conform.html#doctree">document tree</a> and the percentage is
658652
defined as referring to the inherited value of some property X, the
659653
resultant value is the percentage times the <a
@@ -668,7 +662,7 @@ the percentage value (120%):
668662

669663
<PRE>
670664
P { font-size: 10pt }
671-
P { line-height: 120% } /* relative to 'font-size', i.e., 12pt */
665+
P { line-height: 120% } /* relative to 'font-size', i.e. 12pt */
672666
</PRE>
673667
</div>
674668

@@ -832,7 +826,7 @@ identifier is optional.
832826
<P>These following are legal angle unit identifiers:</p>
833827

834828
<ul>
835-
<li><strong>deg</strong>: degrees
829+
<li><strong>deg</strong>: degrees.
836830
<LI><strong>grad</strong>: gradient
837831
<LI><strong>rad</strong>: radians
838832
</UL>
@@ -910,14 +904,15 @@ cannot occur inside double quotes, unless escaped (as '\"' or as
910904
<P>A string cannot directly contain a <span class="index-inst"
911905
title="newline">newline</span>. To include a newline in a string, use
912906
the escape "\A" (hexadecimal A is the line feed character in Unicode,
913-
but represents the generic notion of "newline" in CSS). Sometimes it
907+
but represents the generic notion of "newline" in CSS). <!--Sometimes it
914908
is safer to write "\00000A", since that will avoid the situation where
915909
the character following the "A" can be interpreted as a hexadecimal
916910
digit. For example, in the string
917911

918912
<pre>"A. one\AB. two"</pre>
919913

920-
<p>the UA will see an escape sequence "\AB" (&#171;) instead of \A.
914+
<p>the UA will see an escape sequence "\AB" (&#171;) instead of \A.-->
915+
See also <a href="#char-escapes">Character escapes in CSS</a> below.
921916

922917
<p>It is possible to break strings over several lines, for aesthetic
923918
or other reasons, but in such a case the newline itself has to be
@@ -930,129 +925,63 @@ o very long title"] {border: double}
930925
A[TITLE="a not so very long title"] {border: double}
931926
</pre>
932927

933-
<H2>CSS document representation</H2>
934-
935-
<P>A CSS style sheet is a sequence of characters from the Universal
936-
Character Set, defined in <a rel="biblioentry"
937-
href="./refs.html#ref-ISO10646">[ISO10646]</a>. For transmission and
938-
storage, these characters must be <span class="index-def"
939-
title="character encoding">encoded</span> by a character encoding that
940-
supports the ASCII character set (e.g., ISO 8859-x, SHIFT JIS, etc.).
941-
For a good introduction to character sets and character encodings,
942-
please consult <a rel="biblioentry" href="./refs.html#ref-HTML40"
943-
class="informref">[HTML40]</a>, Chapter 5.
944-
945-
<P>When a style sheet is embedded in another document, the style sheet
946-
shares the character encoding of the whole document. ("Embedded" here
947-
means textual inclusion, not embedded byte sequences.) For
948-
example, in <a rel="biblioentry" href="./refs.html#ref-HTML40"
949-
class="informref">[HTML40]</a>, the "charset" attribute of many
950-
elements (META, LINK, A, etc.) designates the character encoding, as
951-
in:</p>
952928

953-
<pre>
954-
&lt;META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
955-
</pre>
929+
<H2><a name="css-in-html">CSS embedded in HTML</a></H2>
956930

957-
<P>When a style sheet resides in a separate file, user agents must
958-
observe the following <span class="index-inst" title="character
959-
encoding::user agent's determination of">priorities</span> when
960-
determining a document's <span class="index-inst" title="character
961-
encoding::default|default::character encoding">character
962-
encoding</span> (from highest priority to lowest):</p>
931+
<P> CSS style sheets may be embedded in HTML documents, and to be able
932+
to hide style sheets from older UAs, it is convenient put the style
933+
sheets inside HTML comments. Please consult <a rel="biblioentry"
934+
href="./refs.html#ref-HTML40" class="informref">[HTML40]</a> for more
935+
information.
963936

964-
<ol>
965-
<li>An HTTP "charset" parameter in a "Content-Type" field.
966-
<li>The <span class="index-def" title="@charset">@charset</span>
967-
at-rule.
968-
<li>Mechanisms of the language of the
969-
referencing document (e.g., in HTML, the "charset"
970-
attribute of the LINK element).
971-
</ol>
937+
<P>When CSS is embedded in HTML, it shares the <tt>charset</tt>
938+
parameter used to transmit the enclosing HTML document. As with HTML,
939+
the value of the <tt>charset</tt> parameter is used to convert from
940+
the transfer encoding to the document character set, which is
941+
specified by <a rel="biblioentry"
942+
href="./refs.html#ref-ISO10646">[ISO10646]</a>.
972943

973-
<P>When present, only one @charset rule may appear in an external
974-
style sheet -- it must <em>not</em> appear in an embedded style sheet
975-
-- and it must be the first line in the document (not preceded by any
976-
other characters). After "@charset", authors specify the name of a
977-
character encoding. The name must be a charset name as described in <a
978-
href="refs.html#ref-IANA" class="normref">[IANA]</a> registry (see <a
979-
rel="biblioentry" href="./refs.html#ref-CHARSETS"
980-
class="informref">[CHARSETS]</a> for a complete list). For
981-
example:</p>
944+
<H2><a name="css-by-itself">CSS as a stand-alone file</a></H2>
945+
<!-- Add reference to rfc2045? -->
982946

983-
<div class="example"><P>
984-
@charset "ISO-8859-1";
985-
</div>
947+
<p>CSS style sheets may exist in files by themselves, being linked
948+
from the document. In this case, the CSS files are served with the
949+
media type <tt>text/css</tt>. As with all text media types, a
950+
<tt>charset</tt> parameter may be added which is used to convert from
951+
the transfer encoding to <a rel="biblioentry"
952+
href="./refs.html#ref-ISO10646">[ISO10646]</a>.
953+
954+
<h2><a name="char-escapes">Character escapes in CSS</a></h2>
986955

987-
<P>This specification does not mandate which character encodings
988-
a user agent must support.
989-
990-
<P>What purpose does the @charset construct serve if user agents
991-
cannot understand it before they know the character encoding? It acts
992-
as a verification mechanism. In the case HTTP headers do not provide
993-
character encoding information, user agents may attempt to guess the
994-
character set, and should they succeed, the @charset allows them to
995-
double check their guess. For this reason, character encodings in
996-
which the ASCII characters are encoded as themselves are more likely
997-
to help user agents determine the correct character encoding than
998-
other encodings schemes.
999-
1000-
<!-- More examples of good encodings to use? -IJ -->
1001-
1002-
<!-- Encodings not to use? (cf. HTML 4.0) -IJ -->
1003-
1004-
<h3>Referring to characters not represented in a character encoding</h3>
1005-
1006-
<P>A style sheet may have to refer to characters that cannot be
1007-
represented in the current character encoding. These characters must
1008-
be written as <a href="#escaped-characters">escaped</a> references to
1009-
<a rel="biblioentry" href="./refs.html#ref-ISO10646">[ISO10646]</a>
1010-
characters. These escapes are the equivalent of numeric character
1011-
references in HTML or XML documents (see <a rel="biblioentry"
1012-
href="./refs.html#ref-HTML40">[HTML40], Chapters 5 and 25).</a>
1013-
1014-
<P>The character escape mechanism should be used when only a few
1015-
characters must be represented this way. If most of a document
1016-
requires escaping, authors should encode it with a more appropriate
1017-
encoding (e.g., if the document contains a lot of Greek characters,
1018-
authors might use ISO 8859-7 or UTF 8).
1019-
1020-
<P>Intermediate processors using a different character encoding may
1021-
translate these escaped sequences into byte sequences of that
1022-
encoding. <strong>Note.</strong> Intermediate processors must not, on
1023-
the other hand, alter escape sequences that cancel the special meaning
1024-
of an ASCII character.
1025-
1026-
<P><a href="conform.html#conformance">Conforming user agents</a> must
1027-
correctly map to Unicode all characters in any character encodings
1028-
that they recognize (or they must behave as if they did).
956+
<p>CSS may need to use characters that are outside the encoding used
957+
to transmit the document. For example, the "class" attribute of HTML
958+
allows more characters in a class name than the set allowed for
959+
selectors above. In CSS2, such characters can be <a
960+
href="#escaped-characters">escaped</a> or written as <a
961+
rel="biblioentry" href="./refs.html#ref-ISO10646">[ISO10646]</a>
962+
numbers.
1029963

1030964
<P>For instance, "B&amp;W?" may be written as "B\&amp;W\?" or
1031-
"B\26 W\3F". For example, a document transmitted as ISO-8859-1
965+
"B\26W\3F". For example, a document transmitted as ISO-8859-1
1032966
(Latin-1) cannot contain Greek letters directly:
1033967
"&#954;&#959;&#965;&#961;&#959;&#962;" (Greek: "kouros") has to be
1034-
written as "\3BA\3BF\3C5\3C1\3BF\3C2".
1035-
1036-
<div class="note"><P>
1037-
<em><strong>Note.</strong>
1038-
In <a rel="biblioentry" href="./refs.html#ref-HTML40"
1039-
class="informref">[HTML40]</a>,
1040-
numeric character references may appear in "style" attribute
1041-
values but not in the content of the STYLE element. Because of this
1042-
asymmetry, we recommend that authors use the CSS character
1043-
escape mechanism rather than numeric character references.
1044-
For example, authors should write:</em></p>
1045-
1046-
<pre class="html-example">
1047-
&lt;SPAN style="voice-family: D\FCrst"&gt;...&lt;/SPAN&gt;
1048-
</pre>
968+
written as "\3BA\3BF\3C5\3C1\3BF\3C2". These escapes are thus the CSS
969+
equivalent of numeric character references in HTML or XML documents.
1049970

1050-
<P><em>rather than:</em></p>
971+
<p class=note>[Is the following OK?]
1051972

1052-
<pre class="html-example">
1053-
&lt;SPAN style="voice-family: D&amp;amp;#FC;rst"&gt;...&lt;/SPAN&gt;
1054-
</pre>
1055-
</div>
973+
<p>If a digit or letter follows the hexadecimal number, the end of the
974+
number needs to be made clear. There are two ways to do that:
975+
976+
<ol>
977+
<li>with a space (or other whitespace character): "\26 B" ("&B")
978+
<li>by providing exactly 6 hexadecimal digits: "\000026B" ("&B")
979+
</ol>
980+
981+
<p>In fact, the two methods may be combined. Only one whitespace
982+
character is ignored after a hexadecimal escape. Note that this means
983+
that a "real" space after the escape sequence must itself either be
984+
escaped or doubled.
1056985

1057986
</BODY>
1058987
</html>

0 commit comments

Comments
 (0)