Search in sources :

Example 1 with TextileContentState

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();
}
Also used : TextileContentState(org.eclipse.mylyn.wikitext.textile.internal.TextileContentState)

Example 2 with 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;
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) TextileContentState(org.eclipse.mylyn.wikitext.textile.internal.TextileContentState)

Example 3 with TextileContentState

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);
    }
}
Also used : NoOpDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.NoOpDocumentBuilder) NoOpDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.NoOpDocumentBuilder) DocumentBuilder(org.eclipse.mylyn.wikitext.parser.DocumentBuilder) TextileDocumentBuilder(org.eclipse.mylyn.wikitext.textile.internal.TextileDocumentBuilder) TextileContentState(org.eclipse.mylyn.wikitext.textile.internal.TextileContentState)

Aggregations

TextileContentState (org.eclipse.mylyn.wikitext.textile.internal.TextileContentState)3 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)1 DocumentBuilder (org.eclipse.mylyn.wikitext.parser.DocumentBuilder)1 NoOpDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.NoOpDocumentBuilder)1 TextileDocumentBuilder (org.eclipse.mylyn.wikitext.textile.internal.TextileDocumentBuilder)1