update_mdbook.sh 997 B

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