Skip to content

Commit

Permalink
Actually fix #1087 this time. Lrn 2 python, nub.
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed Oct 3, 2017
1 parent 5834a15 commit 349d758
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bikeshed/unsortedJunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ def classifyDfns(doc, dfns):
if config.linkTypeIn(dfnType, "codelike"):
child = hasOnlyChild(el)
if child is not None and child.tag == "code":
pass
continue
if el.tag in ("h1", "h2", "h3", "h4", "h5", "h6"):
# Don't wrap headings, it looks bad.
pass
continue
wrapContents(el, E.code())


Expand Down
17 changes: 17 additions & 0 deletions tests/idl004.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<pre class=metadata>
Title: Foo
Group: test
Shortname: foo
Level: 1
Status: LS
ED: http://example.com/foo
Abstract: Make sure <code>, but not too much.
Editor: Example Editor
Date: 1970-01-01
</pre>

<h2 interface id=foo>this shouldn't have a code</h2>

<dfn interface>this should have one code</dfn>

<dfn interface><code>this one already has a code, shouldn't have a second</code></dfn>
199 changes: 199 additions & 0 deletions tests/idl004.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
<!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>
<link href="http://example.com/foo" rel="canonical">
<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-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>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>Make sure <code>, but not too much.</code></p>
<code> </code>
</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="#foo"><span class="secno">1</span> <span class="content">this shouldn’t have a code</span></a>
<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>
</ol>
</nav>
<main>
<h2 class="heading settled idl-code" data-dfn-type="interface" data-export="" data-level="1" data-lt="this shouldn’t have a code" id="foo"><span class="secno">1. </span><span class="content">this shouldn’t have a code</span><a class="self-link" href="#foo"></a></h2>
<p><dfn class="idl-code" data-dfn-type="interface" data-export="" id="this-should-have-one-code"><code>this should have one code</code><a class="self-link" href="#this-should-have-one-code"></a></dfn></p>
<p><dfn class="idl-code" data-dfn-type="interface" data-export="" id="this-one-already-has-a-code-shouldnt-have-a-second"><code>this one already has a code, shouldn’t have a second</code><a class="self-link" href="#this-one-already-has-a-code-shouldnt-have-a-second"></a></dfn></p>
</main>
<h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
<h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
<ul class="index">
<li><a href="#this-one-already-has-a-code-shouldnt-have-a-second">this one already has a code, shouldn’t have a second</a><span>, in §1</span>
<li><a href="#this-should-have-one-code">this should have one code</a><span>, in §1</span>
<li><a href="#foo">this shouldn’t have a code</a><span>, in §Unnumbered section</span>
</ul>

0 comments on commit 349d758

Please sign in to comment.