feat: page validator for both section 9.1 checks
This commit is contained in:
parent
99dc9f7a88
commit
b3c436bf1a
13 changed files with 2703 additions and 0 deletions
7
mews/data/README.md
Normal file
7
mews/data/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Packaged copies
|
||||
|
||||
The canonical files live at the repository root (`mews-0.1.css`) and in `dtd/`
|
||||
(`mews-0.1.dtd`), where SPEC.md and `dtd/check_dtd.py` reference them. These
|
||||
copies exist so the validator still finds them when it is installed as a wheel,
|
||||
with nothing but the package on disk. `tests/test_data.py` fails if a copy and
|
||||
its original drift apart.
|
||||
106
mews/data/mews-0.1.css
Normal file
106
mews/data/mews-0.1.css
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/* Mews Profile default stylesheet 0.1 */
|
||||
|
||||
/* Base: light theme */
|
||||
body {
|
||||
background-color: #faf8f3;
|
||||
color: #1f1f1f;
|
||||
font-family: "Atkinson Hyperlegible", Verdana, Tahoma, system-ui, sans-serif;
|
||||
font-size: 106%;
|
||||
line-height: 1.5;
|
||||
margin: 0 auto;
|
||||
padding: 1em;
|
||||
max-width: 40em;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-weight: bold;
|
||||
line-height: 1.25;
|
||||
margin: 1.6em 0 0.5em 0;
|
||||
}
|
||||
h1 { font-size: 1.6em; margin-top: 0.5em; }
|
||||
h2 { font-size: 1.3em; }
|
||||
h3 { font-size: 1.1em; }
|
||||
h4, h5, h6 { font-size: 1em; }
|
||||
|
||||
p, ul, ol, dl, blockquote, pre, table, address {
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
ul, ol { padding-left: 1.5em; }
|
||||
li { margin-bottom: 0.25em; }
|
||||
dt { font-weight: bold; }
|
||||
dd { margin: 0 0 0.5em 1.5em; }
|
||||
|
||||
a { color: #1a4f9c; text-decoration: underline; }
|
||||
a:visited { color: #5b2a86; }
|
||||
a:focus, a:active { outline: 2px solid #1a4f9c; }
|
||||
|
||||
blockquote {
|
||||
margin-left: 0;
|
||||
padding-left: 1em;
|
||||
border-left: 3px solid #c9c4b8;
|
||||
}
|
||||
|
||||
pre, code, kbd, samp {
|
||||
font-family: "Source Code Pro", Consolas, Menlo, "DejaVu Sans Mono", monospace;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
pre {
|
||||
background-color: #efece4;
|
||||
padding: 0.75em;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid #c9c4b8;
|
||||
margin: 2em 0;
|
||||
}
|
||||
|
||||
table { border-collapse: collapse; }
|
||||
th, td {
|
||||
border: 1px solid #c9c4b8;
|
||||
padding: 0.3em 0.6em;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
caption { font-weight: bold; text-align: left; }
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
input, select, textarea { font-size: 1em; font-family: inherit; }
|
||||
|
||||
/* Body variants: light */
|
||||
body.mews-warm { background-color: #fbf4e8; color: #2a2420; }
|
||||
body.mews-warm a { color: #8a3d14; }
|
||||
body.mews-cool { background-color: #f3f6fa; color: #1c2430; }
|
||||
body.mews-cool a { color: #1a4f9c; }
|
||||
body.mews-green { background-color: #f2f6ef; color: #1f2a1f; }
|
||||
body.mews-green a { color: #24502a; }
|
||||
body.mews-mono { background-color: #e8ebe1; color: #1e2219; }
|
||||
body.mews-mono a { color: #1e2219; }
|
||||
|
||||
/* Dark theme: follows the system setting */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body { background-color: #18191b; color: #e3e1dc; }
|
||||
a { color: #8fb8f5; }
|
||||
a:visited { color: #c9a3f2; }
|
||||
a:focus, a:active { outline-color: #8fb8f5; }
|
||||
blockquote, hr, th, td { border-color: #45464a; }
|
||||
pre { background-color: #222326; }
|
||||
|
||||
body.mews-warm { background-color: #1d1916; color: #e8dfd3; }
|
||||
body.mews-warm a { color: #f0b48a; }
|
||||
body.mews-cool { background-color: #161a20; color: #dde4ee; }
|
||||
body.mews-cool a { color: #8fb8f5; }
|
||||
body.mews-green { background-color: #161b16; color: #dbe6d8; }
|
||||
body.mews-green a { color: #9fd39a; }
|
||||
body.mews-mono { background-color: #1b1d18; color: #c8d0b8; }
|
||||
body.mews-mono a { color: #c8d0b8; }
|
||||
}
|
||||
|
||||
html { color-scheme: light dark; }
|
||||
396
mews/data/mews-0.1.dtd
Normal file
396
mews/data/mews-0.1.dtd
Normal file
|
|
@ -0,0 +1,396 @@
|
|||
<!-- Mews Profile 0.1 DTD
|
||||
Published at mews.page/dtd/mews-0.1.dtd. Browsers and clients must not
|
||||
fetch this file.
|
||||
|
||||
XHTML Mobile Profile 1.2 restricted as in the Mews Profile
|
||||
Specification 0.1 section 4, extended with lang and dir (section 3).
|
||||
Maintained by hand and checked against the XHTML Mobile 1.2 driver,
|
||||
xhtml-mobile12.dtd (OMA-SUP-DTD_xhtml_mobile12-V1_2-20080331-A), by
|
||||
check_dtd.py. It cannot be generated by stripping the driver: the
|
||||
driver declares no elements itself, attribute lists only ever add,
|
||||
and the rules below do not exist in XHTML-MP to be kept.
|
||||
|
||||
This file is standalone: it declares every element and attribute
|
||||
itself, so validation never depends on the Open Mobile Alliance's or
|
||||
W3C's servers. Pages keep the XHTML-MP doctype (section 3.1); only
|
||||
validators use this file (section 9.1).
|
||||
|
||||
Encoded here: the permitted elements and attributes (4.1), the head
|
||||
rules (3.3), the body variant classes (5.3) and the ban on nested
|
||||
tables (4.2). 51 elements are kept from XHTML Mobile 1.2. Dropped:
|
||||
acronym, base, big, button, div, legend, noscript, object, param,
|
||||
script, small, span, style, sub, sup, tt. Event attributes and the
|
||||
style attribute are omitted entirely.
|
||||
-->
|
||||
|
||||
<!-- Datatypes (as in XHTML Modularization) -->
|
||||
<!ENTITY % Text.datatype "CDATA" >
|
||||
<!ENTITY % URI.datatype "CDATA" >
|
||||
<!ENTITY % Number.datatype "CDATA" >
|
||||
<!ENTITY % LanguageCode.datatype "NMTOKEN" >
|
||||
<!ENTITY % Character.datatype "CDATA" >
|
||||
|
||||
<!-- Common attributes. id, title, xml:lang, lang and dir are permitted
|
||||
on every element in the body (SPEC.md 4.1); lang and dir are the Mews
|
||||
extensions over XHTML-MP (SPEC.md 3). -->
|
||||
<!ENTITY % id.attrib "id ID #IMPLIED" >
|
||||
<!ENTITY % title.attrib "title CDATA #IMPLIED" >
|
||||
<!ENTITY % i18n.attrib
|
||||
"xml:lang %LanguageCode.datatype; #IMPLIED
|
||||
lang %LanguageCode.datatype; #IMPLIED
|
||||
dir (ltr | rtl) #IMPLIED" >
|
||||
<!ENTITY % Common.attrib "%id.attrib; %title.attrib; %i18n.attrib;" >
|
||||
|
||||
<!-- Inline classes -->
|
||||
<!ENTITY % InlStruct.class "br" >
|
||||
<!ENTITY % InlPhras.class "| em | strong | code | kbd | samp | var | q | cite | abbr | dfn" >
|
||||
<!ENTITY % InlPres.class "| b | i" >
|
||||
<!ENTITY % Anchor.class "| a" >
|
||||
<!ENTITY % InlSpecial.class "| img" >
|
||||
<!ENTITY % InlFormNoLabel.class "| input | select | textarea" >
|
||||
<!ENTITY % InlForm.class "%InlFormNoLabel.class; | label" >
|
||||
<!ENTITY % Inline.extra "" >
|
||||
<!ENTITY % Inline.class "%InlStruct.class;
|
||||
%InlPhras.class;
|
||||
%InlPres.class;
|
||||
%Anchor.class;
|
||||
%InlSpecial.class;
|
||||
%InlForm.class;
|
||||
%Inline.extra;" >
|
||||
<!ENTITY % InlNoAnchor.class "%InlStruct.class;
|
||||
%InlPhras.class;
|
||||
%InlPres.class;
|
||||
%InlSpecial.class;
|
||||
%InlForm.class;
|
||||
%Inline.extra;" >
|
||||
<!ENTITY % InlNoLabel.class "%InlStruct.class;
|
||||
%InlPhras.class;
|
||||
%InlPres.class;
|
||||
%Anchor.class;
|
||||
%InlSpecial.class;
|
||||
%InlFormNoLabel.class;
|
||||
%Inline.extra;" >
|
||||
|
||||
<!-- Block classes -->
|
||||
<!ENTITY % Heading.class "h1 | h2 | h3 | h4 | h5 | h6" >
|
||||
<!ENTITY % List.class "ul | ol | dl" >
|
||||
<!ENTITY % BlkStruct.class "p" >
|
||||
<!ENTITY % BlkPhras.class "| pre | blockquote | address" >
|
||||
<!ENTITY % BlkPres.class "| hr" >
|
||||
<!ENTITY % Table.class "| table" >
|
||||
<!ENTITY % Form.class "| form" >
|
||||
<!ENTITY % Fieldset.class "| fieldset" >
|
||||
<!ENTITY % Block.extra "" >
|
||||
<!ENTITY % BlkNoForm.class "%Heading.class;
|
||||
| %List.class;
|
||||
| %BlkStruct.class;
|
||||
%BlkPhras.class;
|
||||
%BlkPres.class;
|
||||
%Fieldset.class;
|
||||
%Block.extra;" >
|
||||
<!ENTITY % BlkNoTable.class "%BlkNoForm.class;
|
||||
%Form.class;
|
||||
%Block.extra;" >
|
||||
<!ENTITY % Blk.class "%BlkNoTable.class;
|
||||
%Table.class;
|
||||
%Block.extra;" >
|
||||
<!ENTITY % FlowNoTable.class "%Inline.class;
|
||||
| %BlkNoTable.class;" >
|
||||
|
||||
<!-- pre content model, taken verbatim from the driver. It excludes
|
||||
%InlPres.class; and %InlSpecial.class;, so b, i and img are not
|
||||
permitted in pre, as in XHTML Mobile 1.2. -->
|
||||
<!ENTITY % pre.content
|
||||
"( #PCDATA
|
||||
| %InlStruct.class;
|
||||
%InlPhras.class;
|
||||
%Anchor.class;
|
||||
%Inline.extra; )*"
|
||||
>
|
||||
|
||||
<!-- Document structure (SPEC.md 4.1) -->
|
||||
<!--
|
||||
Only body uses %Blk.class;, so a table can appear directly in the
|
||||
body and nowhere else, and tables cannot nest (SPEC.md 4.2). body may
|
||||
carry one class from the variant list (SPEC.md 5.3).
|
||||
-->
|
||||
<!ELEMENT html ( head, body ) >
|
||||
<!ATTLIST html
|
||||
xmlns CDATA #FIXED "http://www.w3.org/1999/xhtml"
|
||||
xml:lang %LanguageCode.datatype; #IMPLIED
|
||||
lang %LanguageCode.datatype; #IMPLIED
|
||||
dir (ltr | rtl) #IMPLIED
|
||||
>
|
||||
<!ELEMENT head ( title, meta, ( meta | link )* ) >
|
||||
<!ELEMENT title ( #PCDATA )* >
|
||||
<!ELEMENT body ( %Blk.class; )+ >
|
||||
<!ATTLIST body
|
||||
%Common.attrib;
|
||||
class (mews-warm | mews-cool | mews-green | mews-mono) #IMPLIED
|
||||
>
|
||||
|
||||
<!-- Head elements (SPEC.md 3.3) -->
|
||||
<!--
|
||||
The head may contain only title, meta and link. The title comes
|
||||
first and at least one meta is required; the conformance marker is a
|
||||
meta (SPEC.md 3.2), but a DTD cannot check its name and content
|
||||
together, so validators confirm the marker as a rule check (SPEC.md
|
||||
9.1). link rel is limited to the uses SPEC.md 3.3 names: the
|
||||
stylesheet, the icon and feed links.
|
||||
-->
|
||||
<!ELEMENT meta EMPTY >
|
||||
<!ATTLIST meta
|
||||
name NMTOKEN #IMPLIED
|
||||
content CDATA #REQUIRED
|
||||
>
|
||||
<!ELEMENT link EMPTY >
|
||||
<!ATTLIST link
|
||||
rel (alternate | icon | stylesheet) #IMPLIED
|
||||
href %URI.datatype; #IMPLIED
|
||||
type CDATA #IMPLIED
|
||||
title CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!-- Headings (SPEC.md 4.1) -->
|
||||
<!ELEMENT h1 ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST h1
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT h2 ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST h2
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT h3 ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST h3
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT h4 ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST h4
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT h5 ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST h5
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT h6 ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST h6
|
||||
%Common.attrib;
|
||||
>
|
||||
|
||||
<!-- Text blocks (SPEC.md 4.1) -->
|
||||
<!ELEMENT p ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST p
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT blockquote ( %BlkNoTable.class; )* >
|
||||
<!ATTLIST blockquote
|
||||
%Common.attrib;
|
||||
cite %URI.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT pre %pre.content; >
|
||||
<!ATTLIST pre
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT address ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST address
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT hr EMPTY >
|
||||
<!ATTLIST hr
|
||||
%Common.attrib;
|
||||
>
|
||||
|
||||
<!-- Inline text (SPEC.md 4.1) -->
|
||||
<!ELEMENT em ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST em
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT strong ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST strong
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT code ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST code
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT kbd ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST kbd
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT samp ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST samp
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT var ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST var
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT cite ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST cite
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT abbr ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST abbr
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT dfn ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST dfn
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT b ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST b
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT i ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST i
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT q ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST q
|
||||
%Common.attrib;
|
||||
cite %URI.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT br EMPTY >
|
||||
<!ATTLIST br
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT a ( #PCDATA | %InlNoAnchor.class; )* >
|
||||
<!ATTLIST a
|
||||
%Common.attrib;
|
||||
href %URI.datatype; #IMPLIED
|
||||
hreflang %LanguageCode.datatype; #IMPLIED
|
||||
rel CDATA #IMPLIED
|
||||
type CDATA #IMPLIED
|
||||
accesskey %Character.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT img EMPTY >
|
||||
<!ATTLIST img
|
||||
%Common.attrib;
|
||||
src %URI.datatype; #REQUIRED
|
||||
alt %Text.datatype; #REQUIRED
|
||||
>
|
||||
|
||||
<!-- Lists (SPEC.md 4.1) -->
|
||||
<!ELEMENT ul ( li )+ >
|
||||
<!ATTLIST ul
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT ol ( li )+ >
|
||||
<!ATTLIST ol
|
||||
%Common.attrib;
|
||||
start %Number.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT dl ( dt | dd )+ >
|
||||
<!ATTLIST dl
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT li ( #PCDATA | %FlowNoTable.class; )* >
|
||||
<!ATTLIST li
|
||||
%Common.attrib;
|
||||
value %Number.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT dt ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST dt
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT dd ( #PCDATA | %FlowNoTable.class; )* >
|
||||
<!ATTLIST dd
|
||||
%Common.attrib;
|
||||
>
|
||||
|
||||
<!-- Tables (SPEC.md 4.2) -->
|
||||
<!--
|
||||
As in the XHTML Mobile basic tables module, cells take
|
||||
%FlowNoTable.class; and never a table, so tables cannot nest
|
||||
(SPEC.md 4.2).
|
||||
-->
|
||||
<!ELEMENT table ( caption?, tr+ ) >
|
||||
<!ATTLIST table
|
||||
%Common.attrib;
|
||||
summary %Text.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT caption ( #PCDATA | %Inline.class; )* >
|
||||
<!ATTLIST caption
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT tr ( th | td )+ >
|
||||
<!ATTLIST tr
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT th ( #PCDATA | %FlowNoTable.class; )* >
|
||||
<!ATTLIST th
|
||||
%Common.attrib;
|
||||
rowspan %Number.datatype; "1"
|
||||
colspan %Number.datatype; "1"
|
||||
scope (row | col) #IMPLIED
|
||||
>
|
||||
<!ELEMENT td ( #PCDATA | %FlowNoTable.class; )* >
|
||||
<!ATTLIST td
|
||||
%Common.attrib;
|
||||
rowspan %Number.datatype; "1"
|
||||
colspan %Number.datatype; "1"
|
||||
scope (row | col) #IMPLIED
|
||||
>
|
||||
|
||||
<!-- Forms (SPEC.md 4.1, 4.2) -->
|
||||
<!--
|
||||
As in the XHTML MP forms module, form takes %BlkNoForm.class;, so
|
||||
forms cannot nest. fieldset also takes %BlkNoForm.class;, so a
|
||||
fieldset cannot reintroduce a form.
|
||||
-->
|
||||
<!ELEMENT form ( %BlkNoForm.class; )+ >
|
||||
<!ATTLIST form
|
||||
%Common.attrib;
|
||||
action %URI.datatype; #REQUIRED
|
||||
method (get | post) "get"
|
||||
enctype CDATA "application/x-www-form-urlencoded"
|
||||
>
|
||||
<!ELEMENT fieldset ( #PCDATA | %Inline.class; | %BlkNoForm.class; )* >
|
||||
<!ATTLIST fieldset
|
||||
%Common.attrib;
|
||||
>
|
||||
<!ELEMENT label ( #PCDATA | %InlNoLabel.class; )* >
|
||||
<!ATTLIST label
|
||||
%Common.attrib;
|
||||
for IDREF #IMPLIED
|
||||
accesskey %Character.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT input EMPTY >
|
||||
<!ATTLIST input
|
||||
%Common.attrib;
|
||||
type (text | password | checkbox | radio | submit | reset | hidden) "text"
|
||||
name CDATA #IMPLIED
|
||||
value CDATA #IMPLIED
|
||||
checked (checked) #IMPLIED
|
||||
size %Number.datatype; #IMPLIED
|
||||
maxlength %Number.datatype; #IMPLIED
|
||||
accesskey %Character.datatype; #IMPLIED
|
||||
inputmode CDATA #IMPLIED
|
||||
>
|
||||
<!ELEMENT select ( optgroup | option )+ >
|
||||
<!ATTLIST select
|
||||
%Common.attrib;
|
||||
name CDATA #IMPLIED
|
||||
multiple (multiple) #IMPLIED
|
||||
size %Number.datatype; #IMPLIED
|
||||
>
|
||||
<!ELEMENT optgroup ( option )+ >
|
||||
<!ATTLIST optgroup
|
||||
%Common.attrib;
|
||||
label %Text.datatype; #REQUIRED
|
||||
>
|
||||
<!ELEMENT option ( #PCDATA )* >
|
||||
<!ATTLIST option
|
||||
%Common.attrib;
|
||||
value CDATA #IMPLIED
|
||||
selected (selected) #IMPLIED
|
||||
>
|
||||
<!ELEMENT textarea ( #PCDATA )* >
|
||||
<!ATTLIST textarea
|
||||
%Common.attrib;
|
||||
name CDATA #IMPLIED
|
||||
rows %Number.datatype; #REQUIRED
|
||||
cols %Number.datatype; #REQUIRED
|
||||
accesskey %Character.datatype; #IMPLIED
|
||||
inputmode CDATA #IMPLIED
|
||||
>
|
||||
Loading…
Add table
Add a link
Reference in a new issue