forked from auxolotl/docs
fix admonitions
This commit is contained in:
parent
0d2a9633ff
commit
08305f7d57
|
@ -1,12 +1,6 @@
|
|||
{ channels, ... }:
|
||||
final: prev: {
|
||||
lix-docs = channels.nixpkgs.lix.overrideAttrs (old: {
|
||||
patches = (old.patches or [ ]) ++ [
|
||||
(prev.fetchpatch {
|
||||
url = "https://git.lix.systems/lix-project/lix/commit/c7af89c79771a6d4eb84baa6cd9b7551b3a84a4b.patch";
|
||||
hash = "sha256-u5c9GsPb1K2yjK6lhg7x0ui0lRHZA5r7Iqg0IMCD/CI=";
|
||||
})
|
||||
];
|
||||
lix-docs = channels.nixpkgs.lix.overrideAttrs {
|
||||
postBuild = ''
|
||||
TERM=dumb ninja doc/manual/markdown
|
||||
'';
|
||||
|
@ -20,5 +14,5 @@ final: prev: {
|
|||
installCheckPhase = ''
|
||||
true
|
||||
'';
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
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.
|
||||
- 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.
|
||||
- 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!
|
||||
|
||||
- [ ] Replace Lix doc fixme's with admonitions
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@ let
|
|||
};
|
||||
};
|
||||
optionsMD = optionsDoc.optionsCommonMark;
|
||||
|
||||
p = "find . -type f -exec perl -pi -e";
|
||||
s = "find . -type f -exec sed -i";
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nixpkgs-manual-md";
|
||||
|
@ -68,29 +71,66 @@ stdenvNoCC.mkDerivation {
|
|||
mkdir out
|
||||
cp ${optionsMD} out/options.md
|
||||
mv preface.chapter.md out/index.md
|
||||
mv build-helpers out/build-helpers
|
||||
mv build-helpers.md out/build-helpers/index.md
|
||||
mv development out/development
|
||||
mv development.md out/development/index.md
|
||||
mv functions out/functions
|
||||
mv functions.md out/functions/index.md
|
||||
mv hooks out/hooks
|
||||
mv languages-frameworks out/languages-and-frameworks
|
||||
mkdir out/library-reference
|
||||
cp ${pkgs.amg.nixpkgs-lib-docs}/*.md out/library-reference/
|
||||
mv module-system out/module-system
|
||||
mv packages out/packages
|
||||
mv stdenv out/stdenv
|
||||
mv stdenv.md out/stdenv/index.md
|
||||
mv using out/using-nixpkgs
|
||||
mv using-nixpkgs.md out/using-nixpkgs/index.md
|
||||
mv build-helpers out/Build-Helpers
|
||||
mv build-helpers.md out/Build-Helpers/index.md
|
||||
mv development out/Development
|
||||
mv development.md out/Development/index.md
|
||||
mv functions out/Functions
|
||||
mv functions.md out/Functions/index.md
|
||||
mv hooks out/Hooks
|
||||
mv languages-frameworks out/Languages-And-Frameworks
|
||||
mkdir out/Library-Reference
|
||||
cp ${pkgs.amg.nixpkgs-lib-docs}/*.md out/Library-Reference/
|
||||
mv module-system out/Module-System
|
||||
mv packages out/Packages
|
||||
mv stdenv out/Standard-Environment
|
||||
mv stdenv.md out/Standard-Environment/index.md
|
||||
mv using out/Using-Nixpkgs
|
||||
mv using-nixpkgs.md out/Using-Nixpkgs/index.md
|
||||
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\ \ /' {} \;
|
||||
find . -type f -exec perl -pi -e 's/\s*:::{.tip}\n/!!! tip\n\ \ \ \ /' {} \;
|
||||
find . -type f -exec perl -pi -e 's/\s*:::{.example}\n/!!! example\n\ \ \ \ /' {} \;
|
||||
find . -type f -exec sed -i 's/\s*::://g' {} \;
|
||||
find . -type f -exec sed -i 's/\n```nix/\ \ \ \ ```nix/g' {} \;
|
||||
|
||||
# Fix-up options page
|
||||
sed -i 's!${inputs.nixpkgs.outPath}!https://github.com/NixOS/nixpkgs/blob/master!g' options.md
|
||||
sed -i 's!file://!!g' options.md
|
||||
sed -i 's/\\//g' options.md
|
||||
|
||||
# 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
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue