summaryrefslogtreecommitdiff
path: root/cgit/filters/about-formatting.sh
blob: 5d2d77b221a21947f83c2dc8a5554ae293524125 (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; ;;
  16. *.htm|*.html) exec cat; ;;
  17. *.txt|*) cd /usr/lib/cgit/filters/html-converters; exec ./txt2html; ;;
  18. esac