Skip to content

Instantly share code, notes, and snippets.

@antifuchs
Last active August 28, 2023 16:45
Show Gist options
  • Save antifuchs/8d946b121fb5dbbf4da01dc05f7d749f to your computer and use it in GitHub Desktop.
Save antifuchs/8d946b121fb5dbbf4da01dc05f7d749f to your computer and use it in GitHub Desktop.
A Dash7 docset generator that allows indexing the current stable nixpkgs manual
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>allowFilters</key>
<string></string>
<key>basicIndexEnabled</key>
<true/>
<key>cssToInject</key>
<string>footer {
display: none !important;
}
.toc {
display: none !important;
}</string>
<key>denyFilters</key>
<string></string>
<key>docsetKeyword</key>
<string>nixpkgs</string>
<key>docsetName</key>
<string>nixpkgs stable manual</string>
<key>extraInfoPlist</key>
<string></string>
<key>isFromLocalFolder</key>
<false/>
<key>isFromWebsite</key>
<true/>
<key>javaScriptIndexEnabled</key>
<true/>
<key>javaScriptUsedToIndex</key>
<string>
var done = {};
function indexEntryFrom(type, considerDone) {
return function() {
const entryName = $(this).text();
var entryHash = $(this).attr('id');
if(!entryHash)
{
entryHash = $(this).children("a").attr('id');
}
if(considerDone &amp;&amp; done[entryHash]) { return; }
dashDoc.addEntry({name: entryName, type: type, hash: entryHash});
done[entryHash] = true;
};
}
$("code.function").parent(".title").each(indexEntryFrom("Function"));
// stdenv functions / hooks and phases
$("#ssec-stdenv-functions").parents("section.section").find("code.literal").parents("h3").each(indexEntryFrom("Command"))
$("#sec-stdenv-phases").parents("section.section").find("code.literal").parents("h5").each(indexEntryFrom("Attribute"))
$("#variables-specifying-dependencies").parents("section.section").find("code.literal").parents("h5").each(indexEntryFrom("Attribute"))
$("h2.title#chap-hooks").parents(".chapter").find(".section h2.title").each(indexEntryFrom("Hook"));
$("#part-builders").parents("div.part").find("h2.title>code.literal").parent().each(indexEntryFrom("Function", true));
for (chap of ["#chap-special"]) {
$(chap).parents("section.chapter").find(".title").each(indexEntryFrom("Function", true));
}
for (sec of ["#sec-pkgs-dockerTools", "#sec-pkgs-ociTools"]) {
$(sec).parents("section.section").find("h3.title").each(indexEntryFrom("Function", true));
}
$("h1.title").each(indexEntryFrom("Guide", true));
$("h2.title").filter((i, elt) => $(elt).parentsUntil("section").parent().hasClass("chapter")).each(indexEntryFrom("Section", true));
</string>
<key>localFolderPath</key>
<string></string>
<key>websiteURL</key>
<string>https://nixos.org/manual/nixpkgs/stable/</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment