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

feat: fix #166 #168

Merged
merged 1 commit into from
Nov 24, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DocGen4/Output/Inductive.lean
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ open Lean

def instancesForToHtml (typeName : Name) : BaseHtmlM Html := do
pure
<details «class»="instances">
<details id={s!"instances-for-list-{typeName}"} «class»="instances-for-list">
<summary>Instances For</summary>
<ul id={s!"instances-for-list-{typeName}"} class="instances-for-list"></ul>
<ul class="instances-for-enum"></ul>
</details>

def ctorToHtml (c : Process.NameInfo) : HtmlM Html := do
Expand Down
16 changes: 11 additions & 5 deletions static/instances.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ async function annotateInstancesFor() {
for (const instanceForList of instanceForLists) {
const typeName = instanceForList.id.slice("instances-for-list-".length);
const instances = dataCenter.instancesForType(typeName);
var innerHTML = "";
for(var instance of instances) {
const instanceLink = dataCenter.declNameToLink(instance);
innerHTML += `<li><a href="${SITE_ROOT}${instanceLink}">${instance}</a></li>`

if (instances.length == 0) {
instanceForList.remove();
} else {
var innerHTML = "";
for(var instance of instances) {
const instanceLink = dataCenter.declNameToLink(instance);
innerHTML += `<li><a href="${SITE_ROOT}${instanceLink}">${instance}</a></li>`;
}
const instanceEnum = instanceForList.querySelector(".instances-for-enum");
instanceEnum.innerHTML = innerHTML;
}
instanceForList.innerHTML = innerHTML;
}
}
2 changes: 1 addition & 1 deletion static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ main h2, main h3, main h4, main h5, main h6 {
}

.imports li, code, .decl_header, .attributes, .structure_field_info,
.constructor, .instances li, .equation, .structure_ext_ctor {
.constructor, .instances li, .instances-for-list li, .equation, .structure_ext_ctor {
font-size: 16px;
font-family: 'JuliaMono', monospace;
}
Expand Down