diff --git a/parser/main.js b/parser/main.js index 1b437fe..5493246 100644 --- a/parser/main.js +++ b/parser/main.js @@ -178,6 +178,8 @@ const makeAnswerProcessor = logError("Error while parsing contents", answer, err); return false; } + console.log(`parsed Doc: `) + console.log(parsed) let { md, relatedAnswerDocIDs, diff --git a/parser/parser.js b/parser/parser.js index 65a05ce..b9f885a 100644 --- a/parser/parser.js +++ b/parser/parser.js @@ -46,7 +46,10 @@ const extractRelatedAnswerIDs = (blocks) => const extractAllParagraphs = (blocks) => blocks .filter((block) => Object.keys(block).includes("paragraph")) - .map((b) => b.paragraph); + .map((b) => { + console.log("Extract ALL Paragraphs ", b.paragraph) + return b.paragraph + }); const extractDocParts = (doc) => { const sectionHeaders = { @@ -104,8 +107,16 @@ export const parseDoc = async (doc, answer) => { return { md: tagContent, relatedAnswerDocIDs, alternativePhrasings }; } - const body = paragraphs.map(parseParagraph(documentContext)).join("\n\n"); + console.log((">>>>>>>>>><<<<<<>>>>>>>>>>>>>>>>>>>")) + console.log("PARAGRAPHS: ") + console.log(paragraphs); + console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") + const body = paragraphs.map(parseParagraph(documentContext)).join("\n\n"); + console.log("--------------------------------------") +console.log("PARAGRAPHS mapped joined: ") + console.log(`${body}`); + console.log("-------------------------") const footnotes = extractFootnotes(documentContext, doc); const md = body + "\n\n" + footnotes; @@ -223,7 +234,7 @@ export const parseParagraph = (documentContext) => (paragraph) => { let prefix = ""; let itemMarker = ""; - let leadingSpace = ""; + let leadingSpace = "