File tree 2 files changed +38
-8
lines changed
2 files changed +38
-8
lines changed Original file line number Diff line number Diff line change 1
1
{ lib , pkgs , ... } :
2
+ let
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
+ '' ;
27
+ in
2
28
{
3
29
options . enableMan = lib . mkOption {
4
30
type = lib . types . bool ;
17
43
] ;
18
44
19
45
config . docs = {
20
- # TODO: contributing page
21
46
pages . "" = {
22
47
menu . section = "header" ;
23
48
menu . location = [ "Home" ] ;
24
- source = pkgs . callPackage ./readme.nix {
25
- # TODO: get `availableVersions` and `baseHref` from module options
26
- } ;
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 ;
56
+ } ;
57
+ pages . contributing = {
58
+ menu . section = "footer" ;
59
+ menu . location = [ "Contributing" ] ;
60
+ source = fixLinks "contributing" ../../CONTRIBUTING.md ;
27
61
} ;
28
62
optionPages . docs = {
29
63
optionScopes = [ "docs" ] ;
Original file line number Diff line number Diff line change @@ -21,15 +21,11 @@ runCommand "index.md"
21
21
{
22
22
start = "<!-- START DOCS -->" ;
23
23
end = "<!-- STOP DOCS -->" ;
24
- baseurl = "https://nix-community.github.io/nixvim/" ;
25
24
src = ../../README.md ;
26
25
}
27
26
''
28
27
# extract relevant section of the README
29
28
sed -n "/$start/,/$end/p" $src > $out
30
- # replace absolute links
31
- substituteInPlace $out --replace-quiet "$baseurl" "./"
32
- # TODO: replace .html with .md
33
29
'' ;
34
30
35
31
docs_versions =
You can’t perform that action at this time.
0 commit comments