use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder in project mylyn.docs by eclipse.
the class MultiplexingDocumentBuilderTest method newDelegateAfterInstatiation.
@Test
public void newDelegateAfterInstatiation() {
multiplexer.lineBreak();
assertEvents(new LineBreakEvent());
EventDocumentBuilder delegate3 = new EventDocumentBuilder();
multiplexer.addDocumentBuilder(delegate3);
multiplexer.acronym("a", "b");
assertEvents(new LineBreakEvent(), new AcronymEvent("a", "b"));
assertEquals(Arrays.asList(new AcronymEvent("a", "b")), delegate3.getDocumentBuilderEvents().getEvents());
}
use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder in project mylyn.docs by eclipse.
the class SubstitutionWithoutCssSpanStrategyTest method test.
@Test
public void test() {
SubstitutionWithoutCssSpanStrategy strategy = new SubstitutionWithoutCssSpanStrategy(SpanType.BOLD);
EventDocumentBuilder builder = new EventDocumentBuilder();
strategy.beginSpan(builder, SpanType.ITALIC, new Attributes("1", "class", "style", "lang"));
List<DocumentBuilderEvent> events = builder.getDocumentBuilderEvents().getEvents();
assertEquals(ImmutableList.of(new BeginSpanEvent(SpanType.BOLD, new Attributes("1", "class", null, "lang"))), events);
}
use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder in project mylyn.docs by eclipse.
the class ConfluenceLanguageIntegrationTest method parseToEvents.
private DocumentBuilderEvents parseToEvents(String markup) {
EventDocumentBuilder eventBuilder = new EventDocumentBuilder();
MarkupParser parser = new MarkupParser(new ConfluenceLanguage(), eventBuilder);
parser.parse(markup);
DocumentBuilderEvents events = eventBuilder.getDocumentBuilderEvents();
return events;
}
use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder in project mylyn.docs by eclipse.
the class SourceBlocksTest method process.
@Test
public void process() {
EventDocumentBuilder builder = new EventDocumentBuilder();
sourceBlocks.process(ProcessingContext.builder().build(), builder, LineSequence.create("one\nb2\nmore\n\nb1 and\n\n\nb2"));
ImmutableList<DocumentBuilderEvent> expectedEvents = //
ImmutableList.of(//
new BeginBlockEvent(BlockType.PARAGRAPH, new Attributes()), //
new CharactersEvent("b2"), //
new CharactersEvent("more"), //
new EndBlockEvent(), //
new BeginBlockEvent(BlockType.QUOTE, new Attributes()), //
new CharactersEvent("b1 and"), //
new EndBlockEvent(), //
new BeginBlockEvent(BlockType.PARAGRAPH, new Attributes()), //
new CharactersEvent("b2"), new EndBlockEvent());
assertEquals(Joiner.on("\n").join(builder.getDocumentBuilderEvents().getEvents()), expectedEvents, builder.getDocumentBuilderEvents().getEvents());
}
use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder in project mylyn.docs by eclipse.
the class CommonMarkLanguageTest method assertEvents.
private void assertEvents(String content, boolean asDocument, DocumentBuilderEvent... events) {
MarkupParser parser = new MarkupParser(language);
EventDocumentBuilder builder = new EventDocumentBuilder();
parser.setBuilder(builder);
parser.parse(content, asDocument);
List<DocumentBuilderEvent> expectedEvents = Arrays.asList(events);
List<DocumentBuilderEvent> actualEvents = builder.getDocumentBuilderEvents().getEvents();
assertEquals(format("Expected {0} but got {1}", toMessage(expectedEvents), toMessage(actualEvents)), expectedEvents, actualEvents);
}
Aggregations