Search in sources :

Example 1 with TWikiLanguage

use of org.eclipse.mylyn.wikitext.twiki.TWikiLanguage 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();
        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;
}
Also used : TWikiLanguage(org.eclipse.mylyn.wikitext.twiki.TWikiLanguage) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Block(org.eclipse.mylyn.wikitext.parser.markup.Block)

Example 2 with TWikiLanguage

use of org.eclipse.mylyn.wikitext.twiki.TWikiLanguage in project mylyn.docs by eclipse.

the class LiteralBlock method processLineContent.

@Override
public int processLineContent(String line, int offset) {
    if (blockLineCount++ == 0) {
        offset = matcher.start(1);
        ((TWikiLanguage) markupLanguage).setLiteralMode(true);
        builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    } else {
        Matcher endMatcher = endPattern.matcher(line);
        if (endMatcher.matches()) {
            setClosed(true);
            return endMatcher.start(1);
        }
    }
    markupLanguage.emitMarkupLine(parser, state, line, offset);
    // $NON-NLS-1$
    builder.characters("\n");
    return -1;
}
Also used : Matcher(java.util.regex.Matcher) TWikiLanguage(org.eclipse.mylyn.wikitext.twiki.TWikiLanguage) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes)

Example 3 with TWikiLanguage

use of org.eclipse.mylyn.wikitext.twiki.TWikiLanguage in project mylyn.docs by eclipse.

the class TWikiLanguageTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    language = new TWikiLanguage();
    parser = new MarkupParser(language);
}
Also used : TWikiLanguage(org.eclipse.mylyn.wikitext.twiki.TWikiLanguage) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 4 with TWikiLanguage

use of org.eclipse.mylyn.wikitext.twiki.TWikiLanguage in project mylyn.docs by eclipse.

the class TWikiLanguageTest method testDiscoverable.

public void testDiscoverable() {
    MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("TWiki");
    assertNotNull(language);
    assertTrue(language instanceof TWikiLanguage);
}
Also used : TWikiLanguage(org.eclipse.mylyn.wikitext.twiki.TWikiLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)

Example 5 with TWikiLanguage

use of org.eclipse.mylyn.wikitext.twiki.TWikiLanguage in project mylyn.docs by eclipse.

the class TableOfContentsBlock method processLineContent.

@Override
public int processLineContent(String line, int offset) {
    if (blockLineNumber++ > 0) {
        setClosed(true);
        return 0;
    }
    if (!getMarkupLanguage().isFilterGenerativeContents()) {
        OutlineParser outlineParser = new OutlineParser(new TWikiLanguage());
        OutlineItem rootItem = outlineParser.parse(state.getMarkupContent());
        emitToc(rootItem);
    }
    return -1;
}
Also used : OutlineParser(org.eclipse.mylyn.wikitext.parser.outline.OutlineParser) TWikiLanguage(org.eclipse.mylyn.wikitext.twiki.TWikiLanguage) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Aggregations

TWikiLanguage (org.eclipse.mylyn.wikitext.twiki.TWikiLanguage)5 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)2 Matcher (java.util.regex.Matcher)1 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)1 Block (org.eclipse.mylyn.wikitext.parser.markup.Block)1 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)1 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)1 OutlineParser (org.eclipse.mylyn.wikitext.parser.outline.OutlineParser)1