-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--[[ | ||
Resolve cross-references to NixOS options in a hacky way and link them to the | ||
unstable channel's option search page on search.nixos.org | ||
]] | ||
|
||
function Link(elem) | ||
prefix = '#opt-' | ||
if elem.target:sub(1, #prefix) == prefix then | ||
option_name = elem.target:sub(#prefix + 1) | ||
option_name = option_name:gsub('%._name_%.', '.<name>.') | ||
option_name = option_name:gsub('%._%.', '.*.') | ||
|
||
elem.target = 'https://search.nixos.org/options?channel=unstable&show=' .. option_name .. '&query=' .. option_name | ||
|
||
if #elem.content == 1 and elem.content[1].tag == 'Str' and elem.content[1].text == '???' then | ||
elem.content[1].text = option_name | ||
end | ||
|
||
return elem | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters