#!/bin/bash cd /root/BookStack2Site/ && rm -r book-test/src book-test/book BookStackEndpoint="" BookStackAPITokenID= BookStackAPITokenSecret= MdBookSite="" bin/bookstack2site --bookstack-url=${BookStackEndpoint} --token-id=${BookStackAPITokenID} --token-secret=${BookStackAPITokenSecret} --download-location="./book-test/src" # notice: better change the name of markdown files, so the path in URL would not be too ugly # convert markup to mdbook-admonish # success label is not supported # mdbook-regex is also suggested cd book-test find . -name "*.md" -exec sed -i 's/
\(.*\)<\/p>/```admonish info\n\1\n```/g' {} \; find . -name "*.md" -exec sed -i 's/
\(.*\)<\/p>/```admonish warning\n\1\n```/g' {} \; find . -name "*.md" -exec sed -i 's/
\(.*\)<\/p>/```admonish danger\n\1\n```/g' {} \; # build static pages ../bin/mdbook build ../bin/mdbook-sitemap-generator -d ${MdBookSite} -o book/sitemap.xml # upload # lftp stuff