Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions docs/extensions/mrdocs-demos.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ function humanizeLibrary(library) {
if (library === 'boost-url') {
return 'Boost.URL';
}
if (library === 'mrdocs') {
return 'Mr.Docs';
}
if (library === 'beman-optional')
{
return 'Beman.Optional';
}
const boostLibrary = library.match(/boost-([\w]+)/);
if (boostLibrary) {
const capitalized = boostLibrary[1].charAt(0).toUpperCase() + boostLibrary[1].slice(1);
Expand Down Expand Up @@ -181,6 +188,7 @@ module.exports = function (registry) {
text += `**${version}**\n\n`;
text += `|===\n`;

// Collect all unique page types, formats, and libraries for this version
let versionPageTypes = [];
let versionFormats = [];
let versionLibraries = [];
Expand All @@ -199,9 +207,29 @@ module.exports = function (registry) {
}
}

// Remove Rendered Asciidoc from the list of formats
let multipageFormats = versionFormats.filter(format => format !== 'xml');
// Sort versionPageTypes so that multipage always comes first
versionPageTypes.sort((a, b) => {
if (a === 'multi' && b !== 'multi') return -1;
if (a !== 'multi' && b === 'multi') return 1;
return a.localeCompare(b);
});

// Sort versionFormats to have adoc, html, xml first
versionFormats.sort((a, b) => {
const order = ['adoc-asciidoc', 'adoc', 'html', 'xml'];
const aIndex = order.indexOf(a);
const bIndex = order.indexOf(b);
if (aIndex === -1 && bIndex === -1) return a.localeCompare(b);
if (aIndex === -1) return 1;
if (bIndex === -1) return -1;
return aIndex - bIndex;
});

// Sort versionLibraries alphabetically
versionLibraries.sort((a, b) => humanizeLibrary(a).localeCompare(humanizeLibrary(b)));

// Ensure XML is never in the multipage formats
let multipageFormats = versionFormats.filter(format => format !== 'xml');
let versionFormatColumns = versionFormats.map(format => `*${humanizeFormat(format)}*`).join(' | ');
let multipageFormatColumns = multipageFormats.map(format => `*${humanizeFormat(format)}*`).join(' | ');

Expand Down Expand Up @@ -236,7 +264,7 @@ module.exports = function (registry) {
return '/reference.adoc'
}
}
if (format === 'html')
if (format === 'html' || format === 'adoc-asciidoc')
{
if (pageType === 'multi')
{
Expand All @@ -250,10 +278,10 @@ module.exports = function (registry) {
})()
if (['adoc', 'xml', 'html', 'adoc-asciidoc'].includes(format)) {
const formatIcons = {
adoc: 'https://avatars.githubusercontent.com/u/3137042?s=200&v=4',
html: 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/6.x/svgs/brands/html5.svg',
'adoc-asciidoc': 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/refs/heads/6.x/svgs/brands/html5.svg',
default: 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/6.x/svgs/solid/file-code.svg'
adoc: 'https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/asciidoc.svg',
html: 'https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/html5.svg',
'adoc-asciidoc': 'https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/html5.svg',
default: 'https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/code_blocks.svg'
};
const icon = formatIcons[format] || formatIcons.default;
text += `| image:${icon}[${humanizeLibrary(library)} reference in ${humanizeFormat(format)} format,width=16,height=16,link=${demoUrlWithSuffix},window=_blank]`
Expand Down
9 changes: 7 additions & 2 deletions docs/extensions/mrdocs-releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,14 @@ module.exports = function (registry) {
const releases = JSON.parse(releasesResponse)

// Create table
const apple_icon = `image:https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/apple.svg[Apple Releases,width=16,height=16]`
const linux_icon = `image:https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/linux.svg[Linux Releases,width=16,height=16]`
const windows_icon = `image:https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/windows.svg[Windows Releases,width=16,height=16]`
const package_icon = `image:https://raw.githubusercontent.com/cppalliance/mrdocs/refs/heads/develop/docs/modules/ROOT/images/icons/package.svg[Package,width=16,height=16]`

let text = '|===\n'
text += '| 3+| 🪟 Windows 2+| 🐧 Linux 2+| 🍏 macOS \n'
text += '| 📃 Release | 📦 7z | 📦 msi | 📦 zip | 📦 tar.xz | 📦 tar.gz | 📦 tar.xz | 📦 tar.gz \n'
text += `| 3+| ${windows_icon} Windows 2+| ${linux_icon} Linux 2+| ${apple_icon} macOS \n`
text += `| Release | ${package_icon} 7z | ${package_icon} msi | ${package_icon} zip | ${package_icon} tar.xz | ${package_icon} tar.gz | ${package_icon} tar.xz | ${package_icon} tar.gz \n`
releases.sort((a, b) => getReleaseDate(b) - getReleaseDate(a));
for (const release of releases) {
if (release.name === 'llvm-package') continue
Expand Down
Loading