1 line
7.4 KiB
Plaintext
1 line
7.4 KiB
Plaintext
|
{"version":3,"file":"ParagraphSplitter.js","sourceRoot":"","sources":["../../src/parser/ParagraphSplitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,WAAW,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AAExF;;;;;;;;GAQG;AACH;IAAA;IAmHA,CAAC;IAhHC;;OAEG;IACW,iCAAe,GAA7B,UAA8B,IAAa;QACzC,IAAI,IAAI,YAAY,UAAU,EAAE;YAC9B,iBAAiB,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;YAElD,qEAAqE;SACtE;aAAM;YACL,KAAwB,UAAoB,EAApB,KAAA,IAAI,CAAC,aAAa,EAAE,EAApB,cAAoB,EAApB,IAAoB,EAAE;gBAAzC,IAAM,SAAS,SAAA;gBAClB,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;aAC9C;SACF;IACH,CAAC;IAED;;OAEG;IACW,2CAAyB,GAAvC,UAAwC,UAAsB;QAC5D,IAAM,UAAU,GAA2B,UAAU,CAAC,KAAK,CAAC;QAC5D,IAAM,WAAW,GAAc,EAAE,CAAC;QAElC,KAAsB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE;YAA7B,IAAM,OAAO,mBAAA;YAChB,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE;gBAC1C,iBAAiB,CAAC,eAAe,CAAC,OAAuB,EAAE,WAAW,CAAC,CAAC;aACzE;iBAAM;gBACL,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC3B;SACF;QAED,8CAA8C;QAC9C,UAAU,CAAC,UAAU,EAAE,CAAC;QACxB,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAEc,iCAAe,GAA9B,UAA+B,YAA0B,EAAE,WAAsB;QAC/E,IAAM,mBAAmB,GAA2B,YAAY,CAAC,KAAK,CAAC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D,MAAM;aACT;YAED,6CAA6C;YAC7C,KAAK,IAAI,CAAC,GAAW,YAAY,EAAE,CAAC,GAAG,YAAY,EAAE,EAAE,CAAC,EAAE;gBACxD,gBAAgB,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;aACrD;YAED,YAAY,GAAG,YAAY,CAAC;SAC7B;IACH,CAAC;IAEc,+BAAa,GAA5B,UAA6B,IAAa;QACxC,QAAQ,IAAI,CAAC,IAAI,EAAE;YACjB,KAAK,WAAW,CAAC,SAAS;gBACxB,IAAM,YAAY,GAAiB,IAAoB,CAAC;gBACxD,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACrE;gBACE,OAAO,KAAK,CAAC;SAChB;IACH,CAAC;IAjHuB,mCAAiB,GAAW,OAAO,CAAC;IAkH9D,wBAAC;CAAA,AAnHD,IAmHC;SAnHY,iBAAiB","sourcesContent":["import { DocSection, DocNode, DocNodeKind, DocParagraph, DocPlainText } from '../nodes';\r\n\r\n/**\r\n * The ParagraphSplitter is a secondary stage that runs after the NodeParser has constructed\r\n * the DocComment. It splits DocParagraph nodes into multiple paragraphs by looking for\r\n * paragraph delimiters. Following CommonMark conventions, paragraphs are delimited by\r\n * one or more blank lines. (These lines end with SoftBreak nodes.) The blank lines are\r\n * not discarded. Instead, they are attached to the preceding paragraph. If the DocParagraph\r\n * starts with blank lines, they are preserved to avoid creating a paragraph containing only\r\n * whitespace.\r\n */\r\nexport class ParagraphSplitter {\r\n private static readonly _whitespaceRegExp: RegExp = /^\\s*$/;\r\n\r\n /**\r\n * Split all paragraphs belonging to the provided subtree.\r\n */\r\n public static splitParagraphs(node: DocNode): void {\r\n if (node instanceof DocSection) {\r\n ParagraphSplitter.splitParagraphsForSection(node);\r\n\r\n // (We don't recurse here, since sections cannot contain subsections)\r\n } else {\r\n for (const childNode of node.getChildNodes()) {\r\n ParagraphSplitter.splitParagraphs(childNode);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Split all paragraphs belonging to the provided DocSection.\r\n */\r\n public static splitParagraphsForSection(docSection: DocSection)
|