From 4e784a14e7c8b7daebdea36720e01c35bc7090d4 Mon Sep 17 00:00:00 2001 From: takker99 <37929109+takker99@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:22:14 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20scrapbox-parser=E3=81=AE=E7=A0=B4?= =?UTF-8?q?=E5=A3=8A=E7=9A=84=E5=A4=89=E6=9B=B4=E3=81=AB=E4=BC=B4=E3=81=86?= =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deno.unstableを消してtype checkが通るようにもした --- browser/websocket/diffToChanges.test.ts | 1 - browser/websocket/makeChanges.ts | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/browser/websocket/diffToChanges.test.ts b/browser/websocket/diffToChanges.test.ts index c1efa18..506cb23 100644 --- a/browser/websocket/diffToChanges.test.ts +++ b/browser/websocket/diffToChanges.test.ts @@ -1,4 +1,3 @@ -/// import { diffToChanges } from "./diffToChanges.ts"; import { assertEquals } from "../../deps/testing.ts"; diff --git a/browser/websocket/makeChanges.ts b/browser/websocket/makeChanges.ts index 1c20e57..a64a604 100644 --- a/browser/websocket/makeChanges.ts +++ b/browser/websocket/makeChanges.ts @@ -1,12 +1,6 @@ import { diffToChanges } from "./diffToChanges.ts"; import type { Line } from "../../deps/scrapbox.ts"; -import { - Block, - convertToBlock, - Node, - packRows, - parseToRows, -} from "../../deps/scrapbox.ts"; +import { Block, Node, parse } from "../../deps/scrapbox.ts"; import type { Change } from "../../deps/socket.ts"; import type { HeadData } from "./pull.ts"; import { toTitleLc } from "../../title.ts"; @@ -64,15 +58,14 @@ export function* makeChanges( const findLinksAndImage = ( text: string, ): [string[], string[], string | null] => { - const rows = parseToRows(text); - const blocks = packRows(rows, { hasTitle: true }).flatMap((pack) => { - switch (pack.type) { + const blocks = parse(text, { hasTitle: true }).flatMap((block) => { + switch (block.type) { case "codeBlock": case "title": return []; case "line": case "table": - return [convertToBlock(pack)]; + return block; } });