use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class MarkupTokenScannerTest method testTextileLinkWithStyle.
public void testTextileLinkWithStyle() {
IDocument document = new Document();
FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
partitioner.setMarkupLanguage(new TextileLanguage());
String markup = "\"_text_\":http://example.com";
document.set(markup);
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
partitioner.computePartitioning(0, document.getLength(), false);
tokenScanner.setRange(document, 0, document.getLength());
List<MarkupTokenScanner.Token> tokens = new ArrayList<MarkupTokenScanner.Token>();
for (IToken token = tokenScanner.nextToken(); token != Token.EOF; token = tokenScanner.nextToken()) {
tokens.add((MarkupTokenScanner.Token) token);
}
// expecting:
// Token [offset=0, length=1]
// Token [offset=1, length=6]
// Token [offset=7, length=20]
assertEquals(3, tokens.size());
assertEquals(0, tokens.get(0).getOffset());
assertEquals(1, tokens.get(0).getLength());
assertFalse(tokens.get(0).getFontState().isItalic());
assertEquals(1, tokens.get(1).getOffset());
assertEquals(6, tokens.get(1).getLength());
assertTrue(tokens.get(1).getFontState().isItalic());
assertEquals(7, tokens.get(2).getOffset());
assertEquals(20, tokens.get(2).getLength());
assertFalse(tokens.get(2).getFontState().isItalic());
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class MarkupToEclipseTocTest method setUp.
@Override
public void setUp() {
markupToEclipseToc = new MarkupToEclipseToc();
markupToEclipseToc.setMarkupLanguage(new TextileLanguage());
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class FastMarkupPartitionerTest method testConnectLargeDocument.
public void testConnectLargeDocument() throws IOException {
IDocument document = createDocument("resources/large.textile");
FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
partitioner.setMarkupLanguage(new TextileLanguage());
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class FastMarkupPartitionerTest method testTextileCausesExceptionIssue36.
public void testTextileCausesExceptionIssue36() {
IDocument document = new Document();
FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
partitioner.setMarkupLanguage(new TextileLanguage());
document.set("a\n" + "# a\n" + "a\n" + "# a\n" + "a\n" + "# a\n" + "\n" + "h2. a");
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class FastMarkupPartitionerTest method testTextileLinkInBold.
/**
* bug 314131
*/
public void testTextileLinkInBold() {
IDocument document = new Document();
FastMarkupPartitioner partitioner = new FastMarkupPartitioner();
partitioner.setMarkupLanguage(new TextileLanguage());
document.set("*\"text\":url*");
// ...........012345678901.234567.8.9012345678901.234567.
// .....................10...........20.........30.......
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
int[][] expected = new int[][] { //
{ 0, 12 } };
ITypedRegion[] partitioning = partitioner.computePartitioning(0, document.getLength(), false);
assertPartitioningAsExpected(expected, partitioning);
}
Aggregations