Skip to content

Commit 67fc569

Browse files
committed
docs: website panels use single page
1 parent 1dbc4bf commit 67fc569

File tree

6 files changed

+32
-14
lines changed

6 files changed

+32
-14
lines changed

docs/mrdocs.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@
395395
"type": "array"
396396
},
397397
"tagfile": {
398-
"default": "<output>/reference.tag.xml",
398+
"default": "<output-dir>/reference.tag.xml",
399399
"description": "Specifies the full path (filename) where the generated tagfile should be saved. If left empty, no tagfile will be generated.",
400400
"title": "Path for the tagfile",
401401
"type": "string"

docs/website/render.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,17 @@ target_compile_features(${sourceBasename} PRIVATE cxx_std_23)
6767
// Run mrdocs to generate documentation
6868
const mrdocsConfig = path.join(absSnippetsDir, 'mrdocs.yml')
6969
const mrdocsInput = cmakeListsPath
70-
const mrdocsOutput = path.join(absSnippetsDir, 'output')
70+
const mrdocsOutput = path.join(absSnippetsDir, 'output', 'reference.html')
7171
const args = [
7272
mrdocsExecutable,
7373
`--config=${mrdocsConfig}`,
7474
mrdocsInput,
7575
`--output=${mrdocsOutput}`,
76-
'--multipage=true',
76+
'--multipage=false',
7777
'--generator=html',
7878
'--embedded=true',
79+
'--show-namespaces=false',
80+
'--tagfile=',
7981
];
8082
const command = args.join(' ');
8183
console.log(`Running command: ${command}`)
@@ -87,22 +89,19 @@ target_compile_features(${sourceBasename} PRIVATE cxx_std_23)
8789
}
8890

8991
// Look load symbol page in the output directory
90-
const documentationFilename = `${sourceBasename}.html`
91-
const documentationPath = path.join(mrdocsOutput, documentationFilename)
92-
if (!fs.existsSync(documentationPath)) {
93-
console.log(`Documentation file ${documentationFilename} not found in ${mrdocsOutput}`)
92+
if (!fs.existsSync(mrdocsOutput)) {
93+
console.log(`Documentation file not found in ${mrdocsOutput}`)
9494
console.log('Failed to generate website panel documentation')
9595
process.exit(1)
9696
}
97-
panel.documentation = fs.readFileSync(documentationPath, 'utf8');
97+
panel.documentation = fs.readFileSync(mrdocsOutput, 'utf8');
9898

9999
// Also inject the contents of the source file as highlighted C++
100100
const snippetContents = fs.readFileSync(sourcePath, 'utf8');
101-
const highlightedSnippet = hljs.highlight(snippetContents, {language: 'cpp'}).value;
102-
panel.snippet = highlightedSnippet;
101+
panel.snippet = hljs.highlight(snippetContents, {language: 'cpp'}).value;
103102

104103
// Delete these temporary files
105-
fs.rmSync(mrdocsOutput, {recursive: true});
104+
fs.unlinkSync(mrdocsOutput);
106105
fs.unlinkSync(cmakeListsPath);
107106

108107
console.log(`Documentation generated successfully for panel ${panel.source}`)

docs/website/snippets/mrdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
source-root: .
22
input:
33
- .
4+
show-namespaces: false
5+
multipage: false

src/lib/Lib/Config.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,23 @@ struct PublicSettingsVisitor {
427427
std::string_view valueSv(value);
428428
if (!value.empty())
429429
{
430-
res = files::getParentDir(value);
430+
bool const valueIsDir =
431+
[&value]() {
432+
if (files::exists(value))
433+
{
434+
return files::isDirectory(value);
435+
}
436+
std::string_view const filename = files::getFileName(value);
437+
return filename.find('.') == std::string::npos;
438+
}();
439+
if (valueIsDir)
440+
{
441+
res = value;
442+
}
443+
else
444+
{
445+
res = files::getParentDir(value);
446+
}
431447
found = true;
432448
return;
433449
}

src/lib/Lib/ConfigOptions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@
300300
"brief": "Path for the tagfile",
301301
"details": "Specifies the full path (filename) where the generated tagfile should be saved. If left empty, no tagfile will be generated.",
302302
"type": "file-path",
303-
"default": "<output>/reference.tag.xml",
304-
"relative-to": "<output>",
303+
"default": "<output-dir>/reference.tag.xml",
304+
"relative-to": "<output-dir>",
305305
"must-exist": false,
306306
"should-exist": false
307307
},

util/generate-config-info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def validate_and_normalize_option(option, flat_options):
170170
# If option is unique directory option of some form
171171
if flat_option['type'] in ['path', 'dir-path', 'file-path']:
172172
reference_directories.append(f'<{flat_option["name"]}>')
173+
reference_directories.append(f'<{flat_option["name"]}-dir>')
173174
if option['relative-to'] not in reference_directories:
174175
raise ValueError(f'Option "{option["name"]}" has an invalid value for "relative-to"')
175176
default_paths = option['default']

0 commit comments

Comments
 (0)