Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test IDL in <xmp> blocks. #933

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/idl003.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<pre class=metadata>
Title: Foo
Group: test
Shortname: foo
Level: 1
Status: LS
ED: http://example.com/foo
Abstract: Testing IDL markup and linking.
Editor: Example Editor
Date: 1970-01-01
</pre>

<xmp class=idl>
enum BarEnum { "", "bar" };
interface Foo {
attribute DOMString foo;
attribute BarEnum bar;
attribute DOMString _or;
Promise<any> get(int a);
};
</xmp>
<pre class="argumentdef" for="Foo/get(a)">
a: An argument.
</pre>

{{Foo}}, {{foo}}, {{or}}, {{_or}}
298 changes: 298 additions & 0 deletions tests/idl003.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<title>Foo</title>
<style>/* style-md-lists */

/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}</style>
<style>/* style-counters */

body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}

.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}

figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
.highlight .c { color: #708090 } /* Comment */
.highlight .k { color: #990055 } /* Keyword */
.highlight .l { color: #000000 } /* Literal */
.highlight .n { color: #0077aa } /* Name */
.highlight .o { color: #999999 } /* Operator */
.highlight .p { color: #999999 } /* Punctuation */
.highlight .cm { color: #708090 } /* Comment.Multiline */
.highlight .cp { color: #708090 } /* Comment.Preproc */
.highlight .c1 { color: #708090 } /* Comment.Single */
.highlight .cs { color: #708090 } /* Comment.Special */
.highlight .kc { color: #990055 } /* Keyword.Constant */
.highlight .kd { color: #990055 } /* Keyword.Declaration */
.highlight .kn { color: #990055 } /* Keyword.Namespace */
.highlight .kp { color: #990055 } /* Keyword.Pseudo */
.highlight .kr { color: #990055 } /* Keyword.Reserved */
.highlight .kt { color: #990055 } /* Keyword.Type */
.highlight .ld { color: #000000 } /* Literal.Date */
.highlight .m { color: #000000 } /* Literal.Number */
.highlight .s { color: #a67f59 } /* Literal.String */
.highlight .na { color: #0077aa } /* Name.Attribute */
.highlight .nc { color: #0077aa } /* Name.Class */
.highlight .no { color: #0077aa } /* Name.Constant */
.highlight .nd { color: #0077aa } /* Name.Decorator */
.highlight .ni { color: #0077aa } /* Name.Entity */
.highlight .ne { color: #0077aa } /* Name.Exception */
.highlight .nf { color: #0077aa } /* Name.Function */
.highlight .nl { color: #0077aa } /* Name.Label */
.highlight .nn { color: #0077aa } /* Name.Namespace */
.highlight .py { color: #0077aa } /* Name.Property */
.highlight .nt { color: #669900 } /* Name.Tag */
.highlight .nv { color: #222222 } /* Name.Variable */
.highlight .ow { color: #999999 } /* Operator.Word */
.highlight .mb { color: #000000 } /* Literal.Number.Bin */
.highlight .mf { color: #000000 } /* Literal.Number.Float */
.highlight .mh { color: #000000 } /* Literal.Number.Hex */
.highlight .mi { color: #000000 } /* Literal.Number.Integer */
.highlight .mo { color: #000000 } /* Literal.Number.Oct */
.highlight .sb { color: #a67f59 } /* Literal.String.Backtick */
.highlight .sc { color: #a67f59 } /* Literal.String.Char */
.highlight .sd { color: #a67f59 } /* Literal.String.Doc */
.highlight .s2 { color: #a67f59 } /* Literal.String.Double */
.highlight .se { color: #a67f59 } /* Literal.String.Escape */
.highlight .sh { color: #a67f59 } /* Literal.String.Heredoc */
.highlight .si { color: #a67f59 } /* Literal.String.Interpol */
.highlight .sx { color: #a67f59 } /* Literal.String.Other */
.highlight .sr { color: #a67f59 } /* Literal.String.Regex */
.highlight .s1 { color: #a67f59 } /* Literal.String.Single */
.highlight .ss { color: #a67f59 } /* Literal.String.Symbol */
.highlight .vc { color: #0077aa } /* Name.Variable.Class */
.highlight .vg { color: #0077aa } /* Name.Variable.Global */
.highlight .vi { color: #0077aa } /* Name.Variable.Instance */
.highlight .il { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<style>/* style-selflinks */

.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: gray;
color: white;
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: black;
}

a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }</style>
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
color: #005a9c;
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }

[data-link-type=biblio] {
white-space: pre;
}</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"></p>
<h1 class="p-name no-ref" id="title">Foo</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="http://example.com/foo">http://example.com/foo</a>
<dt class="editor">Editor:
<dd class="editor p-author h-card vcard"><span class="p-name fn">Example Editor</span>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright">COPYRIGHT GOES HERE </p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<p>Testing IDL markup and linking.</p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
</ol>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
</ol>
</nav>
<main>
<pre class="idl highlight def"><span class="kt">enum</span> <dfn class="nv idl-code" data-dfn-type="enum" data-export="" id="enumdef-barenum">BarEnum<a class="self-link" href="#enumdef-barenum"></a></dfn> { <dfn class="s idl-code" data-dfn-for="BarEnum" data-dfn-type="enum-value" data-export="" data-lt="&quot;&quot;|" id="dom-barenum">""<a class="self-link" href="#dom-barenum"></a></dfn>, <dfn class="s idl-code" data-dfn-for="BarEnum" data-dfn-type="enum-value" data-export="" data-lt="&quot;bar&quot;|bar" id="dom-barenum-bar">"bar"<a class="self-link" href="#dom-barenum-bar"></a></dfn> };
<span class="kt">interface</span> <dfn class="nv idl-code" data-dfn-type="interface" data-export="" id="foo">Foo<a class="self-link" href="#foo"></a></dfn> {
<span class="kt">attribute</span> <span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="Foo" data-dfn-type="attribute" data-export="" data-type="DOMString" id="dom-foo-foo">foo<a class="self-link" href="#dom-foo-foo"></a></dfn>;
<span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="#enumdef-barenum">BarEnum</a> <dfn class="nv idl-code" data-dfn-for="Foo" data-dfn-type="attribute" data-export="" data-type="BarEnum" id="dom-foo-bar">bar<a class="self-link" href="#dom-foo-bar"></a></dfn>;
<span class="kt">attribute</span> <span class="kt">DOMString</span> <dfn class="nv idl-code" data-dfn-for="Foo" data-dfn-type="attribute" data-export="" data-type="DOMString" id="dom-foo-_or">_or<a class="self-link" href="#dom-foo-_or"></a></dfn>;
<span class="kt">Promise</span> &lt;<span class="kt">any</span>> <dfn class="nv idl-code" data-dfn-for="Foo" data-dfn-type="method" data-export="" data-lt="get(a)" id="dom-foo-get">get<a class="self-link" href="#dom-foo-get"></a></dfn>(<a class="n" data-link-type="idl-name">int</a> <a class="nv idl-code" data-link-type="argument" href="#dom-foo-get-a-a">a</a>);
};
</pre>
<table class="argumentdef data">
<caption>Arguments for the <a class="idl-code" data-link-type="method" href="#dom-foo-get">Foo.get(a)</a> method.</caption>
<thead>
<tr>
<th>Parameter
<th>Type
<th>Nullable
<th>Optional
<th>Description
<tbody>
<tr>
<td><dfn class="idl-code" data-dfn-for="Foo/get(a)" data-dfn-type="argument" data-export="" id="dom-foo-get-a-a">a<a class="self-link" href="#dom-foo-get-a-a"></a></dfn>
<td> int
<td> <span class="no">✘</span>
<td> <span class="no">✘</span>
<td>An argument.
</table>
<p><code class="idl"><a data-link-type="idl" href="#foo">Foo</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-foo-foo">foo</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-foo-_or">or</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-foo-_or">_or</a></code></p>
</main>
<h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span></h2>
<h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span></h3>
<ul class="index">
<li><a href="#dom-barenum">""</a><span>, in §Unnumbered section</span>
<li>
bar
<ul>
<li><a href="#dom-barenum-bar">enum-value for BarEnum</a><span>, in §Unnumbered section</span>
<li><a href="#dom-foo-bar">attribute for Foo</a><span>, in §Unnumbered section</span>
</ul>
<li><a href="#dom-barenum-bar">"bar"</a><span>, in §Unnumbered section</span>
<li><a href="#enumdef-barenum">BarEnum</a><span>, in §Unnumbered section</span>
<li><a href="#dom-foo-foo">foo</a><span>, in §Unnumbered section</span>
<li><a href="#foo">Foo</a><span>, in §Unnumbered section</span>
<li><a href="#dom-foo-get">get(a)</a><span>, in §Unnumbered section</span>
<li><a href="#dom-foo-_or">_or</a><span>, in §Unnumbered section</span>
</ul>
<h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span></h2>
<pre class="idl def"><span class="kt">enum</span> <a class="nv" href="#enumdef-barenum">BarEnum</a> { <a class="s" href="#dom-barenum">""</a>, <a class="s" href="#dom-barenum-bar">"bar"</a> };
<span class="kt">interface</span> <a class="nv" href="#foo">Foo</a> {
<span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv" data-type="DOMString" href="#dom-foo-foo">foo</a>;
<span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="#enumdef-barenum">BarEnum</a> <a class="nv" data-type="BarEnum" href="#dom-foo-bar">bar</a>;
<span class="kt">attribute</span> <span class="kt">DOMString</span> <a class="nv" data-type="DOMString" href="#dom-foo-_or">_or</a>;
<span class="kt">Promise</span> &lt;<span class="kt">any</span>> <a class="nv" href="#dom-foo-get">get</a>(<a class="n" data-link-type="idl-name">int</a> <a class="nv idl-code" data-link-type="argument" href="#dom-foo-get-a-a">a</a>);
};

</pre>