build.sh 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh -e
  2. # Patch Python-Markdown
  3. MARKDOWN_FILE=$(pip show markdown | awk '/Location/ { print $2 }')/markdown/extensions/codehilite.py
  4. patch -N -r - $MARKDOWN_FILE lua_highlight.patch || true
  5. # Split lua_api.txt on top level headings
  6. cat ../lua_api.txt | csplit -sz -f docs/section - '/^=/-1' '{*}'
  7. cat > mkdocs.yml << EOF
  8. site_name: Minetest API Documentation
  9. theme:
  10. name: readthedocs
  11. highlightjs: False
  12. extra_css:
  13. - css/code_styles.css
  14. - css/extra.css
  15. markdown_extensions:
  16. - toc:
  17. permalink: True
  18. - codehilite
  19. plugins:
  20. - search:
  21. separator: '[\s\-\.\(]+'
  22. nav:
  23. - "Home": index.md
  24. EOF
  25. mv docs/section00 docs/index.md
  26. for f in docs/section*
  27. do
  28. title=$(head -1 $f)
  29. fname=$(echo $title | tr '[:upper:]' '[:lower:]')
  30. fname=$(echo $fname | sed 's/ /-/g')
  31. fname=$(echo $fname | sed "s/'//g").md
  32. mv $f docs/$fname
  33. echo "- \"$title\": $fname" >> mkdocs.yml
  34. done
  35. mkdocs build --site-dir ../../public