Skip to content

Commit b609333

Browse files
committed
Added the doxygen-custom-page-injector.js and implemented the basic loading of a page
1 parent 6776992 commit b609333

4 files changed

Lines changed: 347 additions & 2 deletions

File tree

doxygen/Doxyfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ FILE_VERSION_FILTER =
815815
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
816816
# tag is left empty.
817817

818-
LAYOUT_FILE =
818+
LAYOUT_FILE = customization/DoxygenLayout.xml
819819

820820
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
821821
# the reference definitions. This must be a list of .bib files. The .bib
@@ -1411,7 +1411,9 @@ HTML_EXTRA_FILES = assets/github-mark-white.svg \
14111411
js/doxygen-awesome-fragment-copy-button.js \
14121412
js/doxygen-awesome-interactive-toc.js \
14131413
assets/github-mark.svg \
1414-
assets/favicon.png
1414+
assets/favicon.png \
1415+
html/about.html \
1416+
js/doxygen-custom-page-injector.js
14151417

14161418
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
14171419
# should be rendered with a dark or light theme.
Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<doxygenlayout version="1.0">
3+
<!-- Generated by doxygen 1.9.8 -->
4+
<!-- Navigation index tabs for HTML output -->
5+
<navindex>
6+
<tab type="mainpage" visible="yes" title=""/>
7+
<tab type="pages" visible="yes" title="" intro=""/>
8+
<tab type="topics" visible="yes" title="" intro=""/>
9+
<tab type="modules" visible="yes" title="" intro="">
10+
<tab type="modulelist" visible="yes" title="" intro=""/>
11+
<tab type="modulemembers" visible="yes" title="" intro=""/>
12+
</tab>
13+
<tab type="namespaces" visible="yes" title="">
14+
<tab type="namespacelist" visible="yes" title="" intro=""/>
15+
<tab type="namespacemembers" visible="yes" title="" intro=""/>
16+
</tab>
17+
<tab type="concepts" visible="yes" title="">
18+
</tab>
19+
<tab type="interfaces" visible="yes" title="">
20+
<tab type="interfacelist" visible="yes" title="" intro=""/>
21+
<tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/>
22+
<tab type="interfacehierarchy" visible="yes" title="" intro=""/>
23+
</tab>
24+
<tab type="classes" visible="yes" title="">
25+
<tab type="classlist" visible="yes" title="" intro=""/>
26+
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
27+
<tab type="hierarchy" visible="yes" title="" intro=""/>
28+
<tab type="classmembers" visible="yes" title="" intro=""/>
29+
</tab>
30+
<tab type="structs" visible="yes" title="">
31+
<tab type="structlist" visible="yes" title="" intro=""/>
32+
<tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/>
33+
</tab>
34+
<tab type="exceptions" visible="yes" title="">
35+
<tab type="exceptionlist" visible="yes" title="" intro=""/>
36+
<tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/>
37+
<tab type="exceptionhierarchy" visible="yes" title="" intro=""/>
38+
</tab>
39+
<tab type="files" visible="no" title="">
40+
<tab type="filelist" visible="no" title="" intro=""/>
41+
<tab type="globals" visible="no" title="" intro=""/>
42+
</tab>
43+
<tab type="examples" visible="yes" title="" intro=""/>
44+
<!-- Custom Pages -->
45+
<tab id="test" type="user" url="about.html" title="About"/>
46+
</navindex>
47+
48+
<!-- Layout definition for a class page -->
49+
<class>
50+
<briefdescription visible="yes"/>
51+
<includes visible="$SHOW_HEADERFILE"/>
52+
<inheritancegraph visible="$CLASS_GRAPH"/>
53+
<collaborationgraph visible="yes"/>
54+
<memberdecl>
55+
<nestedclasses visible="yes" title=""/>
56+
<publictypes title=""/>
57+
<services title=""/>
58+
<interfaces title=""/>
59+
<publicslots title=""/>
60+
<signals title=""/>
61+
<publicmethods title=""/>
62+
<publicstaticmethods title=""/>
63+
<publicattributes title=""/>
64+
<publicstaticattributes title=""/>
65+
<protectedtypes title=""/>
66+
<protectedslots title=""/>
67+
<protectedmethods title=""/>
68+
<protectedstaticmethods title=""/>
69+
<protectedattributes title=""/>
70+
<protectedstaticattributes title=""/>
71+
<packagetypes title=""/>
72+
<packagemethods title=""/>
73+
<packagestaticmethods title=""/>
74+
<packageattributes title=""/>
75+
<packagestaticattributes title=""/>
76+
<properties title=""/>
77+
<events title=""/>
78+
<privatetypes title=""/>
79+
<privateslots title=""/>
80+
<privatemethods title=""/>
81+
<privatestaticmethods title=""/>
82+
<privateattributes title=""/>
83+
<privatestaticattributes title=""/>
84+
<friends title=""/>
85+
<related title="" subtitle=""/>
86+
<membergroups visible="yes"/>
87+
</memberdecl>
88+
<detaileddescription title=""/>
89+
<memberdef>
90+
<inlineclasses title=""/>
91+
<typedefs title=""/>
92+
<enums title=""/>
93+
<services title=""/>
94+
<interfaces title=""/>
95+
<constructors title=""/>
96+
<functions title=""/>
97+
<related title=""/>
98+
<variables title=""/>
99+
<properties title=""/>
100+
<events title=""/>
101+
</memberdef>
102+
<allmemberslink visible="yes"/>
103+
<usedfiles visible="$SHOW_USED_FILES"/>
104+
<authorsection visible="yes"/>
105+
</class>
106+
107+
<!-- Layout definition for a namespace page -->
108+
<namespace>
109+
<briefdescription visible="yes"/>
110+
<memberdecl>
111+
<nestednamespaces visible="yes" title=""/>
112+
<constantgroups visible="yes" title=""/>
113+
<interfaces visible="yes" title=""/>
114+
<classes visible="yes" title=""/>
115+
<concepts visible="yes" title=""/>
116+
<structs visible="yes" title=""/>
117+
<exceptions visible="yes" title=""/>
118+
<typedefs title=""/>
119+
<sequences title=""/>
120+
<dictionaries title=""/>
121+
<enums title=""/>
122+
<functions title=""/>
123+
<variables title=""/>
124+
<membergroups visible="yes"/>
125+
</memberdecl>
126+
<detaileddescription title=""/>
127+
<memberdef>
128+
<inlineclasses title=""/>
129+
<typedefs title=""/>
130+
<sequences title=""/>
131+
<dictionaries title=""/>
132+
<enums title=""/>
133+
<functions title=""/>
134+
<variables title=""/>
135+
</memberdef>
136+
<authorsection visible="yes"/>
137+
</namespace>
138+
139+
<!-- Layout definition for a concept page -->
140+
<concept>
141+
<briefdescription visible="yes"/>
142+
<includes visible="$SHOW_HEADERFILE"/>
143+
<definition visible="yes" title=""/>
144+
<detaileddescription title=""/>
145+
<authorsection visible="yes"/>
146+
</concept>
147+
148+
<!-- Layout definition for a file page -->
149+
<file>
150+
<briefdescription visible="yes"/>
151+
<includes visible="$SHOW_INCLUDE_FILES"/>
152+
<includegraph visible="yes"/>
153+
<includedbygraph visible="yes"/>
154+
<sourcelink visible="yes"/>
155+
<memberdecl>
156+
<interfaces visible="yes" title=""/>
157+
<classes visible="yes" title=""/>
158+
<structs visible="yes" title=""/>
159+
<exceptions visible="yes" title=""/>
160+
<namespaces visible="yes" title=""/>
161+
<concepts visible="yes" title=""/>
162+
<constantgroups visible="yes" title=""/>
163+
<defines title=""/>
164+
<typedefs title=""/>
165+
<sequences title=""/>
166+
<dictionaries title=""/>
167+
<enums title=""/>
168+
<functions title=""/>
169+
<variables title=""/>
170+
<membergroups visible="yes"/>
171+
</memberdecl>
172+
<detaileddescription title=""/>
173+
<memberdef>
174+
<inlineclasses title=""/>
175+
<defines title=""/>
176+
<typedefs title=""/>
177+
<sequences title=""/>
178+
<dictionaries title=""/>
179+
<enums title=""/>
180+
<functions title=""/>
181+
<variables title=""/>
182+
</memberdef>
183+
<authorsection/>
184+
</file>
185+
186+
<!-- Layout definition for a group page -->
187+
<group>
188+
<briefdescription visible="yes"/>
189+
<groupgraph visible="yes"/>
190+
<memberdecl>
191+
<nestedgroups visible="yes" title=""/>
192+
<modules visible="yes" title=""/>
193+
<dirs visible="yes" title=""/>
194+
<files visible="yes" title=""/>
195+
<namespaces visible="yes" title=""/>
196+
<concepts visible="yes" title=""/>
197+
<classes visible="yes" title=""/>
198+
<defines title=""/>
199+
<typedefs title=""/>
200+
<sequences title=""/>
201+
<dictionaries title=""/>
202+
<enums title=""/>
203+
<enumvalues title=""/>
204+
<functions title=""/>
205+
<variables title=""/>
206+
<signals title=""/>
207+
<publicslots title=""/>
208+
<protectedslots title=""/>
209+
<privateslots title=""/>
210+
<events title=""/>
211+
<properties title=""/>
212+
<friends title=""/>
213+
<membergroups visible="yes"/>
214+
</memberdecl>
215+
<detaileddescription title=""/>
216+
<memberdef>
217+
<pagedocs/>
218+
<inlineclasses title=""/>
219+
<defines title=""/>
220+
<typedefs title=""/>
221+
<sequences title=""/>
222+
<dictionaries title=""/>
223+
<enums title=""/>
224+
<enumvalues title=""/>
225+
<functions title=""/>
226+
<variables title=""/>
227+
<signals title=""/>
228+
<publicslots title=""/>
229+
<protectedslots title=""/>
230+
<privateslots title=""/>
231+
<events title=""/>
232+
<properties title=""/>
233+
<friends title=""/>
234+
</memberdef>
235+
<authorsection visible="yes"/>
236+
</group>
237+
238+
<!-- Layout definition for a C++20 module page -->
239+
<module>
240+
<briefdescription visible="yes"/>
241+
<exportedmodules visible="yes"/>
242+
<memberdecl>
243+
<concepts visible="yes" title=""/>
244+
<classes visible="yes" title=""/>
245+
<enums title=""/>
246+
<typedefs title=""/>
247+
<functions title=""/>
248+
<variables title=""/>
249+
<membergroups title=""/>
250+
</memberdecl>
251+
<detaileddescription title=""/>
252+
<memberdecl>
253+
<files visible="yes"/>
254+
</memberdecl>
255+
</module>
256+
257+
<!-- Layout definition for a directory page -->
258+
<directory>
259+
<briefdescription visible="yes"/>
260+
<directorygraph visible="yes"/>
261+
<memberdecl>
262+
<dirs visible="yes"/>
263+
<files visible="yes"/>
264+
</memberdecl>
265+
<detaileddescription title=""/>
266+
</directory>
267+
</doxygenlayout>

