even more lix doc improvements

This commit is contained in:
Pyrox 2024-07-21 02:13:59 -04:00
parent 2453d2f8e2
commit 8aaf4b43e7
Signed by untrusted user: pyrox
GPG key ID: 8CDF3F7CAA53A0F5

View file

@ -38,6 +38,10 @@ stdenv.mkDerivation {
mv advanced-topics Advanced-Topics mv advanced-topics Advanced-Topics
mv architecture/architecture.md architecture/index.md mv architecture/architecture.md architecture/index.md
mv command-ref Command-Reference mv command-ref Command-Reference
sed -i 's!^- \[\(.*\)\]!# \1 !g' glossary.md
sed -i 's/^\(.*\)\({#gloss-.*}\)\(.*\)/\1\3\2/g' glossary.md
sed -i 's/ ,/,/g' glossary.md
sed -i 's/\(\S\){/\1 {/g' glossary.md
pushd Command-Reference pushd Command-Reference
mv command-ref.md index.md mv command-ref.md index.md
mv files.md files/index.md mv files.md files/index.md
@ -65,7 +69,9 @@ stdenv.mkDerivation {
pushd nix-env pushd nix-env
find . -type f -name "*.md" -exec bash -c 'defaultFix "$0"' {} \; find . -type f -name "*.md" -exec bash -c 'defaultFix "$0"' {} \;
sed -i 's!\./nix-env!\./!g' index.md sed -i 's!\./nix-env!\./!g' index.md
sed -i 's!../Command-Reference/!\./!g' index.md
popd popd
bash -c defaultFix conf-file.md
popd popd
# Contributing directory # Contributing directory
@ -75,6 +81,13 @@ stdenv.mkDerivation {
sed -i 's!^## \[\(.*\)\]!## \1 !g' experimental-features.md sed -i 's!^## \[\(.*\)\]!## \1 !g' experimental-features.md
popd popd
pushd language
sed -i '3s/##/#/' values.md
sed -E -i 's/(.*)(#type-\w+)">(\w+)<\/a>/## \3 {\2}/' values.md
sed -i 's/## List/# List/' values.md
sed -i 's/## Attribute Set/# Attribute Set/' values.md
popd
# Final directories # Final directories
mv installation/installation.md installation/index.md mv installation/installation.md installation/index.md
mv package-management/package-management.md package-management/index.md mv package-management/package-management.md package-management/index.md
@ -83,26 +96,35 @@ stdenv.mkDerivation {
mv release-notes/release-notes.md release-notes/index.md mv release-notes/release-notes.md release-notes/index.md
# Admonitions # Admonitions
find . -type f -name "*.md" -exec perl -pi -e 's/ <div class="warning">/!!! warning/g' {} \; find . -type f -name "*.md" -exec perl -pi -e 's/\s*<div class="warning">/!!! warning/g' {} \;
find . -type f -name "*.md" -exec sed -i '/<\/div>/d' {} \; find . -type f -name "*.md" -exec sed -i '/<\/div>/d' {} \;
find . -type f -name "*.md" -exec perl -pi -e 's/\n\n\n/placeholderstring123/g' -0 {} \; find . -type f -name "*.md" -exec perl -pi -e 's/\n\n\n/placeholderstring123/g' -0 {} \;
find . -type f -name "*.md" -exec sed -i '/^!!! warning/,/placeholderstring123/s/^/\ \ \ \ /' {} \; find . -type f -name "*.md" -exec sed -i '/^!!! warning/,/placeholderstring123/s/^/\ \ \ \ /' {} \;
find . -type f -name "*.md" -exec perl -pi -e 's/placeholderstring123/\n\n\n/g' -0 {} \; find . -type f -name "*.md" -exec perl -pi -e 's/placeholderstring123/\n\n\n/g' -0 {} \;
find . -type f -name "*.md" -exec perl -pi -e 's/ > \*\*Warning\*\*/!!! warning2/g' {} \; find . -type f -name "*.md" -exec perl -pi -e 's/\s*> \*\*Warning\*\*/!!! warning2/g' {} \;
find . -type f -name "*.md" -exec sed -i '/^!!! warning2/,/^$/s/ >/\ \ \ /' {} \; find . -type f -name "*.md" -exec sed -i '/^!!! warning2/,/^$/s/ >/\ \ \ /' {} \;
find . -type f -name "*.md" -exec sed -i 's/!!! warning2/!!! warning/' {} \; find . -type f -name "*.md" -exec sed -i 's/!!! warning2/!!! warning/' {} \;
find . -type f -name "*.md" -exec sed -i 's/^\ \ \ \ !!! warning/!!! warning/' {} \; find . -type f -name "*.md" -exec sed -i 's/^\ \ \ \ !!! warning/!!! warning/' {} \;
find . -type f -name "*.md" -exec perl -pi -e 's/!!! warning\n \n/!!! warning\n/g' -0 {} \; find . -type f -name "*.md" -exec perl -pi -e 's/!!! warning\n \n/!!! warning\n/g' -0 {} \;
find . -type f -name "*.md" -exec perl -pi -e 's/\s*> \*\*Note\*\*\n.*/\n\n!!! note/g' -0 {} \;
find . -type f -name "*.md" -exec sed -i '/^!!! note/,/^[^!>]/s/^>/\ \ \ /' {} \;
# Increase all headings past line 1 by one level # Increase all headings past line 1 by one level
# Lix docs all have level-1 headings, we need at least level 2 # Lix docs all have level-1 headings, we need at least level 2
find . -type f -name "*.md" -exec sed -i '2,$s/# [^#]*/#&/g' {} \; find . -type f -name "*.md" -exec sed -i '2,$s/# [^#]*/#&/g' {} \;
# Clean up some local links # Clean up some local links
find . -type f -name "*.md" -exec sed -i 's/advanced-topics/Advanced-Topics/g' {} \;
find . -type f -name "*.md" -exec sed -i 's/command-ref/Command-Reference/g' {} \; find . -type f -name "*.md" -exec sed -i 's/command-ref/Command-Reference/g' {} \;
find . -type f -name "*.md" -exec sed -i 's/package-management/Package-Management/g' {} \;
find . -type f -name "*.md" -exec sed -i 's/new-cli/New-CLI/g' {} \; find . -type f -name "*.md" -exec sed -i 's/new-cli/New-CLI/g' {} \;
find . -type f -name "*.md" -exec sed -i 's/Command-Reference\.(?:html|md)//g' {} \; find . -type f -name "*.md" -exec sed -i 's/Command-Reference\.html//g' {} \;
find . -type f -name "*.md" -exec sed -i 's/conf-file\.(?:html|md)/conf-file/g' {} \; find . -type f -name "*.md" -exec sed -i 's/Command-Reference\.md//g' {} \;
find . -type f -name "*.md" -exec sed -i 's/values\.(?:html|md)/values/g' {} \; find . -type f -name "*.md" -exec sed -i 's/conf-file\.html/conf-file\.md/g' {} \;
find . -type f -name "*.md" -exec sed -i 's/nix-env\.md/nix-env/g' {} \;
find . -type f -name "*.md" -exec sed -i 's/values\.html/values\.md/g' {} \;
# Final misc cleanups
find . -type f -name "*.md" -exec sed -i 's/[\]//g' {} \;
''; '';
} }