Search in sources :

Example 1 with SourceBlock

use of org.eclipse.mylyn.wikitext.commonmark.internal.SourceBlock in project mylyn.docs by eclipse.

the class ListBlock method emitListItem.

private void emitListItem(ProcessingContext context, DocumentBuilder builder, ListMode listMode, LineSequence lineSequence) {
    List<SourceBlock> blocks = calculateListItemBlocks(context, lineSequence.lookAhead());
    if (blocks.isEmpty()) {
        lineSequence.advance();
        return;
    }
    LineSequence contentLineSequence = listItemLineSequence(lineSequence);
    if (!blocks.isEmpty() && blocks.get(0) instanceof EmptyBlock) {
        blocks.remove(0);
        while (contentLineSequence.getCurrentLine() != null && contentLineSequence.getCurrentLine().isEmpty()) {
            contentLineSequence.advance();
        }
    }
    for (SourceBlock block : blocks) {
        if (listMode == ListMode.TIGHT && block instanceof ParagraphBlock) {
            ParagraphBlock paragraphBlock = (ParagraphBlock) block;
            paragraphBlock.processInlines(context, builder, contentLineSequence, false);
        } else {
            block.process(context, builder, contentLineSequence);
        }
    }
}
Also used : SourceBlock(org.eclipse.mylyn.wikitext.commonmark.internal.SourceBlock) LineSequence(org.eclipse.mylyn.wikitext.commonmark.internal.LineSequence)

Aggregations

LineSequence (org.eclipse.mylyn.wikitext.commonmark.internal.LineSequence)1 SourceBlock (org.eclipse.mylyn.wikitext.commonmark.internal.SourceBlock)1