utils/node_modules/@microsoft/tsdoc/lib/transforms/TrimSpacesTransform.js.map

1 line
6.0 KiB
Plaintext
Raw Normal View History

2024-02-07 01:33:07 -05:00
{"version":3,"file":"TrimSpacesTransform.js","sourceRoot":"","sources":["../../src/transforms/TrimSpacesTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAW,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE5E;;GAEG;AACH;IAAA;IA+FA,CAAC;IA9Fe,6BAAS,GAAvB,UAAwB,YAA0B;QAChD,IAAM,gBAAgB,GAAc,EAAE,CAAC;QAEvC,qEAAqE;QACrE,IAAI,YAAY,GAAY,KAAK,CAAC;QAElC,0DAA0D;QAC1D,IAAM,qBAAqB,GAAa,EAAE,CAAC;QAC3C,IAAM,gBAAgB,GAAc,EAAE,CAAC;QAEvC,iFAAiF;QACjF,8CAA8C;QAC9C,IAAI,6BAA6B,GAAY,KAAK,CAAC;QAEnD,KAAmB,UAAkB,EAAlB,KAAA,YAAY,CAAC,KAAK,EAAlB,cAAkB,EAAlB,IAAkB,EAAE;YAAlC,IAAM,IAAI,SAAA;YACb,QAAQ,IAAI,CAAC,IAAI,EAAE;gBACjB,KAAK,WAAW,CAAC,SAAS;oBACxB,IAAM,YAAY,GAAiB,IAAoB,CAAC;oBAExD,IAAM,IAAI,GAAW,YAAY,CAAC,IAAI,CAAC;oBAEvC,IAAM,gBAAgB,GAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACnD,IAAM,cAAc,GAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACjD,IAAM,aAAa,GAAW,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;oBAE/D,IAAI,gBAAgB,IAAI,6BAA6B,EAAE;wBACrD,YAAY,GAAG,IAAI,CAAC;qBACrB;oBAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC5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AC,aAAa;gBACzC,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;aACrC,CAAC,CACH,CAAC;YACF,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;YACjC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;SAC7B;QAED,IAAM,oBAAoB,GAAiB,IAAI,YAAY,CAAC;YAC1D,aAAa,EAAE,YAAY,CAAC,aAAa;SAC1C,CAAC,CAAC;QACH,oBAAoB,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACnD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACH,0BAAC;AAAD,CAAC,AA/FD,IA+FC","sourcesContent":["import { DocParagraph, DocNode, DocNodeKind, DocPlainText } from '../nodes';\r\n\r\n/**\r\n * Implementation of DocNodeTransforms.trimSpacesInParagraphNodes()\r\n */\r\nexport class TrimSpacesTransform {\r\n public static transform(docParagraph: DocParagraph): DocParagraph {\r\n const transformedNodes: DocNode[] = [];\r\n\r\n // Whether the next nonempty node to be added needs a space before it\r\n let pendingSpace: boolean = false;\r\n\r\n // The DocPlainText node that we're currently accumulating\r\n const accumulatedTextChunks: string[] = [];\r\n const accumulatedNodes: DocNode[] = [];\r\n\r\n // We always trim leading whitespace for a paragraph. This flag gets set to true\r\n // as soon as nonempty content is encountered.\r\n let finishedSkippingLeadingSpaces: boolean = false;\r\n\r\n for (const node of docParagraph.nodes) {\r\n switch (node.kind) {\r\n case DocNodeKind.PlainText:\r\n const docPlainText: DocPlainText = node as DocPlainText;\r\n\r\n const text: string = docPlainText.text;\r\n\r\n const startedWithSpace: boolean = /^\\s/.test(text);\r\n const endedWithSpace: boolean = /\\s$/.test(text);\r\n const collapsedText: string = text.replace(/\\s+/g, ' ').trim();\r\n\r\n if (startedWithSpace && finishedSkippingLeadingSpaces) {\r\n pendingSpace = true;\r\n }\r\n\r\n if (collapsedText.length > 0) {\r\n if (pendingSpace) {\r\n accumulatedTextChunks.push(' ');\r\n pendingSpace = false;\r\n }\r\n\r\n accumulatedTextChunks.p