use of org.eclipse.mylyn.wikitext.parser.DocumentBuilder in project mylyn.docs by eclipse.
the class HtmlLanguageBuilderTest method assertEmittedCharsEqual.
private void assertEmittedCharsEqual(boolean xhtmlStrict, String expected, String... chars) {
StringWriter writer = new StringWriter();
DocumentBuilder builder = newDocumentBuilder(writer, xhtmlStrict);
builder.beginDocument();
for (String characters : chars) {
builder.characters(characters);
}
builder.endDocument();
assertEquals(expected, writer.toString());
}
use of org.eclipse.mylyn.wikitext.parser.DocumentBuilder in project mylyn.docs by eclipse.
the class HtmlLanguageBuilderTest method addSpanFont.
@Test
public void addSpanFont() {
StringWriter writer = new StringWriter();
HtmlLanguage language = builder.addSpanFont().add(BlockType.PARAGRAPH).document("", "").name("Test").create();
DocumentBuilder builder = language.createDocumentBuilder(writer);
builder.beginDocument();
builder.beginSpan(SpanType.SPAN, new Attributes());
builder.characters("test");
builder.endSpan();
builder.characters(" ");
addSpanWithCssColor(builder);
builder.endDocument();
assertEquals("test <font color=\"purple\">inside font</font>", writer.toString());
}
use of org.eclipse.mylyn.wikitext.parser.DocumentBuilder in project mylyn.docs by eclipse.
the class HtmlLanguageBuilderTest method spanToStrongTransformation.
@Test
public void spanToStrongTransformation() {
StringWriter writer = new StringWriter();
HtmlLanguage language = builder.add(BlockType.PARAGRAPH).add(SpanType.STRONG).document("", "").name("Test").create();
DocumentBuilder builder = language.createDocumentBuilder(writer);
builder.beginDocument();
addSpanWithCssFontWeightBold(builder);
builder.characters(" ");
addSpanWithCssColor(builder);
builder.endDocument();
assertEquals("<strong>test</strong> inside font", writer.toString());
}
use of org.eclipse.mylyn.wikitext.parser.DocumentBuilder in project mylyn.docs by eclipse.
the class InlineTest method create.
@Test
public void create() {
Line line = new Line(3, 5, "text");
Inline inline = new Inline(line, 8, 3) {
@Override
public void emit(DocumentBuilder builder) {
}
};
assertSame(line, inline.getLine());
assertEquals(8, inline.getOffset());
assertEquals(3, inline.getLength());
Locator locator = inline.getLocator();
assertEquals(3, locator.getLineCharacterOffset());
assertEquals(6, locator.getLineSegmentEndOffset());
assertEquals(8, locator.getDocumentOffset());
assertEquals(line.getOffset(), locator.getLineDocumentOffset());
assertEquals(line.getText().length(), locator.getLineLength());
assertEquals(line.getLineNumber() + 1, locator.getLineNumber());
}
use of org.eclipse.mylyn.wikitext.parser.DocumentBuilder in project mylyn.docs by eclipse.
the class InlineTest method createContext.
@Test
public void createContext() {
ProcessingContextBuilder builder = ProcessingContext.builder();
new Inline(new Line(1, 2, "text"), 0, 1) {
@Override
public void emit(DocumentBuilder builder) {
}
}.createContext(builder);
ProcessingContext context = builder.build();
assertTrue(context.isEmpty());
}
Aggregations