File: patch-in-version-selector.sh

package info (click to toggle)
tango 10.0.2%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 89,936 kB
  • sloc: cpp: 201,786; sh: 1,645; python: 953; java: 800; perl: 467; javascript: 447; xml: 325; makefile: 272; sql: 72; ruby: 24
file content (28 lines) | stat: -rwxr-xr-x 935 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/env bash

# Adapted from https://oleksandrkvl.github.io/2024/06/05/multi-version-doxygen.html#multi-version-docs
#
# This script patches the doxygen output so that it includes a
# version selector to be included in the cppTango documentation website.
# Example:
#
#   make -Cbuild doc
#   mv build/doc_html $CI_COMMIT_TAG
#   ci/docs-site/patch-in-version-selector.sh $CI_COMMIT_TAG

if [ $# -ne 1 ]; then
    echo "usage: $0 <dir>"
    exit 1
fi

dir=$1
version_selector_line='<script type="text/javascript" src="../version_selector_handler.js"></script>'

for f in $(find $dir -name "*.html" -type f); do
    # Add a line to include the script that loads the version selector
    sed -i "/<\/head>/i $version_selector_line" $f

    # Remove the contents of the project number, so that it can be replace by
    # the version selector
    sed -i 's/<span id="projectnumber">.*<\/span>/<span id="projectnumber"\/>/' $f
done