Vulkan-Docs/scripts/checkXrefs

22 lines
569 B
Bash
Executable File

#!/bin/sh
# checkXrefs - check internal links in a Vulkan HTML spec
# Usage: checkXrefs file.html
# Prints a list of internal hrefs with no corresponding anchors.
# (There are many anchors with no corresponding hrefs - this is OK).
xrefs=`tempfile`
ids=`tempfile`
sed -e 's/ href="#/\nhref="#/g' < $1 | \
grep 'href="#' | \
sed -e 's/href="#//g' -e 's/"[ >].*//g' | \
sort | uniq > $xrefs
sed -e 's/ id="/\nid="/g' < $1 | \
grep 'id="' | \
sed -e 's/id="//g' -e 's/"[ >].*//g' | \
sort | uniq > $ids
comm -23 $xrefs $ids
rm $xrefs $ids 1>&2