@Override public int processLineContent(String line, int offset) { if (blockLineCount++ == 0) { offset = matcher.start(1); builder.beginBlock(BlockType.PREFORMATTED, new Attributes()); } else { Matcher endMatcher = endPattern.matcher(line); if (endMatcher.matches()) { setClosed(true); return endMatcher.start(1); } } builder.characters(offset == 0 ? line : line.substring(offset)); builder.characters("\n"); //$NON-NLS-1$ return -1; }
@Override public void beginHeading(int level, Attributes attributes) { for (DocumentBuilder builder : builders) { builder.beginHeading(level, attributes); } }
@Override public void beginSpan(SpanType type, Attributes attributes) { for (DocumentBuilder builder : builders) { builder.beginSpan(type, attributes); } }
@Override public void emit() { String content = group(1); builder.entityReference(leftEntity); builder.characters(content); builder.entityReference(rightEntity); } }
private void openOne(Attributes attributes) { if (!quoteBlockState.isEmpty()) { BlockState blockState = quoteBlockState.peek(); if (blockState.paraOpen) { blockState.paraOpen = false; builder.endBlock(); } } builder.beginBlock(BlockType.QUOTE, attributes); quoteBlockState.push(new BlockState()); }
@Override public void emit() { getBuilder().beginSpan(SpanType.MONOSPACE, new Attributes()); getBuilder().characters(group(1)); getBuilder().endSpan(); } }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); attributes.setCssClass("footnote"); //$NON-NLS-1$ // 0-offset matches may start with the "fnnn. " prefix. footnote = matcher.group(1); ((TextileContentState) state).footnoteBlockDetected(footnote); attributes.setId(state.getFootnoteId(footnote)); Textile.configureAttributes(attributes, matcher, 2, true); offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET); builder.beginBlock(BlockType.PARAGRAPH, attributes); builder.beginSpan(SpanType.SUPERSCRIPT, new Attributes()); builder.characters(footnote); builder.endSpan(); builder.characters(" "); //$NON-NLS-1$ } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } if (blockLineCount != 0) { builder.lineBreak(); } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
private void emitToc(OutlineItem item) { if (item.getChildren().isEmpty()) { return; } Attributes nullAttributes = new Attributes(); builder.beginBlock(BlockType.NUMERIC_LIST, new Attributes()); for (OutlineItem child : item.getChildren()) { builder.beginBlock(BlockType.LIST_ITEM, nullAttributes); builder.link('#' + child.getId(), child.getLabel()); emitToc(child); builder.endBlock(); } builder.endBlock(); }
@Override public int processLineContent(String line, int offset) { offset = matcher.start(3); int level = matcher.group(1).length(); String bangEscape = matcher.group(2); boolean omitFromToc = false; if (bangEscape != null && bangEscape.length() > 0) { omitFromToc = true; } if (offset > 0 && level > 0) { HeadingAttributes attributes = new HeadingAttributes(); attributes.setOmitFromTableOfContents(omitFromToc); attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ builder.beginHeading(level, attributes); builder.characters(line.substring(offset).trim()); builder.endHeading(); } setClosed(true); return -1; }
extended = matcher.group(EXTENDED_GROUP) != null; builder.beginBlock(BlockType.QUOTE, attributes); builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); paraOpen = true; } else { if (paraOpen) { builder.endBlock(); // para paraOpen = false; builder.lineBreak(); } else { builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); paraOpen = true;
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); offset = matcher.start(1); builder.beginBlock(BlockType.QUOTE, attributes); builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } if (blockLineCount != 0) { builder.lineBreak(); } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
builder.beginBlock(BlockType.DIV, divAttributes); attributes.setAlign(null); builder.image(attributes, imageUrl); builder.endBlock(); } else { builder.image(attributes, imageUrl);
@Override public void link(Attributes attributes, String hrefOrHashName, String text) { for (DocumentBuilder builder : builders) { builder.link(attributes, hrefOrHashName, text); } }
builder.beginBlock(BlockType.PARAGRAPH, attributes); builder.characters("\n"); //$NON-NLS-1$ } else { builder.lineBreak();
@Override public void characters(String text) { for (DocumentBuilder builder : builders) { builder.characters(text); } }
@Override public void beginBlock(BlockType type, Attributes attributes) { for (DocumentBuilder builder : builders) { builder.beginBlock(type, attributes); } }
@Override public void emit() { builder.lineBreak(); } }
@Override public void endHeading() { for (DocumentBuilder builder : builders) { builder.endHeading(); } }