forked from auxolotl/docs
fix admonitions
This commit is contained in:
parent
0d2a9633ff
commit
08305f7d57
|
@ -1,12 +1,6 @@
|
||||||
{ channels, ... }:
|
{ channels, ... }:
|
||||||
final: prev: {
|
final: prev: {
|
||||||
lix-docs = channels.nixpkgs.lix.overrideAttrs (old: {
|
lix-docs = channels.nixpkgs.lix.overrideAttrs {
|
||||||
patches = (old.patches or [ ]) ++ [
|
|
||||||
(prev.fetchpatch {
|
|
||||||
url = "https://git.lix.systems/lix-project/lix/commit/c7af89c79771a6d4eb84baa6cd9b7551b3a84a4b.patch";
|
|
||||||
hash = "sha256-u5c9GsPb1K2yjK6lhg7x0ui0lRHZA5r7Iqg0IMCD/CI=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
TERM=dumb ninja doc/manual/markdown
|
TERM=dumb ninja doc/manual/markdown
|
||||||
'';
|
'';
|
||||||
|
@ -20,5 +14,5 @@ final: prev: {
|
||||||
installCheckPhase = ''
|
installCheckPhase = ''
|
||||||
true
|
true
|
||||||
'';
|
'';
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
Ongoing or future fixups and projects for this documentation site
|
Ongoing or future fixups and projects for this documentation site
|
||||||
|
|
||||||
- [ ] Fix Nixpkgs documentation admonitions
|
- [x] Fix Nixpkgs documentation admonitions
|
||||||
|
|
||||||
- Currently all of them are broken and need to have their formatting adjusted to be not broken.
|
- We believe that all admonitions in the documentation should be automatically fixed up. If they aren't, please let us know where you see broken ones!
|
||||||
- See all the examples [here](https://aux-docs.pyrox.pages.gay/Nixpkgs/library-reference/asserts/), for instance.
|
|
||||||
The code block should be inside the admonition.
|
|
||||||
|
|
||||||
- [ ] Replace Lix doc fixme's with admonitions
|
- [ ] Replace Lix doc fixme's with admonitions
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
optionsMD = optionsDoc.optionsCommonMark;
|
optionsMD = optionsDoc.optionsCommonMark;
|
||||||
|
|
||||||
|
p = "find . -type f -exec perl -pi -e";
|
||||||
|
s = "find . -type f -exec sed -i";
|
||||||
in
|
in
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
name = "nixpkgs-manual-md";
|
name = "nixpkgs-manual-md";
|
||||||
|
@ -68,29 +71,66 @@ stdenvNoCC.mkDerivation {
|
||||||
mkdir out
|
mkdir out
|
||||||
cp ${optionsMD} out/options.md
|
cp ${optionsMD} out/options.md
|
||||||
mv preface.chapter.md out/index.md
|
mv preface.chapter.md out/index.md
|
||||||
mv build-helpers out/build-helpers
|
mv build-helpers out/Build-Helpers
|
||||||
mv build-helpers.md out/build-helpers/index.md
|
mv build-helpers.md out/Build-Helpers/index.md
|
||||||
mv development out/development
|
mv development out/Development
|
||||||
mv development.md out/development/index.md
|
mv development.md out/Development/index.md
|
||||||
mv functions out/functions
|
mv functions out/Functions
|
||||||
mv functions.md out/functions/index.md
|
mv functions.md out/Functions/index.md
|
||||||
mv hooks out/hooks
|
mv hooks out/Hooks
|
||||||
mv languages-frameworks out/languages-and-frameworks
|
mv languages-frameworks out/Languages-And-Frameworks
|
||||||
mkdir out/library-reference
|
mkdir out/Library-Reference
|
||||||
cp ${pkgs.amg.nixpkgs-lib-docs}/*.md out/library-reference/
|
cp ${pkgs.amg.nixpkgs-lib-docs}/*.md out/Library-Reference/
|
||||||
mv module-system out/module-system
|
mv module-system out/Module-System
|
||||||
mv packages out/packages
|
mv packages out/Packages
|
||||||
mv stdenv out/stdenv
|
mv stdenv out/Standard-Environment
|
||||||
mv stdenv.md out/stdenv/index.md
|
mv stdenv.md out/Standard-Environment/index.md
|
||||||
mv using out/using-nixpkgs
|
mv using out/Using-Nixpkgs
|
||||||
mv using-nixpkgs.md out/using-nixpkgs/index.md
|
mv using-nixpkgs.md out/Using-Nixpkgs/index.md
|
||||||
pushd out
|
pushd out
|
||||||
find . -type f -exec perl -pi -e 's/\s*:::{.note}\n/!!! note\n\ \ /' {} \;
|
|
||||||
find . -type f -exec perl -pi -e 's/\s*:::{.warning}\n/!!! warning\n\ \ /' {} \;
|
# Fix-up options page
|
||||||
find . -type f -exec perl -pi -e 's/\s*:::{.tip}\n/!!! tip\n\ \ \ \ /' {} \;
|
sed -i 's!${inputs.nixpkgs.outPath}!https://github.com/NixOS/nixpkgs/blob/master!g' options.md
|
||||||
find . -type f -exec perl -pi -e 's/\s*:::{.example}\n/!!! example\n\ \ \ \ /' {} \;
|
sed -i 's!file://!!g' options.md
|
||||||
find . -type f -exec sed -i 's/\s*::://g' {} \;
|
sed -i 's/\\//g' options.md
|
||||||
find . -type f -exec sed -i 's/\n```nix/\ \ \ \ ```nix/g' {} \;
|
|
||||||
|
# Clean up all index pages
|
||||||
|
${s} '/```{=include=}/,$d' {} \;
|
||||||
|
|
||||||
|
# Remove all ::: sequences
|
||||||
|
${s} 's/\s*::://g' {} \;
|
||||||
|
|
||||||
|
# Indent all nix codeblocks
|
||||||
|
# ${p} 's/\n```nix/\ \ \ \ ```nix/g' -0 {} \;
|
||||||
|
|
||||||
|
# Replace nix-style note admonitions
|
||||||
|
${p} 's/\s*(\w?){.note}/!!! note/' {} \;
|
||||||
|
${s} '/^\!\!\![[:space:]]note/,/^$/s/^/\ \ \ \ /' {} \;
|
||||||
|
${s} 's/^\ \ \ \ !!! note/!!! note/' {} \;
|
||||||
|
|
||||||
|
# Replace nix-style warning admonitions
|
||||||
|
${p} 's/\s*(\w?){.warning}/!!! warning/' {} \;
|
||||||
|
${s} '/^\!\!\![[:space:]]warning/,/^$/s/^/\ \ \ \ /' {} \;
|
||||||
|
${s} 's/^\ \ \ \ !!! warning/!!! warning/' {} \;
|
||||||
|
|
||||||
|
# Replace nix-style tip admonitions
|
||||||
|
${p} 's/\s*(\w?){.tip}/!!! tip/' {} \;
|
||||||
|
${s} '/^\!\!\![[:space:]]tip/,/^$/s/^/\ \ \ \ /' {} \;
|
||||||
|
${s} 's/^\ \ \ \ !!! tip/!!! tip/' {} \;
|
||||||
|
|
||||||
|
# Replace nix-style example admonitions
|
||||||
|
${p} 's/\s*(\w?){.example.*}/!!! example/' {} \;
|
||||||
|
${p} 's/\n\n# /\ \"/g' -0 {} \;
|
||||||
|
${s} '/^!!! example/,/^$/s/^/\ \ \ \ /' {} \;
|
||||||
|
${s} 's/^\ \ \ \ !!! example/!!! example/' {} \;
|
||||||
|
|
||||||
|
# Have to special-case some example admonitions
|
||||||
|
${p} 's/\n\n\n/placeholderstring123/g' -0 {} \;
|
||||||
|
${s} '/^!!! example/,/placeholderstring123/s/^/\ \ \ \ /' {} \;
|
||||||
|
${p} 's/placeholderstring123/\n\n\n/g' -0 {} \;
|
||||||
|
${s} 's/^\ \ \ \ !!! example/!!! example/' {} \;
|
||||||
|
${p} 's/example\n[ ]{8}#### /example "/g' -0 {} \;
|
||||||
|
${s} '/^!!! example \"/s/$/\"/' {} \;
|
||||||
popd
|
popd
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue