/ scripts / checkXrefs
checkXrefs
 1  #!/bin/sh
 2  # checkXrefs - check internal links in a Vulkan HTML spec
 3  # Usage: checkXrefs file.html
 4  # Prints a list of internal hrefs with no corresponding anchors.
 5  # (There are many anchors with no corresponding hrefs - this is OK).
 6  
 7  xrefs=`tempfile`
 8  ids=`tempfile`
 9  
10  sed -e 's/ href="#/\nhref="#/g' < $1 | \
11      grep 'href="#' | \
12      sed -e 's/href="#//g' -e 's/"[ >].*//g' | \
13      sort | uniq > $xrefs
14  sed -e 's/ id="/\nid="/g' < $1 | \
15      grep 'id="' | \
16      sed -e 's/id="//g' -e 's/"[ >].*//g' | \
17      sort | uniq > $ids
18  
19  comm -23 $xrefs $ids
20  
21  rm $xrefs $ids 1>&2