Skip to content

Commit 52fa713

Browse files
committed
build_antora.sh: patch base-url with permalink
1 parent 83bc8d2 commit 52fa713

14 files changed

+100
-57
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,5 @@ jobs:
123123
path: doc/html
124124

125125
- name: Deploy to GitHub Pages (jll63)
126-
if: matrix.os == 'ubuntu-latest' && github.repository_owner == 'jll63' && github.ref_name == 'feature/doc'
126+
if: matrix.os == 'ubuntu-latest' && github.repository_owner == 'jll63'
127127
uses: actions/deploy-pages@v4

doc/build_antora.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
set -e
1313

14+
1415
if [ $# -eq 0 ]
1516
then
1617
echo "No playbook supplied, using default playbook"
@@ -22,6 +23,24 @@ fi
2223
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
2324
cd "$SCRIPT_DIR"
2425

26+
if [ -n "${CIRCLE_REPOSITORY_URL:-}" ]; then
27+
account="${CIRCLE_REPOSITORY_URL#*:}"
28+
account="${account%%/*}"
29+
lib=$(basename "$(git rev-parse --show-toplevel)")
30+
repository="${account}/$lib"
31+
sha=${CIRCLE_SHA1}
32+
elif [ -n "${GITHUB_REPOSITORY:-}" ]; then
33+
repository="${GITHUB_REPOSITORY}"
34+
sha=${GITHUB_SHA}
35+
fi
36+
37+
if [ -n "${repository}" ] && [ -n "${sha}" ]; then
38+
base_url="https://github.com/${repository}/blob/${sha}"
39+
echo "Setting base-url to $base_url"
40+
cp mrdocs.yml mrdocs.yml.bak
41+
perl -i -pe 's{^\s*base-url:.*$}{base-url: '"$base_url/"'}' mrdocs.yml
42+
fi
43+
2544
echo "Building documentation with Antora..."
2645
echo "Installing npm dependencies..."
2746
npm ci
@@ -37,4 +56,15 @@ for f in $(find html -name '*.html'); do
3756
perl -i -pe 's{&lcub;&lcub;(.*?)&rcub;&rcub;}{<a href="../../../$1.html">$1</a>}g' "$f"
3857
done
3958

59+
if [ -n "${base_url:-}" ]; then
60+
if [ -f mrdocs.yml.bak ]; then
61+
mv -f mrdocs.yml.bak mrdocs.yml
62+
echo "Restored original mrdocs.yml"
63+
else
64+
echo "mrdocs.yml.bak not found; skipping restore"
65+
fi
66+
perl -i -pe "s[{{BASE_URL}}][$base_url]g" \
67+
html/openmethod/ref_headers.html html/openmethod/BOOST_OPENMETHOD*.html
68+
fi
69+
4070
echo "Done"

doc/modules/ROOT/pages/BOOST_OPENMETHOD.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Synopsis
55

6-
Defined in <boost/openmethod/macros.hpp>.
6+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
77

88
```c++
99
BOOST_OPENMETHOD(ID, (PARAMETERS...), RETURN_TYPE [, REGISTRY]);

doc/modules/ROOT/pages/BOOST_OPENMETHOD_CLASSES.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
### Synopsis
77

8-
Defined in <boost/openmethod/macros.hpp>.
8+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
99

1010
```c++
1111
BOOST_OPENMETHOD_CLASSES(CLASSES...[, REGISTRY]);

doc/modules/ROOT/pages/BOOST_OPENMETHOD_DECLARE_OVERRIDER.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Synopsis
55

6-
Defined in <boost/openmethod/macros.hpp>.
6+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
77

88
```c++
99
#define BOOST_OPENMETHOD_DECLARE_OVERRIDER(NAME, (PARAMETERS...), RETURN_TYPE)

doc/modules/ROOT/pages/BOOST_OPENMETHOD_DEFINE_OVERRIDER.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Synopsis
55

6-
Defined in <boost/openmethod/macros.hpp>.
6+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
77

88
```c++
99
#define BOOST_OPENMETHOD_DEFINE_OVERRIDER(ID, (PARAMETERS...), RETURN_TYPE)

doc/modules/ROOT/pages/BOOST_OPENMETHOD_ID.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
### Synopsis
77

8-
Defined in <boost/openmethod/macros.hpp>.
8+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
99

1010
```c++
1111
#define BOOST_OPENMETHOD_ID(ID) /* unspecified */

doc/modules/ROOT/pages/BOOST_OPENMETHOD_INLINE_OVERRIDE.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
### Synopsis
77

8-
Defined in <boost/openmethod/macros.hpp>.
8+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
99

1010
```c++
1111
BOOST_OPENMETHOD_INLINE_OVERRIDE(ID, (PARAMETERS...), RETURN_TYPE) {

doc/modules/ROOT/pages/BOOST_OPENMETHOD_OVERRIDE.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
### Synopsis
77

8-
Defined in <boost/openmethod/macros.hpp>.
8+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
99

1010
```c++
1111
BOOST_OPENMETHOD_OVERRIDE(ID, (PARAMETERS...), RETURN_TYPE) {

doc/modules/ROOT/pages/BOOST_OPENMETHOD_OVERRIDER.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
### Synopsis
55

6-
Defined in <boost/openmethod/macros.hpp>.
6+
Defined in link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>].
77

88
```c++
99
#define BOOST_OPENMETHOD_OVERRIDER(ID, (PARAMETERS...), RETURN_TYPE)

0 commit comments

Comments
 (0)