#!/usr/bin/env bash
# Generate an HTML watermark for the given file. Claim the text was
# generated from SOURCE.
#
# Usage:
#
# make-watermark.sh FILE SOURCE
set -eu
# Include the watermark as visible text in the page, as suggested in bug 990662.
echo '
Source Metadata
'
echo ''
echo ' - Generated from file:
- '
echo "
- $2
"
echo ' - Watermark:
'
echo " - sha256:$(cat "$1" | shasum -a 256 | sed 's/ .*$//')
"
# If we have Mercurial changeset ID, include it.
if [ "${JS_DOC_HG_IDENTIFY:+set}" = set ]; then
# If the changeset ID has a '+' on the end (indicating local
# modifications), omit that from the link.
cat <Changeset:
- ${JS_DOC_HG_IDENTIFY}
EOF
fi
echo '
'