Skip to content

Commit

Permalink
effective usfm parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed May 29, 2024
1 parent c75c886 commit d256512
Show file tree
Hide file tree
Showing 16 changed files with 508 additions and 362 deletions.
13 changes: 13 additions & 0 deletions apps/gnocchi/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "app-dev",
"path": "web",
"problemMatcher": [],
"label": "npm: app-dev - web",
"detail": "vite --host --mode development"
}
]
}
13 changes: 13 additions & 0 deletions apps/marginalia/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "app-dev",
"path": "web",
"problemMatcher": [],
"label": "npm: app-dev - web",
"detail": "vite"
}
]
}
8 changes: 6 additions & 2 deletions apps/marginalia/web/src/components/text/Book.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UsfmRenderer } from '@/components/usfm/UsfmRenderer.jsx';
import { useSuspenseQuery } from '@tanstack/react-query';
import { UsfmNode } from '../usfm/nodes.jsx';

export interface BookProps {
id: string;
Expand All @@ -12,7 +12,11 @@ export function Book({ id }: BookProps) {
return <div>Loading...</div>;
}

return <UsfmRenderer root={book} />;
return (
<article className="leading-loose">
<UsfmNode text={book} />
</article>
);
}

function useBook(id: string) {
Expand Down
29 changes: 29 additions & 0 deletions apps/marginalia/web/src/components/usfm/Reference.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Button } from '@a-type/ui/components/button';
import {
Popover,
PopoverArrow,
PopoverContent,
PopoverTrigger,
} from '@a-type/ui/components/popover';
import { ReactNode } from 'react';

export interface ReferenceProps {
caller: string;
children: ReactNode;
}

export function Reference({ caller, children }: ReferenceProps) {
return (
<Popover>
<PopoverTrigger data-type="cross-reference" asChild>
<Button size="icon" color="ghost" className="inline-flex p-0">
{caller === '+' ? '*' : caller}
</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
{children}
</PopoverContent>
</Popover>
);
}
52 changes: 0 additions & 52 deletions apps/marginalia/web/src/components/usfm/UsfmParagraph.tsx

This file was deleted.

66 changes: 0 additions & 66 deletions apps/marginalia/web/src/components/usfm/UsfmRenderer.tsx

This file was deleted.

175 changes: 0 additions & 175 deletions apps/marginalia/web/src/components/usfm/UsfmVerse.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions apps/marginalia/web/src/components/usfm/constants.ts

This file was deleted.

Loading

0 comments on commit d256512

Please sign in to comment.