Fixing up wikilinks

This commit is contained in:
2025-10-13 18:36:05 +01:00
parent 9bc2557ff2
commit 7c4d93d7ba
3 changed files with 16 additions and 4 deletions

View File

@@ -86,6 +86,16 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
return '0x' + h.slice(2).toUpperCase();
};
const makeWikiLink = (hex: string, name: string): string => {
let link = `https://wiki.specnext.dev/`;
switch (hex) {
default:
link += `${name.replace(/ /g, "_")}_Register`;
}
return link;
}
const createRegister = (hex: string, dec: string | number, regName: string): Register => {
const reg: Register = {
@@ -102,7 +112,7 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
notes: [],
};
// Dispatch to appropriate parser based on hex
// Dispatch to the appropriate parser based on hex
const hexKey = normalizeHex(hex);
switch (hexKey) {
case '0xF0':
@@ -113,6 +123,8 @@ export function processRegisterBlock(paragraph: string, registers: Register[]) {
break;
}
reg.wiki_link = makeWikiLink(hexKey, reg.name);
return reg;
};