mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
docs: add status to beta/deprecated version links
This commit is contained in:
parent
b4750c4696
commit
d3da2462eb
4 changed files with 48 additions and 8 deletions
4
.github/workflows/website.yml
vendored
4
.github/workflows/website.yml
vendored
|
@ -63,12 +63,12 @@ jobs:
|
|||
| {
|
||||
"branch": .value.branch,
|
||||
"nixpkgsBranch": .value.channel,
|
||||
"baseHref": "/nixvim/\(.key)/"
|
||||
"baseHref": "/nixvim/\(.key)/",
|
||||
"status": .value.status
|
||||
}
|
||||
| select(.branch == "main").baseHref = "/nixvim/"
|
||||
]
|
||||
' version-info.toml
|
||||
# TODO: add channel status
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.name }}
|
||||
|
|
|
@ -8,7 +8,7 @@ title = "nixvim docs"
|
|||
[output.html]
|
||||
site-url = "@SITE_URL@"
|
||||
additional-js = ["theme/pagetoc.js"]
|
||||
additional-css = ["theme/pagetoc.css"]
|
||||
additional-css = ["custom.css", "theme/pagetoc.css"]
|
||||
|
||||
# Redirect targets must be relative to their origin;
|
||||
# absolute paths can break with different baseHrefs.
|
||||
|
|
19
docs/mdbook/custom.css
Normal file
19
docs/mdbook/custom.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
.label {
|
||||
padding: 0.1rem 0.4em;
|
||||
font-size: 0.8em;
|
||||
font-weight: 600;
|
||||
vertical-align: bottom;
|
||||
background-color: #5a6165;
|
||||
text-shadow: rgba(0, 0, 0, 0.25) 0px -1px 0px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.label-info {
|
||||
background-color: #337798;
|
||||
}
|
||||
|
||||
.label-warning {
|
||||
background-color: #da8206;
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
# The root directory of the site
|
||||
baseHref ? "/",
|
||||
# A list of all available docs that should be linked to
|
||||
# Each element should contain { branch; nixpkgsBranch; baseHref; }
|
||||
# Each element should contain { branch; nixpkgsBranch; baseHref; status; }
|
||||
availableVersions ? [ ],
|
||||
}:
|
||||
let
|
||||
|
@ -306,9 +306,9 @@ let
|
|||
# Zip the list of attrs into an attr of lists, for use as bash arrays
|
||||
zippedVersions =
|
||||
assert lib.assertMsg
|
||||
(lib.all (o: o ? branch && o ? nixpkgsBranch && o ? baseHref) availableVersions)
|
||||
(lib.all (o: o ? branch && o ? nixpkgsBranch && o ? baseHref && o ? status) availableVersions)
|
||||
''
|
||||
Expected all "availableVersions" docs entries to contain { branch, nixpkgsBranch, baseHref } attrs!
|
||||
Expected all "availableVersions" docs entries to contain { branch, nixpkgsBranch, baseHref, status } attrs!
|
||||
'';
|
||||
lib.zipAttrs availableVersions;
|
||||
in
|
||||
|
@ -338,9 +338,10 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
|||
{ type, hasExt, ... }:
|
||||
type == "regular"
|
||||
&& lib.any hasExt [
|
||||
"css"
|
||||
"js"
|
||||
"md"
|
||||
"toml"
|
||||
"js"
|
||||
]
|
||||
) ./.)
|
||||
];
|
||||
|
@ -442,6 +443,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
|||
branches = zippedVersions.branch or [ ];
|
||||
nixpkgsBranches = zippedVersions.nixpkgsBranch or [ ];
|
||||
baseHrefs = zippedVersions.baseHref or [ ];
|
||||
statuses = zippedVersions.status or [ ];
|
||||
current = baseHref;
|
||||
}
|
||||
''
|
||||
|
@ -451,6 +453,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
|||
nixpkgs="''${nixpkgsBranches[i]}"
|
||||
baseHref="''${baseHrefs[i]}"
|
||||
linkText="\`$branch\` branch"
|
||||
status="''${statuses[i]}"
|
||||
|
||||
link=
|
||||
suffix=
|
||||
|
@ -462,7 +465,25 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
|
|||
link="[$linkText]($baseHref)"
|
||||
fi
|
||||
|
||||
echo "- The $link, for use with nixpkgs \`$nixpkgs\`$suffix" >> "$out"
|
||||
statusClass=
|
||||
statusText=
|
||||
if [ "$status" = "beta" ]; then
|
||||
statusClass="label label-info"
|
||||
statusText=Beta
|
||||
elif [ "$status" = "deprecated" ]; then
|
||||
statusClass="label label-warning"
|
||||
statusText=Deprecated
|
||||
fi
|
||||
|
||||
{
|
||||
echo -n '- '
|
||||
if [ -n "$statusClass" ] && [ -n "$statusText" ]; then
|
||||
echo -n '<span class="'"$statusClass"'">'"$statusText"'</span> '
|
||||
fi
|
||||
echo -n "The $link"
|
||||
echo -n ", for use with nixpkgs \`$nixpkgs\`"
|
||||
echo "$suffix"
|
||||
} >> "$out"
|
||||
done
|
||||
'';
|
||||
user-configs = callPackage ../user-configs { };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue