summaryrefslogtreecommitdiff
path: root/lib/filters/about-formatting.sh
blob: 83a7bc0b9b4c9572dc698bbd0bdd20c98b2398b2 (plain)
  1. #!/bin/sh
  2. # This may be used with the about-filter or repo.about-filter setting in cgitrc.
  3. # It passes formatting of about pages to differing programs, depending on the usage.
  4. # Depends: cmark
  5. # The following environment variables can be used to retrieve the configuration
  6. # of the repository for which this script is called:
  7. # CGIT_REPO_URL ( = repo.url setting )
  8. # CGIT_REPO_NAME ( = repo.name setting )
  9. # CGIT_REPO_PATH ( = repo.path setting )
  10. # CGIT_REPO_OWNER ( = repo.owner setting )
  11. # CGIT_REPO_DEFBRANCH ( = repo.defbranch setting )
  12. # CGIT_REPO_SECTION ( = section setting )
  13. # CGIT_REPO_CLONE_URL ( = repo.clone-url setting )
  14. case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in
  15. *.markdown|*.mdown|*.md|*.mkd|*.mdwn) exec cmark --safe; ;;
  16. *.htm|*.html) exec cat; ;;
  17. *.txt|*) cd /usr/lib/cgit/filters/html-converters; exec ./txt2html; ;;
  18. esac