20 lines
514 B
TypeScript
20 lines
514 B
TypeScript
|
import { render_and_copy } from "./common.tsx";
|
||
|
|
||
|
const DICK_URL = "https://www.gutenberg.org/files/2701/old/moby10b.txt";
|
||
|
|
||
|
const text = await fetch(DICK_URL).then(r => r.text());
|
||
|
render_and_copy(
|
||
|
<div>
|
||
|
{text
|
||
|
.split(/CHAPTER|Epilogue/)
|
||
|
.slice(1)
|
||
|
.map(c => (
|
||
|
<>
|
||
|
{...c
|
||
|
.split("\r\n\r\n")
|
||
|
.map(p => <p>{p.replaceAll("\r\n", " ")}</p>)}
|
||
|
</>
|
||
|
))}
|
||
|
</div>
|
||
|
);
|