File tree 2 files changed +11
-32
lines changed
2 files changed +11
-32
lines changed Original file line number Diff line number Diff line change 1
1
{ lib , pkgs , ... } :
2
2
let
3
3
# 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
+ } ;
27
8
in
28
9
{
29
10
options . enableMan = lib . mkOption {
46
27
pages . "" = {
47
28
menu . section = "header" ;
48
29
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
+ } ;
56
34
} ;
57
35
pages . contributing = {
58
36
menu . section = "footer" ;
59
37
menu . location = [ "Contributing" ] ;
60
- source = fixLinks "contributing" ../../CONTRIBUTING.md ;
38
+ source = fixLinks ../../CONTRIBUTING.md ;
61
39
} ;
62
40
optionPages . docs = {
63
41
optionScopes = [ "docs" ] ;
Original file line number Diff line number Diff line change 1
1
{
2
2
lib ,
3
3
runCommand ,
4
+ fixLinks ,
4
5
availableVersions ? [ ] ,
5
6
baseHref ? "/" , # TODO: remove & get from module config
6
7
} :
@@ -21,7 +22,7 @@ runCommand "index.md"
21
22
{
22
23
start = "<!-- START DOCS -->" ;
23
24
end = "<!-- STOP DOCS -->" ;
24
- src = ../../README.md ;
25
+ src = fixLinks ../../README.md ;
25
26
}
26
27
''
27
28
# extract relevant section of the README
You can’t perform that action at this time.
0 commit comments