1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00
cdt/releng/scripts/do_generate_asciidoc.sh

31 lines
1,001 B
Bash
Raw Normal View History

#!/bin/bash
###############################################################################
# Copyright (c) 2025 Kichwa Coders Canada Inc
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
###############################################################################
set -e
SCRIPT=$( basename "${BASH_SOURCE[0]}" )
##
# Make sure that asciidocs are up to date
##
for p in doc/org.eclipse.cdt.doc.user; do
echo "Ensure adoc files start with expected contents"
ref_header=$p/adoc-headers.txt
git ls-files -- $p/**/*.adoc | while read i ; do
end_line=$(awk '/\/\/ ENDOFHEADER/{ print NR + 1; exit }' $i)
tmpfile=$(mktemp /tmp/adoc.XXXXXX)
cat $ref_header > $tmpfile
tail --lines=+${end_line:=0} $i >> $tmpfile
mv -f $tmpfile $i
done
done