blob: 9f1de86421cbddd61eb10da4348e0ca25b2b62ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env bash
# Extract the js/src/doc watermark from standard input, assumed to be the
# text of a page formatted for publication on MDN.
#
# We can apply this to both the output of the formatter, and to pages
# retrieved from MDN, to see if anything needs to be updated.
#
# Usage:
#
# extract-watermark.sh
#
# For example:
#
# $ curl --silent 'https://developer.mozilla.org/en-US/docs/Tools/Debugger-API' | ./doc/lib/extract-watermark.sh
# sha256:168224ee2d58521b7c8368eddf4ac4fa53a897fa803ae484007af4e61a00ddcd
# $
set -eu
# Since $(foo) trims any final newline in foo's output, this 'echo' ensures
# that our output is terminated by a newline, whether or not curl | sed's
# is.
echo $(sed -n -e "s|.*<dd id=.watermark.>\([^<]*\)</dd>.*|\1|p")
|