use of org.eclipse.mylyn.wikitext.textile.internal.TextileContentState in project mylyn.docs by eclipse.
the class TextileLanguage method createState.
@Override
protected ContentState createState() {
if (currentState != null) {
TextileContentState temp = currentState;
currentState = null;
return temp;
}
return new TextileContentState();
}
use of org.eclipse.mylyn.wikitext.textile.internal.TextileContentState in project mylyn.docs by eclipse.
the class FootnoteBlock method processLineContent.
@Override
public int processLineContent(String line, int offset) {
if (blockLineCount == 0) {
Attributes attributes = new Attributes();
// $NON-NLS-1$
attributes.setCssClass("footnote");
// 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();
// $NON-NLS-1$
builder.characters(" ");
}
if (markupLanguage.isEmptyLine(line)) {
setClosed(true);
return 0;
}
if (blockLineCount != 0) {
builder.lineBreak();
}
++blockLineCount;
getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset);
return -1;
}
use of org.eclipse.mylyn.wikitext.textile.internal.TextileContentState in project mylyn.docs by eclipse.
the class TextileLanguage method processContent.
@Override
public void processContent(MarkupParser parser, String markupContent, boolean asDocument) {
if (preprocessFootnotes) {
boolean previousBlocksOnly = isBlocksOnly();
boolean previousFilterGenerativeContents = isFilterGenerativeContents();
setBlocksOnly(true);
setFilterGenerativeContents(true);
DocumentBuilder builder = parser.getBuilder();
parser.setBuilder(new NoOpDocumentBuilder());
currentState = new TextileContentState();
TextileContentState preprocessingState = currentState;
super.processContent(parser, markupContent, asDocument);
setBlocksOnly(previousBlocksOnly);
setFilterGenerativeContents(previousFilterGenerativeContents);
currentState = new TextileContentState();
currentState.setFootnoteNumbers(preprocessingState.getFootnoteNumbers());
parser.setBuilder(builder);
super.processContent(parser, markupContent, asDocument);
currentState = null;
} else {
currentState = null;
super.processContent(parser, markupContent, asDocument);
}
}
Aggregations