filters/about-formatting.sh (view raw)
1#!/bin/sh
2
3# This may be used with the about-filter or repo.about-filter setting in cgitrc.
4# It passes formatting of about pages to differing programs, depending on the usage.
5
6# Markdown support requires perl.
7# RestructuredText support requires python and docutils.
8# Man page support requires groff.
9
10# The following environment variables can be used to retrieve the configuration
11# of the repository for which this script is called:
12# CGIT_REPO_URL ( = repo.url setting )
13# CGIT_REPO_NAME ( = repo.name setting )
14# CGIT_REPO_PATH ( = repo.path setting )
15# CGIT_REPO_OWNER ( = repo.owner setting )
16# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting )
17# CGIT_REPO_SECTION ( = section setting )
18# CGIT_REPO_CLONE_URL ( = repo.clone-url setting )
19
20cd "$(dirname $0)/html-converters/"
21case "$(tr '[:upper:]' '[:lower:]' <<<"$1")" in
22 *.md|*.mkd) exec ./md2html; ;;
23 *.rst) exec ./rst2html; ;;
24 *.[1-9]) exec ./man2html; ;;
25 *.htm|*.html) exec cat; ;;
26 *.txt|*) exec ./txt2html; ;;
27esac