Skip to content

Commit d3901c1

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

File tree

3 files changed

+88
-46
lines changed

3 files changed

+88
-46
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: 29 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 "${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,14 @@ 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 "${sha:-}" ]; then
60+
perl -i -pe "s[{{BASE_URL}}][$base_url]g" html/openmethod/ref_headers.html
61+
if [ -f mrdocs.yml.bak ]; then
62+
mv -f mrdocs.yml.bak mrdocs.yml
63+
echo "Restored original mrdocs.yml"
64+
else
65+
echo "mrdocs.yml.bak not found; skipping restore"
66+
fi
67+
fi
68+
4069
echo "Done"

doc/modules/ROOT/pages/ref_headers.adoc

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,64 @@
77

88
The following headers are sufficient for most basic uses of the library.
99

10-
* xref:#main[`boost/openmethod.hpp`] to define open-methods and overriders using
10+
* xref:#openmethod[`<boost/openmethod.hpp>`] to define open-methods and overriders using
1111
convenient macros.
1212
13-
* xref:#initialize[`boost/openmethod/initialize.hpp`] to initialize the library.
13+
* xref:#initialize[`<boost/openmethod/initialize.hpp>`] to initialize the library.
1414
Typically only included in the translation unit containing `main`.
1515
1616
The following headers make it possible to use standard smart pointers in virtual
1717
parameters:
1818

