]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libxo/xohtml/xohtml.sh.in
sysctl(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / contrib / libxo / xohtml / xohtml.sh.in
1 #!/bin/sh
2 #
3 # Copyright (c) 2014, Juniper Networks, Inc.
4 # All rights reserved.
5 # This SOFTWARE is licensed under the LICENSE provided in the
6 # ../Copyright file. By downloading, installing, copying, or otherwise
7 # using the SOFTWARE, you agree to be bound by the terms of that
8 # LICENSE.
9 # Phil Shafer, July 2014
10 #
11
12 BASE=@XO_SHAREDIR@
13 VERSION=@LIBXO_VERSION@
14 CMD=cat
15 DONE=
16 WEB=http://juniper.github.io/libxo/${VERSION}/xohtml
17
18 do_help () {
19     echo "xohtml: wrap libxo-enabled output in HTML"
20     echo "Usage: xohtml [options] [command [arguments]]"
21     echo "Valid options are:"
22     echo "    -b <basepath> | --base <basepath>"
23     echo "    -c <command> | --command <command>"
24     echo "    -f <output-file> | --file <output-file>"
25     exit 1
26 }
27
28 while [ -z "$DONE" -a ! -z "$1" ]; do
29     case "$1" in
30         -b|--base)
31             shift;
32             BASE="$1";
33             shift;
34             ;;
35         -c|--command)
36             shift;
37             CMD="$1";
38             shift;
39             ;;
40         -f|--file)
41             shift;
42             FILE="$1";
43             shift;
44             exec > "$FILE";
45             ;;
46         -w|--web)
47             shift;
48             BASE="${WEB}";
49             ;;
50
51         -*)
52             do_help
53             ;;
54         *)
55             DONE=1;
56             XX=$1;
57             shift;
58             CMD="$XX --libxo=html $@"
59             ;;
60     esac
61 done
62
63 if [ "$CMD" = "cat" -a -t 0 ]; then
64     do_help
65 fi
66
67 echo '<html>'
68 echo '<head>'
69 echo '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>'
70 echo '<link rel="stylesheet" href="'$BASE'/xohtml.css">'
71 echo '<link rel="stylesheet" href="'$BASE'/external/jquery.qtip.css"/>'
72 echo '<script type="text/javascript" src="'$BASE'/external/jquery.js"></script>'
73 echo '<script type="text/javascript" src="'$BASE'/external/jquery.qtip.js"></script>'
74 echo '<script type="text/javascript" src="'$BASE'/xohtml.js"></script>'
75 echo '<script>'
76 echo '</script>'
77 echo '</head>'
78 echo '<body>'
79
80 $CMD
81
82 echo '</body>'
83 echo '</html>'
84
85 exit 0