Skip to content

Commit

Permalink
Lint + hacky solution to the single surly braces
Browse files Browse the repository at this point in the history
  • Loading branch information
Not-Abram committed Oct 25, 2024
1 parent 47748c6 commit 68afa7f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/viewer/src/components/Shared/SeMarkdown.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { Ref } from "@pi-base/core";
import { Ref } from '@pi-base/core'
export let source: string
const modify = (s: string) => {
const singlecurly = /{(?<type>[SPT])(?<id>\d+)}/g
Expand All @@ -10,21 +10,24 @@
s = s.replace(doublecurlies, (_, prefix, id) => {
// Perform replacement based on prefix and id
const ref = Ref.format({
"kind": prefix,
"id": id,
kind: prefix,
id: id,
})
return `[${ref.title}](${ref.href})`
})
// Replace single curly braces
/*s = s.replace(singlecurly, (type, id) => {
/*s = s.replace(singlecurly, (_, type, id) => {
// Perform replacement based on type and id
return `${type}, ${id}`
if (type.equals("S")) {
return `[https://topology.pi-base.org/spaces/${type}${id}]()`
} else if (type.equals("P")) {
return `[https://topology.pi-base.org/properties/${type}${id}]()`
} else {
return `[https://topology.pi-base.org/theorems/${type}${id}]()`
}
})*/
return s
}
</script>
Expand Down

0 comments on commit 68afa7f

Please sign in to comment.