Fixing up wikilinks
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user