use of org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder in project mylyn.docs by eclipse.
the class TextileLanguageTest method testLinkWithItalicStyle.
@Test
public void testLinkWithItalicStyle() {
RecordingDocumentBuilder builder = new RecordingDocumentBuilder();
parser.setBuilder(builder);
parser.parse("\"_text_\":http://example.com");
List<Event> events = builder.getEvents();
boolean emphasisFound = false;
boolean textFound = false;
for (Event event : events) {
if (event.spanType == SpanType.EMPHASIS) {
assertEquals(1, event.locator.getLineCharacterOffset());
assertEquals(7, event.locator.getLineSegmentEndOffset());
emphasisFound = true;
} else if (event.text != null) {
assertEquals(2, event.locator.getLineCharacterOffset());
assertEquals(6, event.locator.getLineSegmentEndOffset());
textFound = true;
}
}
assertTrue("expected to find emphasis span", emphasisFound);
assertTrue("expected to find text", textFound);
}
use of org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder in project mylyn.docs by eclipse.
the class TextileLanguageDefinitionListTest method offsets.
@Test
public void offsets() {
RecordingDocumentBuilder builder = new RecordingDocumentBuilder();
MarkupParser markupParser = new MarkupParser(markupLanguage);
markupParser.setBuilder(builder);
markupParser.parse("- one := two");
Event event = findEvent(builder.getEvents(), BlockType.DEFINITION_TERM);
assertEquals(1, event.locator.getLineNumber());
assertEquals(0, event.locator.getLineCharacterOffset());
assertEquals(6, event.locator.getLineSegmentEndOffset());
Event itemEvent = findEvent(builder.getEvents(), BlockType.DEFINITION_ITEM);
assertEquals(1, itemEvent.locator.getLineNumber());
assertEquals(6, itemEvent.locator.getLineCharacterOffset());
}
use of org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder in project mylyn.docs by eclipse.
the class AsciiDocLanguageTestBase method parseToEvents.
public List<Event> parseToEvents(String markup) {
RecordingDocumentBuilder builder = new RecordingDocumentBuilder();
parser.setBuilder(builder);
parser.parse(markup);
return builder.getEvents();
}
use of org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder in project mylyn.docs by eclipse.
the class ConfluenceLanguageTest method testColorLexicalOffsets.
@Test
public void testColorLexicalOffsets() {
final RecordingDocumentBuilder builder = new RecordingDocumentBuilder();
parser.setBuilder(builder);
final String content = "views to help SOA development. These includes [SOA Services Explorer](in green) for the list of all available SOA services,\n[Types Explorer](in {color:#0000ff}blue{color}) for searching and browsing all available ";
parser.parse(content);
int previousDocumentOffset = -1;
for (RecordingDocumentBuilder.Event event : builder.getEvents()) {
assertTrue(previousDocumentOffset <= event.locator.getDocumentOffset());
previousDocumentOffset = event.locator.getDocumentOffset();
if (event.text != null) {
int start = event.locator.getDocumentOffset();
int end = event.locator.getLineSegmentEndOffset() + event.locator.getLineDocumentOffset();
assertEquals(event.text.length(), end - start);
assertTrue(end >= start);
assertEquals(content.substring(start, end), event.text);
}
}
}
use of org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder in project mylyn.docs by eclipse.
the class MarkdownLanguageTestBase method parseToEvents.
protected List<Event> parseToEvents(String markupContent) {
RecordingDocumentBuilder builder = new RecordingDocumentBuilder();
parser.setBuilder(builder);
parser.parse(markupContent);
return builder.getEvents();
}
Aggregations