Skip to content

Commit 37eed71

Browse files
committed
docs: website panels use single page
1 parent 1028983 commit 37eed71

File tree

6 files changed

+31
-14
lines changed

6 files changed

+31
-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: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,16 @@ 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',
7980
];
8081
const command = args.join(' ');
8182
console.log(`Running command: ${command}`)
@@ -87,22 +88,19 @@ target_compile_features(${sourceBasename} PRIVATE cxx_std_23)
8788
}
8889

8990
// 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}`)
91+
if (!fs.existsSync(mrdocsOutput)) {
92+
console.log(`Documentation file not found in ${mrdocsOutput}`)
9493
console.log('Failed to generate website panel documentation')
9594
process.exit(1)
9695
}
97-
panel.documentation = fs.readFileSync(documentationPath, 'utf8');
96+
panel.documentation = fs.readFileSync(mrdocsOutput, 'utf8');
9897

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

104102
// Delete these temporary files
105-
fs.rmSync(mrdocsOutput, {recursive: true});
103+
fs.unlinkSync(mrdocsOutput);
106104
fs.unlinkSync(cmakeListsPath);
107105

108106
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)