1#!/bin/sh
2#
3# Copyright 2019-2023 The Khronos Group Inc.
4#
5# SPDX-License-Identifier: Apache-2.0
6
7# globalizeIncludes - rewrites generated include::, and image:/image::
8# asciidoctor directives in specified Vulkan specification source files to
9# be relative to specified attributes {generated} and {images}, ensuring
10# they work properly when extracted to reference pages.
11#
12# usage: globalizeIncludes filenames
13# Updates specified files in-place, so make sure they are backed up first.
14
15sed -i -E \
16    -e 's#image:images/#image:{images}/#g' \
17    -e 's#image::images/#image::{images}/#g' \
18    -e 's#include::(\.\./)*(api|validity|hostsynctable)#include::{generated}/\2#g' \
19    $*
20
21# Not yet:
22#   -e 's#include::meta/#include::{generated}/meta/#g' \
23