19-
* xref:#std_shared_ptr[`boost/openmethod/interop/std_shared_ptr.hpp`] to use
19+
* xref:#std_shared_ptr[`<boost/openmethod/interop/std_shared_ptr.hpp>`] to use
2020
`std::shared_ptr` in virtual parameters.
2121
22-
* xref:#std_unique_ptr[`boost/openmethod/interop/std_unique_ptr.hpp`] to use
22+
* xref:#std_unique_ptr[`<boost/openmethod/interop/std_unique_ptr.hpp>`] to use
2323
`std::unique_ptr` in virtual parameters.
2424
25+
## High-level Headers
26+
27+
[#core]
28+
### link:{{BASE_URL}}/include/boost/openmethod/core.hpp[<boost/openmethod/core.hpp>]
29+
30+
Defines the main constructs of the library: methods, overriders and virtual
31+
pointers, and mechanisms to implement them. Does not define any public macros
32+
apart from `BOOST_OPENMETHOD_DEFAULT_REGISTRY`, if it is not defined already.
33+
34+
[#macros]
35+
### link:{{BASE_URL}}/include/boost/openmethod/macros.hpp[<boost/openmethod/macros.hpp>]
36+
37+
Defines the public macros of the library, such as `BOOST_OPENMETHOD`,
38+
`BOOST_OPENMETHOD_CLASSES`, etc.
39+
40+
There is little point in including this header directly, as this has the same
41+
effect as including `boost/openmethod.hpp`, which is shorter.
42+
43+
[#openmethod]
44+
### link:{{BASE_URL}}/include/boost/openmethod.hpp[<boost/openmethod.hpp>]
45+
46+
Includes `core.hpp` and `macros.hpp`.
47+
48+
[#initialize]
49+
### link:{{BASE_URL}}/include/boost/initialize.hpp[<boost/initialize.hpp>]
50+
51+
Provides the cpp:initialize[] and cpp:finalize[] functions. This header is
52+
typically included in the translation unit containing `main`. Translation units
53+
that dynamically load or unload shared libraries may also need to call those
54+
functions.
55+
56+
[#std_shared_ptr]
57+
### link:{{BASE_URL}}/include/boost/openmethod/interop/std_shared_ptr.hpp[<boost/openmethod/interop/std_shared_ptr.hpp>]
58+
59+
Provides a `virtual_traits` specialization that make it possible to use a
60+
`std::shared_ptr` in place of a raw pointer or reference in virtual parameters.
61+
62+
[#std_unique_ptr]
63+
### link:{{BASE_URL}}/include/boost/openmethod/interop/std_unique_ptr.hpp[<boost/openmethod/interop/std_unique_ptr.hpp>]
64+
65+
Provides a `virtual_traits` specialization that make it possible to use a
66+
`std::unique_ptr` in place of a raw pointer or reference in virtual parameters.
67+
2568
*The headers below are for advanced use*.
2669

2770
## Pre-Core Headers
@@ -30,82 +73,52 @@ The following headers can be included before `core.hpp` to define custom
3073
registries and policies, and override the default registry by defining
3174
xref:BOOST_OPENMETHOD_DEFAULT_REGISTRY.adoc[`BOOST_OPENMETHOD_DEFAULT_REGISTRY`].
3275

33-
### boost/openmethod/preamble.hpp
76+
### link:{{BASE_URL}}/include/boost/openmethod/preamble.hpp[<boost/openmethod/preamble.hpp>]
3477

3578
Defines `registry` and stock policy categories. Also defines all types and
3679
functions necessary for the definition of `registry`.
3780

38-
### boost/openmethod/policies/std_rtti.hpp
81+
### link:{{BASE_URL}}/include/boost/openmethod/policies/std_rtti.hpp[<boost/openmethod/policies/std_rtti.hpp>]
3982

4083
Provides an implementation of the `rtti` policy using standard RTTI.
4184

42-
### boost/openmethod/policies/fast_perfect_hash.hpp
85+
### link:{{BASE_URL}}/include/boost/openmethod/policies/fast_perfect_hash.hpp[<boost/openmethod/policies/fast_perfect_hash.hpp>]
4386

4487
Provides an implementation of the `hash` policy using a fast perfect hash
4588
function.
4689

47-
### boost/openmethod/policies/vptr_vector.hpp
90+
### link:{{BASE_URL}}/include/boost/openmethod/policies/vptr_vector.hpp[<boost/openmethod/policies/vptr_vector.hpp>]
4891

4992
Provides an implementation of the `vptr` policy that stores the v-table pointers
5093
in a `std::vector` indexed by type ids, possibly hashed.
5194

52-
### boost/openmethod/policies/default_error_handler.hpp
95+
### link:{{BASE_URL}}/include/boost/openmethod/policies/default_error_handler.hpp[<boost/openmethod/policies/default_error_handler.hpp>]
5396

5497
Provides an implementation of the `error_handler` policy that calls a
5598
`std::function<void(openmethod_error)>` when an error is encountered, and before
5699
the library aborts the program.
57100

58-
### boost/openmethod/policies/stderr_output.hpp
101+
### link:{{BASE_URL}}/include/boost/openmethod/policies/stderr_output.hpp[<boost/openmethod/policies/stderr_output.hpp>]
59102

60103
Provides an implementation of the `output` policy that writes diagnostics to
61104
the C standard error stream (not using iostreams).
62105

63-
### boost/openmethod/default_registry.hpp
106+
### link:{{BASE_URL}}/include/boost/openmethod/default_registry.hpp[<boost/openmethod/default_registry.hpp>]
64107

65108
Defines the default registry, which contains all the stock policies listed
66-
above. Includes all the headers listed in the preamble section so far.
109+
above. Includes all the headers listed in this section so far.
67110

68-
### boost/openmethod/policies/static_rtti.hpp
111+
### link:{{BASE_URL}}/include/boost/openmethod/policies/static_rtti.hpp[<boost/openmethod/policies/static_rtti.hpp>]
69112

70113
Provides a minimal implementation of the `rtti` policy that does not depend on
71114
standard RTTI.
72115

73-
### boost/openmethod/policies/throw_error_handler.hpp
116+
### link:{{BASE_URL}}/include/boost/openmethod/policies/throw_error_handler.hpp[<boost/openmethod/policies/throw_error_handler.hpp>]
74117

75118
Provides an implementation of the `error_handler` policy that throws errors as
76119
exceptions.
77120

78-
### boost/openmethod/policies/vptr_map.hpp
121+
### link:{{BASE_URL}}/include/boost/openmethod/policies/vptr_map.hpp[<boost/openmethod/policies/vptr_map.hpp>]
79122

80123
Provides an implementation of the `vptr` policy that stores the v-table pointers
81124
in a map (by default a `std::map`) indexed by type ids.
82-
83-
## High-level Headers
84-
85-
### boost/openmethod/core.hpp
86-
87-
Defines the main constructs of the library: methods, overriders and virtual
88-
pointers, and mechanisms to implement them. Does not define any public macros
89-
apart from `BOOST_OPENMETHOD_DEFAULT_REGISTRY`, if it is not defined already.
90-
91-
### boost/openmethod/macros.hpp
92-
93-
Defines the public macros of the library, such as `BOOST_OPENMETHOD`,
94-
`BOOST_OPENMETHOD_CLASSES`, etc.
95-
96-
There is little point in including this header directly, as this has the same
97-
effect as including `boost/openmethod.hpp`, which is shorter.
98-
99-
### boost/openmethod.hpp
100-
101-
Includes `core.hpp` and `macros.hpp`.
102-
103-
### boost/openmethod/interop/std_shared_ptr.hpp
104-
105-
Provides a `virtual_traits` specialization that make it possible to use a
106-
`std::shared_ptr` in place of a raw pointer or reference in virtual parameters.
107-
108-
### boost/openmethod/interop/std_unique_ptr.hpp
109-
110-
Provides a `virtual_traits` specialization that make it possible to use a
111-
`std::unique_ptr` in place of a raw pointer or reference in virtual parameters.

0 commit comments

Comments
 (0)