1- #! /bin/bash
1+ #! /usr/ bin/env bash
22#
3- # Copyright (c) 2023-2024 Red Hat, Inc.
3+ # Copyright (c) Red Hat, Inc.
44# This program and the accompanying materials are made
55# available under the terms of the Eclipse Public License 2.0
66# which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -18,19 +18,19 @@ BRANCH="main"
1818
1919while [[ " $# " -gt 0 ]]; do
2020 case $1 in
21- ' -b' ) BRANCH=" $2 " ; shift 1;;
21+ ' -b' ) BRANCH=" $2 " ; shift 1;;
2222 esac
2323 shift 1
2424done
2525
26- rm -fr titles-generated/;
27- mkdir -p titles-generated/" ${BRANCH} " ;
26+ rm -fr titles-generated/;
27+ mkdir -p titles-generated/" ${BRANCH} " ;
2828echo " <html><head><title>Red Hat Developer Hub Documentation Preview - ${BRANCH} </title></head><body><ul>" > titles-generated/" ${BRANCH} " /index.html;
2929# exclude the rhdh-plugins-reference as it's embedded in the admin guide
3030# shellcheck disable=SC2044,SC2013
3131set -e
3232for t in $( find titles -name master.adoc | sort -uV | grep -E -v " ${EXCLUDED_TITLES} " ) ; do
33- d=${t%/* } ; d=${d/ titles/ titles-generated\/ ${BRANCH} } ;
33+ d=${t%/* } ; d=${d/ titles/ titles-generated\/ ${BRANCH} } ;
3434 CMD=" asciidoctor \
3535 --backend=html5 \
3636 --destination-dir $d \
@@ -47,7 +47,7 @@ for t in $(find titles -name master.adoc | sort -uV | grep -E -v "${EXCLUDED_TIT
4747 -a toclevels=5 \
4848 -o index.html \
4949 $t " ;
50- echo -e -n " \nBuilding $t into $d ...\n " ;
50+ echo -e -n " \nBuilding $t into $d ...\n " ;
5151 echo " ${CMD} " | sed -r -e " s/\ +/ \\\\ \n /g"
5252 $CMD
5353 # shellcheck disable=SC2013
@@ -67,14 +67,14 @@ if [[ $BRANCH == "pr-"* ]]; then
6767 # fetch the existing https://redhat-developer.github.io/red-hat-developers-documentation-rhdh/index.html to add prs and branches
6868 curl -sSL https://redhat-developer.github.io/red-hat-developers-documentation-rhdh/pulls.html -o titles-generated/pulls.html
6969 if [[ -z $( grep " ./${BRANCH} /index.html" titles-generated/pulls.html) ]]; then
70- echo " Building root index for $BRANCH in titles-generated/pulls.html ..." ;
70+ echo " Building root index for $BRANCH in titles-generated/pulls.html ..." ;
7171 echo " <li><a href=./${BRANCH} /index.html>${BRANCH} </a></li>" >> titles-generated/pulls.html
7272 fi
73- else
73+ else
7474 # fetch the existing https://redhat-developer.github.io/red-hat-developers-documentation-rhdh/index.html to add prs and branches
7575 curl -sSL https://redhat-developer.github.io/red-hat-developers-documentation-rhdh/index.html -o titles-generated/index.html
7676 if [[ -z $( grep " ./${BRANCH} /index.html" titles-generated/index.html) ]]; then
77- echo " Building root index for $BRANCH in titles-generated/index.html ..." ;
77+ echo " Building root index for $BRANCH in titles-generated/index.html ..." ;
7878 echo " <li><a href=./${BRANCH} /index.html>${BRANCH} </a></li>" >> titles-generated/index.html
7979 fi
8080fi
0 commit comments