diff options
Diffstat (limited to 'nixos/doc/manual/md-to-db.sh')
-rwxr-xr-x | nixos/doc/manual/md-to-db.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/doc/manual/md-to-db.sh b/nixos/doc/manual/md-to-db.sh index 4698e94f508b..a7421bed532e 100755 --- a/nixos/doc/manual/md-to-db.sh +++ b/nixos/doc/manual/md-to-db.sh @@ -50,3 +50,21 @@ for mf in ${MD_FILES[*]}; do done popd + +# now handle module chapters. we'll need extra checks to ensure that we don't process +# markdown files we're not interested in, so we'll require an x.nix file for ever x.md +# that we'll convert to xml. +pushd "$DIR/../../modules" + +mapfile -t MD_FILES < <(find . -type f -regex '.*\.md$') + +for mf in ${MD_FILES[*]}; do + [ -f "${mf%.md}.nix" ] || continue + + pandoc --top-level-division=chapter "$mf" "${pandoc_flags[@]}" -o "${mf%.md}.xml" + sed -i -e '1 i <!-- Do not edit this file directly, edit its companion .md instead\ + and regenerate this file using nixos/doc/manual/md-to-db.sh -->' \ + "${mf%.md}.xml" +done + +popd |