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