public Block startBlock(String line, int lineOffset) { if (isEmptyLine(line)) { // nothing starts on an empty line return null; } for (Block block : getBlocks()) { if (block.canStart(line, lineOffset)) { Block clone = block.clone(); if (clone == null) { // Special case for TableBlock: // Must not be cloned because 'canStart' needs // to be aware of the table state. return block; } return clone; } } return null; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); Textile.configureAttributes(attributes, matcher, 1, true); offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET); extended = matcher.group(EXTENDED_GROUP) != null; builder.beginBlock(BlockType.PREFORMATTED, attributes); } if (markupLanguage.isEmptyLine(line) && !extended) { setClosed(true); return 0; } else if (extended && Textile.explicitBlockBegins(line, offset)) { setClosed(true); return offset; } ++blockLineCount; final String lineText = offset > 0 ? line.substring(offset) : line; if (blockLineCount > 1 || lineText.trim().length() > 0) { builder.characters(lineText); builder.characters("\n"); //$NON-NLS-1$ } return -1; }
Attributes attributes = new Attributes(); builder.beginBlock(BlockType.TABLE, attributes); } else if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0;
@Override protected int processLineContent(String line, int offset) { if (blockLineCount++ == 0) { Attributes attributes = new Attributes(); attributes.setCssClass("eclipseErrorDetails"); //$NON-NLS-1$ builder.beginBlock(BlockType.PREFORMATTED, attributes); } else { if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } } builder.characters(offset > 0 ? line.substring(offset) : line); builder.characters("\n"); //$NON-NLS-1$ return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); // 0-offset matches may start with the "hn. " prefix. level = Integer.parseInt(matcher.group(1)); offset = matcher.start(2); if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ } builder.beginHeading(level, attributes); } if (blockLineCount != 0 || markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); Textile.configureAttributes(attributes, matcher, 1, true); offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET); extended = matcher.group(EXTENDED_GROUP) != null; builder.beginBlock(BlockType.PREFORMATTED, attributes); builder.beginBlock(BlockType.CODE, new Attributes()); } if (markupLanguage.isEmptyLine(line) && !extended) { setClosed(true); return 0; } else if (extended && Textile.explicitBlockBegins(line, offset)) { setClosed(true); return offset; } ++blockLineCount; final String lineText = offset > 0 ? line.substring(offset) : line; if (blockLineCount > 1 || lineText.trim().length() > 0) { builder.characters(lineText); builder.characters("\n"); //$NON-NLS-1$ } return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); // 0-offset matches may start with the "hn. " prefix. level = Integer.parseInt(matcher.group(1)); offset = matcher.start(2); if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ } builder.beginHeading(level, attributes); } if (blockLineCount != 0 || markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0;
if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0;
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); if (offset == 0) { // 0-offset matches may start with the "hn. " prefix. level = Integer.parseInt(matcher.group(1)); Textile.configureAttributes(attributes, matcher, 2, true); offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET); } if (attributes.getId() == null) { attributes.setId(state.getIdGenerator().newId("h" + level, line.substring(offset))); //$NON-NLS-1$ } builder.beginHeading(level, attributes); } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } if (blockLineCount != 0) { getMarkupLanguage().emitMarkupText(getParser(), state, "\n"); //$NON-NLS-1$ } ++blockLineCount; getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset); return -1; }
@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; }
@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; }
if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0;
paraOpen = true; if (markupLanguage.isEmptyLine(line)) { if (!extended) { setClosed(true);
return; if (blockLineCount > 1 && paraOpen && getMarkupLanguage().isEmptyLine(content)) {
@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; }
return; if (blockLineCount > 1 && paraOpen && getMarkupLanguage().isEmptyLine(content)) {
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); builder.beginBlock(BlockType.PARAGRAPH, attributes); } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return 0; } TWikiLanguage textileLanguage = (TWikiLanguage) getMarkupLanguage(); for (Block block : textileLanguage.getParagraphBreakingBlocks()) { if (block.canStart(line, offset)) { setClosed(true); return 0; } } if (blockLineCount != 0) { builder.lineBreak(); } ++blockLineCount; textileLanguage.emitMarkupLine(getParser(), state, line, offset); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); builder.beginBlock(BlockType.PARAGRAPH, attributes); } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return -1; } ++blockLineCount; TracWikiLanguage markupLanguage = (TracWikiLanguage) getMarkupLanguage(); // paragraphs can have nested lists and other things for (Block block : markupLanguage.getParagraphBreakingBlocks()) { if (block.canStart(line, offset)) { setClosed(true); return 0; } } if (blockLineCount != 1) { // note: newlines don't automatically convert to line breaks builder.characters("\n"); //$NON-NLS-1$ } markupLanguage.emitMarkupLine(getParser(), state, line, offset); return -1; }
@Override public int processLineContent(String line, int offset) { if (blockLineCount == 0) { Attributes attributes = new Attributes(); builder.beginBlock(BlockType.PARAGRAPH, attributes); } if (markupLanguage.isEmptyLine(line)) { setClosed(true); return -1; } ++blockLineCount; TracWikiLanguage markupLanguage = (TracWikiLanguage) getMarkupLanguage(); // paragraphs can have nested lists and other things for (Block block : markupLanguage.getParagraphBreakingBlocks()) { if (block.canStart(line, offset)) { setClosed(true); return 0; } } if (blockLineCount != 1) { // note: newlines don't automatically convert to line breaks builder.characters("\n"); //$NON-NLS-1$ } markupLanguage.emitMarkupLine(getParser(), state, line, offset); return -1; }