summaryrefslogtreecommitdiff
path: root/codegen/vulkan/scripts/checkXrefs
diff options
context:
space:
mode:
Diffstat (limited to 'codegen/vulkan/scripts/checkXrefs')
-rwxr-xr-xcodegen/vulkan/scripts/checkXrefs26
1 files changed, 26 insertions, 0 deletions
diff --git a/codegen/vulkan/scripts/checkXrefs b/codegen/vulkan/scripts/checkXrefs
new file mode 100755
index 00000000..6d5dc7d7
--- /dev/null
+++ b/codegen/vulkan/scripts/checkXrefs
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright 2015-2021 The Khronos Group Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+# 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