use of org.eclipse.mylyn.wikitext.parser.markup.Block in project mylyn.docs by eclipse.
the class ParagraphBlock method processLineContent.
@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 "p. " prefix.
Matcher matcher = startPattern.matcher(line);
if (matcher.matches()) {
Textile.configureAttributes(attributes, matcher, 1, true);
offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET);
} else {
if (line.charAt(0) == ' ') {
offset = 1;
if (enableUnwrapped) {
unwrapped = true;
}
}
}
}
if (!unwrapped) {
builder.beginBlock(BlockType.PARAGRAPH, attributes);
}
}
if (markupLanguage.isEmptyLine(line)) {
setClosed(true);
return 0;
}
TextileLanguage textileLanguage = (TextileLanguage) getMarkupLanguage();
// however we cause them to end the paragraph rather than being nested.
for (Block block : textileLanguage.getParagraphBreakingBlocks()) {
if (block.canStart(line, offset)) {
setClosed(true);
return offset;
}
}
if (blockLineCount != 0) {
if (unwrapped) {
// $NON-NLS-1$
builder.characters("\n");
} else {
builder.lineBreak();
}
}
++blockLineCount;
textileLanguage.emitMarkupLine(getParser(), state, line, offset);
return -1;
}
Aggregations