Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
3297d6efea
commit
772643f175
@@ -46,9 +46,10 @@ function tokenize(node: Node, style: Style, out: Token[]) {
|
||||
el.childNodes.forEach((c) => tokenize(c, next, out));
|
||||
}
|
||||
|
||||
function alignOf(el: Element): Block extends { align: infer A } ? A : never {
|
||||
type Align = "left" | "center" | "right" | "justify";
|
||||
function alignOf(el: Element): Align {
|
||||
const ta = (el.getAttribute("style") || "").match(/text-align:\s*(left|center|right|justify)/i)?.[1]?.toLowerCase();
|
||||
return (ta as any) || "left";
|
||||
return (ta as Align) || "left";
|
||||
}
|
||||
|
||||
function htmlToBlocks(html: string): Block[] {
|
||||
@@ -237,7 +238,7 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string
|
||||
: (input.body || "").split("\n").map<Block>((line) => ({ kind: "para", align: "left", tokens: [{ text: line, style: {} }] }));
|
||||
|
||||
for (const block of blocks) {
|
||||
if (block.kind === "spacer") { y += LINE_H; continue; }
|
||||
if (block.kind === "spacer" || block.kind === "rule") { y += LINE_H; continue; }
|
||||
|
||||
if (block.kind === "list-item") {
|
||||
const indent = 24 + block.level * 24;
|
||||
|
||||
Reference in New Issue
Block a user