File tree Expand file tree Collapse file tree 2 files changed +11
-32
lines changed Expand file tree Collapse file tree 2 files changed +11
-32
lines changed Original file line number Diff line number Diff line change 11{ lib , pkgs , ... } :
22let
33 # Replaces absolute links to the docs with relative links
4- # FIXME: use pandoc filters to do this with an AST
5- fixLinks =
6- name : src :
7- pkgs . runCommand name
8- {
9- inherit src ;
10- github = "https://github.com/nix-community/nixvim/blob/main/" ;
11- baseurl = "https://nix-community.github.io/nixvim/" ;
12- }
13- ''
14-
15- cp $src $out
16-
17- # replace relative links with links to github
18- # TODO: it'd be nice to match relative links without a leading ./
19- # but that is less trivial
20- substituteInPlace $out --replace-quiet "./" "$github"
21-
22- # replace absolute links
23- substituteInPlace $out --replace-quiet "$baseurl" "./"
24-
25- # TODO: replace .html with .md
26- '' ;
4+ fixLinks = pkgs . callPackage ../../docs/fix-linkx {
5+ githubUrl = "https://github.com/nix-community/nixvim/blob/main/" ;
6+ baseurlUrl = "https://nix-community.github.io/nixvim/" ;
7+ } ;
278in
289{
2910 options . enableMan = lib . mkOption {
4627 pages . "" = {
4728 menu . section = "header" ;
4829 menu . location = [ "Home" ] ;
49- source =
50- let
51- src = pkgs . callPackage ./readme.nix {
52- # TODO: get `availableVersions` and `baseHref` from module options
53- } ;
54- in
55- fixLinks src . name src ;
30+ source = pkgs . callPackage ./readme.nix {
31+ inherit fixLinks ;
32+ # TODO: get `availableVersions` and `baseHref` from module options
33+ } ;
5634 } ;
5735 pages . contributing = {
5836 menu . section = "footer" ;
5937 menu . location = [ "Contributing" ] ;
60- source = fixLinks "contributing" ../../CONTRIBUTING.md ;
38+ source = fixLinks ../../CONTRIBUTING.md ;
6139 } ;
6240 optionPages . docs = {
6341 optionScopes = [ "docs" ] ;
Original file line number Diff line number Diff line change 11{
22 lib ,
33 runCommand ,
4+ fixLinks ,
45 availableVersions ? [ ] ,
56 baseHref ? "/" , # TODO: remove & get from module config
67} :
@@ -21,7 +22,7 @@ runCommand "index.md"
2122 {
2223 start = "<!-- START DOCS -->" ;
2324 end = "<!-- STOP DOCS -->" ;
24- src = ../../README.md ;
25+ src = fixLinks ../../README.md ;
2526 }
2627 ''
2728 # extract relevant section of the README
You can’t perform that action at this time.
0 commit comments