/usr/bin/yelp-new is in yelp-tools 3.18.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | #!/bin/sh
# yelp-new
# Copyright (C) 2010 Shaun McCance <shaunm@gnome.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
tmpldir="/usr/share/yelp-tools/templates/"
yelp_describe_tmpl () {
    line="  "`basename "$1" | sed -e 's/\.'$2'$//'`
    desc=`cat "$f" | grep '<\?yelp-tmpl-desc' | sed -e 's/<?yelp-tmpl-desc //' -e 's/?>$//'`
    if [ "x$desc" != "x" ]; then
        line="$line - $desc"
    fi
    echo "$line"
}
yelp_get_extension () {
    echo "$1" | awk -F . '{print $NF}'
}
yelp_usage() {
    echo "Usage: yelp-new [OPTIONS] <TEMPLATE> <ID> [TITLE]"
    echo ""
    echo "Options:"
    echo "  --stub  Create a .page.stub file instead of a .page file"
    echo "  --tmpl  Copy an installed template to a local template"
    if [ -f *.page.tmpl ]; then
        echo ""
        echo "Local Mallard Templates:"
        for f in *.page.tmpl; do
            yelp_describe_tmpl "$f" "page.tmpl"
        done
    fi
    if [ -f ${tmpldir}*.page ]; then
        echo ""
        echo "Mallard Templates:"
        for f in ${tmpldir}*.page; do
            yelp_describe_tmpl "$f" "page"
        done
    fi
    if [ -f *.docbook.tmpl ]; then
        echo ""
        echo "Local DocBook Templates:"
        for f in *.docbook.tmpl; do
            yelp_describe_tmpl "$f" "xml.tmpl"
        done
    fi
    if [ -f ${tmpldir}*.docbook ]; then
        echo ""
        echo "DocBook Templates:"
        for f in ${tmpldir}*.docbook; do
            yelp_describe_tmpl "$f" "xml"
        done
    fi
}
if [ $# -lt 2 ]; then
    yelp_usage
    exit 1
fi
# Process options
spec=""
while [ $# -gt 0 ]; do
    case "$1" in
        --stub)
            spec=".stub"
            shift;;
        --tmpl)
            spec=".tmpl"
            shift;;
        -h | --help)
            yelp_usage
            exit 0;;
        *)
            break
    esac
done
# Locate the template file
if [ $(yelp_get_extension ${1}) = "tmpl" -a -f "${1}" ]; then
    infile="${1}"
    outext="."$(yelp_get_extension $(basename "${1}" ".tmpl"))
elif [ -f "${1}.page.tmpl" ]; then
    infile="${1}.page.tmpl"
    outext=".page"
elif [ -f "${tmpldir}${1}.page" ]; then
    infile="${tmpldir}${1}.page"
    outext=".page"
elif [ -f "${1}.docbook.tmpl" ]; then
    infile="${1}.docbook.tmpl"
    outext=".docbook"
elif [ -f "${tmpldir}${1}.docbook" ]; then
    infile="${tmpldir}${1}.docbook"
    outext=".docbook"
else
    echo "Error: No template named ${1} found"
    exit 1
fi
# Set up some variables for substitution
if type git >/dev/null 2>&1; then
    username=`git config user.name`
    useremail=`git config user.email`
fi
if [ "x$username" = "x" -a "x$useremail" = "x" ]; then
    if type bzr >/dev/null 2>&1; then
        username=`bzr whoami | sed -e 's/ <.*//'`
        useremail=`bzr whoami --email`
    fi
fi
if [ "x$username" = "x" -a "x$useremail" = "x" ]; then
    username='YOUR NAME'
    useremail='YOUR EMAIL ADDRESS'
fi
pagetitle="$3"
if [ "x$pagetitle" = "x" ]; then
    pagetitle="TITLE"
fi
outid=$(basename "${2}")
if [ "x$spec" != "x" ]; then
    if [ "."$(yelp_get_extension "${2}") = "$spec" ]; then
        outfile="${2}"
    elif [ "."$(yelp_get_extension "${2}") = "$outext" ]; then
        outfile="${2}${spec}"
    else
        outfile="${2}${outext}${spec}"
    fi
elif [ "."$(yelp_get_extension ${2}) = "$outext" ]; then
    outfile="${2}"
else
    outfile="${2}${outext}"
fi
if [ "x$spec" = "x.tmpl" ]; then
    cp "$infile" "$outfile"
else
    cat "$infile" | grep -v '<\?yelp-tmpl-desc' | sed \
        -e s/@ID@/"$outid"/ \
        -e s/@DATE@/`date +%Y-%m-%d`/ \
        -e s/@YEAR@/`date +%Y`/ \
        -e s/@NAME@/"$username"/ \
        -e s/@EMAIL@/"$useremail"/ \
        -e s/@TITLE@/"$pagetitle"/ \
        > "$outfile"
fi
 |