Skip to content

Commit 8ef92b6

Browse files
authored
Skipping pubNumber validation for OM_PUBTYPE (#326)
* skipping pubNumber validation for OM_PUBTYPE * pubNumber validation tests * Removed pubNumber for valid OM example
1 parent cd7cd6f commit 8ef92b6

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

js/common.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ export function validateHead(head, logger) {
184184
if(metadata.pubDateTime === null)
185185
fatal(logger, "pubDateTime must be present if the document is in pub state.");
186186

187-
if (metadata.pubNumber === null)
188-
logger.error("pubNumber must be specified if the document is in pub state.");
187+
if (metadata.pubNumber === null) {
188+
if (metadata.pubType !== OM_PUBTYPE)
189+
logger.error("pubNumber must be specified if the document is in pub state.");
190+
}
189191
}
190192

191193
/* specific to OM */

test/resources/html/validation/om-valid.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<script src="../../../../smpte.js"></script>
88
<meta itemprop="test" content="valid" />
99
<meta itemprop="pubType" content="OM" />
10-
<meta itemprop="pubNumber" content="5" />
1110
<meta itemprop="pubState" content="draft" />
1211
<meta itemprop="effectiveDateTime" content="2015-04-04" />
1312
<title>OM</title>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html>
3+
<head itemscope="itemscope" itemtype="http://smpte.org/standards/documents">
4+
<meta charset="utf-8" />
5+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<script type="module" src="../../../../smpte.js"></script>
8+
<meta itemprop="test" content="invalid" />
9+
<meta itemprop="pubType" content="ST" />
10+
<meta itemprop="pubStage" content="PUB" />
11+
<meta itemprop="pubDateTime" content="2010-09-04" />
12+
<meta itemprop="effectiveDateTime" content="2010-09-04" />
13+
<meta itemprop="pubState" content="pub" />
14+
<meta itemprop="pubTC" content="35PM" />
15+
16+
<title>Title of the document</title>
17+
</head>
18+
<body>
19+
<section id="sec-scope">
20+
<p>This is the scope of the document.</p>
21+
</section>
22+
</body>
23+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html>
3+
<head itemscope="itemscope" itemtype="http://smpte.org/standards/documents">
4+
<meta charset="utf-8" />
5+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<script type="module" src="../../../../smpte.js"></script>
8+
<meta itemprop="test" content="valid" />
9+
<meta itemprop="pubType" content="OM" />
10+
<meta itemprop="pubStage" content="PUB" />
11+
<meta itemprop="pubDateTime" content="2010-09-04" />
12+
<meta itemprop="effectiveDateTime" content="2010-09-04" />
13+
<meta itemprop="pubState" content="pub" />
14+
<meta itemprop="pubTC" content="ST" />
15+
16+
<title>Title of the document</title>
17+
</head>
18+
<body>
19+
<section id="sec-scope">
20+
<p>This is the scope of the document.</p>
21+
</section>
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)