Skip to content

Commit

Permalink
fix: version replacement improvement (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
petertonysmith94 authored Apr 9, 2024
1 parent 95ab2d2 commit a14afa5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/lib/plugins/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const conditions = {
tsBookVersions: (node: any) => {
return (
typeof node.value === 'string' &&
(node.value === 'v{{fuels}}' ||
node.value === 'v{{fuelCore}}' ||
node.value === 'v{{forc}}')
(node.value.includes('{{fuels}}') ||
node.value.includes('{{fuelCore}}') ||
node.value.includes('{{forc}}'))
);
},
// biome-ignore lint/suspicious/noExplicitAny:
Expand Down Expand Up @@ -256,14 +256,13 @@ function handleTSDocs(
const newUrl = handleLinks(node, dirname, idx, parent, newTree);
if (newUrl) node.url = newUrl;
} else if (conditions.tsBookVersions(node)) {
if (node.value === 'v{{forc}}') {
node.value = versions.FORC;
} else if (node.value === 'v{{fuels}}') {
node.value = versions.FUELS;
} else {
node.value = versions.FUEL_CORE;
if (typeof node.value === 'string') {
node.value = node.value
.replaceAll('{{fuels}}', versions.FUELS)
.replaceAll('{{fuelCore}}', versions.FUEL_CORE)
.replaceAll('{{forc}}', versions.FORC);
}
} else if (node.type === 'code' && node.lang === 'ts:line-numbers'){
} else if (node.type === 'code' && node.lang === 'ts:line-numbers') {
node.lang = 'ts';
} else {
node.lang = 'sh';
Expand Down

0 comments on commit a14afa5

Please sign in to comment.