doxygen/html/about.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script type="text/javascript" src="./doxygen-custom-page-injector.js"></script>
2+
3+
<div id="injection-wrapper" nav-to="about.html" style="display: none;">
4+
<p>Sample Text</p>
5+
</div>
6+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//--------------------------------------------------//
2+
// Created by basicx-StrgV //
3+
// https://github.com/basicx-StrgV/ //
4+
//--------------------------------------------------//
5+
document.addEventListener("DOMContentLoaded", () => {
6+
// Get the injection wrapper element and nav to value
7+
let injectionWrapper = document.getElementById("injection-wrapper");
8+
let navToValue = injectionWrapper.getAttribute("nav-to");
9+
10+
// Exit if there is no injection wrapper element and display error message
11+
if (injectionWrapper == null) {
12+
document.body.innerHTML = "";
13+
document.body.innerText = "Failed to load custom page";
14+
return;
15+
}
16+
17+
// Get url for index page
18+
let url = window.location.origin + "/index.html";
19+
20+
// Request html content from the index page
21+
const htmlReq = new XMLHttpRequest();
22+
htmlReq.open("GET", url);
23+
htmlReq.addEventListener("load", () => {
24+
// Open document
25+
document.open();
26+
27+
// Proceed if the new document is loaded
28+
document.addEventListener("DOMContentLoaded", () => {
29+
// Check if a value for nav to is provided
30+
if (navToValue != null) {
31+
// Wrap the original navTo function from doxygen into custom function
32+
let originalNavToFunc = navTo;
33+
navTo = (o, root, hash, relpath) => {
34+
// Ignore the root value and parse or nav to value instead
35+
originalNavToFunc(o, navToValue, hash, relpath);
36+
};
37+
}
38+
39+
// Get the div that contains the content
40+
let containerChildren = document.getElementById("doc-content").children;
41+
let contentDiv;
42+
for (let i = 0; i < containerChildren.length; i++) {
43+
if (
44+
containerChildren[i].classList.length <= 0 &&
45+
containerChildren[i].id.trim() == ""
46+
) {
47+
// The content div has no classes or id
48+
contentDiv = containerChildren[i];
49+
}
50+
}
51+
52+
// Exit if no content div was found and display error message
53+
if (contentDiv == null) {
54+
document.body.innerHTML = "";
55+
document.body.innerText = "Failed to load custom page";
56+
return;
57+
}
58+
59+
// Replace document content
60+
contentDiv.innerHTML = injectionWrapper.innerHTML;
61+
});
62+
63+
// Replace and close document
64+
document.write(htmlReq.responseText);
65+
document.close();
66+
});
67+
68+
// Sent request
69+
htmlReq.send();
70+
});

0 commit comments

Comments
 (0)