(doc, docId = `doc|${docIx++}`)
| 1435 | |
| 1436 | let docIx = 0; |
| 1437 | export function parseDoc(doc, docId = `doc|${docIx++}`) { |
| 1438 | let start = time(); |
| 1439 | let {text, spans, blocks, extraInfo} = parseMarkdown(doc, docId); |
| 1440 | let parsedBlocks = []; |
| 1441 | let allErrors = []; |
| 1442 | for(let block of blocks) { |
| 1443 | extraInfo[block.id] = {info: block.info}; |
| 1444 | if(block.info.indexOf("disabled") > -1) { |
| 1445 | extraInfo[block.id].disabled = true; |
| 1446 | } |
| 1447 | if(block.info !== "" && block.info.indexOf("eve") === -1) continue; |
| 1448 | let {results, lex, errors} = parseBlock(block.literal, block.id, block.startOffset, spans, extraInfo); |
| 1449 | // if this block is disabled, we want the parsed spans and such, but we don't want |
| 1450 | // the block to be in the set sent to the builder |
| 1451 | if(!extraInfo[block.id].disabled) { |
| 1452 | if(errors.length) { |
| 1453 | allErrors.push(errors); |
| 1454 | } else if(results) { |
| 1455 | results.endOffset = block.endOffset; |
| 1456 | parsedBlocks.push(results); |
| 1457 | } |
| 1458 | } |
| 1459 | } |
| 1460 | return { |
| 1461 | results: {blocks: parsedBlocks, text, spans, extraInfo}, |
| 1462 | time: time(start), |
| 1463 | errors: allErrors, |
| 1464 | } |
| 1465 | } |
nothing calls this directly
no test coverage detected