-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replacing svelte-router based routing. This commit makes a minimal set of changes required to get things functional. We'll follow up with other changes to move things around, make them more idiomatically sveltekit, and start leveraging some of its features a little better.
- Loading branch information
1 parent
22091b9
commit adc4dda
Showing
76 changed files
with
1,026 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Root } from 'mdast' | ||
import { Transformer } from 'unified' | ||
|
||
type Opts = { | ||
disable?: boolean | ||
ellipses?: string | ||
maxChars?: number | ||
ignoreTags?: string[] | ||
} | ||
|
||
// Adapted from https://github.com/luk707/rehype-truncate | ||
export function truncate({ | ||
disable = false, | ||
ellipses = '\u2026', | ||
ignoreTags = [], | ||
maxChars = 120, | ||
}: Opts = {}): Transformer<Root, Root> { | ||
return truncator | ||
|
||
function truncator(tree: Root) { | ||
if (!disable) { | ||
truncateNode(tree) | ||
} | ||
} | ||
|
||
function truncateNode(node: any, tf = 0) { | ||
let foundText = tf | ||
|
||
if (node.type === 'text') { | ||
foundText += node.value.length | ||
if (foundText >= maxChars) { | ||
node.value = `${node.value.slice( | ||
0, | ||
node.value.length - (foundText - maxChars), | ||
)}${ellipses}` | ||
return maxChars | ||
} | ||
} | ||
|
||
if (node.type === 'root' || node.type === 'element') { | ||
if (node.type === 'element' && ignoreTags.includes(node.tagName)) { | ||
return foundText | ||
} | ||
for (let i = 0; i < node.children.length; i++) { | ||
if (foundText === maxChars) { | ||
node.children.splice(i, 1) | ||
i-- | ||
continue | ||
} | ||
foundText = truncateNode(node.children[i], foundText) | ||
} | ||
} | ||
|
||
return foundText | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.svelte-kit | ||
/coverage/ | ||
/cypress/screenshots/ | ||
/cypress/videos/ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
|
||
<title>π-Base</title> | ||
|
||
<meta name="author" content="James Dabbs" /> | ||
<meta name="description" | ||
content="A community database of topological theorems and spaces, with powerful search and automated proof deduction." /> | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:site_name" content="π-Base" /> | ||
<meta property="og:url" name="twitter:url" content="https://topology.pi-base.org" /> | ||
<meta property="og:title" name="twitter:title" content="π-Base" /> | ||
<meta property="og:description" name="twitter:description" | ||
content="A community database of topological theorems and spaces, with powerful search and automated proof deduction." /> | ||
<meta property="og:image" content="%sveltekit.assets%/pi-base.png" /> | ||
<meta name="twitter:site" content="π-Base" /> | ||
<meta name="twitter:creator" content="@jamesdabbs" /> | ||
|
||
<link rel="icon" href="%sveltekit.assets%/favicon.ico" /> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous"> | ||
<link rel='stylesheet' href='/global.css'> | ||
|
||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.