Vulkan-Docs/scripts/globalizeIncludes

33 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2019 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# globalizeIncludes - rewrites generated include::, and image:/image::
# asciidoctor directives in specified Vulkan specification source files to
# be relative to specified attributes {generated} and {images}, ensuring
# they work properly when extracted to reference pages.
#
# usage: globalizeIncludes filenames
# Updates specified files in-place, so make sure they're backed up first.
sed -i -E \
-e 's#image:images/#image:{images}/#g' \
-e 's#image::images/#image::{images}/#g' \
-e 's#include::(\.\./)*(api|validity|hostsynctable)#include::{generated}/\2#g' \
$*
# Not yet:
# -e 's#include::meta/#include::{generated}/meta/#g' \