Search in sources :

Example 1 with HtmlSubsetLanguage

use of org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage in project mylyn.docs by eclipse.

the class HtmlLanguageBuilderTest method document.

@Test
public void document() {
    HtmlSubsetLanguage subsetLanguage = (HtmlSubsetLanguage) builder.add(BlockType.PARAGRAPH).document("<div>", "</div>").name("Test").create();
    StringWriter writer = new StringWriter();
    DocumentBuilder documentBuilder = subsetLanguage.createDocumentBuilder(writer);
    documentBuilder.beginDocument();
    documentBuilder.characters("test");
    documentBuilder.endDocument();
    assertEquals("<div>test</div>", writer.toString());
}
Also used : StringWriter(java.io.StringWriter) DocumentBuilder(org.eclipse.mylyn.wikitext.parser.DocumentBuilder) HtmlSubsetLanguage(org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage) Test(org.junit.Test)

Example 2 with HtmlSubsetLanguage

use of org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage in project mylyn.docs by eclipse.

the class HtmlLanguageBuilderTest method create.

@Test
public void create() {
    HtmlLanguage language = builder.add(BlockType.PARAGRAPH).add(BlockType.CODE).add(SpanType.SUPERSCRIPT).add(SpanType.BOLD).addSubstitution(SpanType.BOLD, "bold").name("Test").create();
    assertNotNull(language);
    assertEquals("Test", language.getName());
    assertTrue(language instanceof HtmlSubsetLanguage);
    HtmlSubsetLanguage subsetLanguage = (HtmlSubsetLanguage) language;
    assertEquals(ImmutableSet.of(BlockType.PARAGRAPH, BlockType.CODE), subsetLanguage.getSupportedBlockTypes());
    assertEquals(ImmutableSet.of(SpanType.SUPERSCRIPT, SpanType.BOLD), subsetLanguage.getSupportedSpanTypes());
    assertEquals(0, subsetLanguage.getSupportedHeadingLevel());
}
Also used : HtmlSubsetLanguage(org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage) Test(org.junit.Test)

Example 3 with HtmlSubsetLanguage

use of org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage in project mylyn.docs by eclipse.

the class HtmlLanguageBuilderTest method assertXhtmlStrict.

private void assertXhtmlStrict(boolean xhtmlStrict) {
    builder.name("Test").add(BlockType.PARAGRAPH);
    assertSame(builder, builder.setXhtmlStrict(xhtmlStrict));
    HtmlSubsetLanguage language = (HtmlSubsetLanguage) builder.create();
    assertEquals(xhtmlStrict, language.isXhtmlStrict());
}
Also used : HtmlSubsetLanguage(org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage)

Example 4 with HtmlSubsetLanguage

use of org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage in project mylyn.docs by eclipse.

the class HtmlLanguageBuilderTest method assertSupportsImages.

private void assertSupportsImages(boolean supportsImages) {
    builder.name("Test").add(BlockType.PARAGRAPH);
    assertSame(builder, builder.setSupportsImages(supportsImages));
    HtmlSubsetLanguage language = (HtmlSubsetLanguage) builder.create();
    assertEquals(supportsImages, language.getSupportsImages());
}
Also used : HtmlSubsetLanguage(org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage)

Example 5 with HtmlSubsetLanguage

use of org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage in project mylyn.docs by eclipse.

the class HtmlLanguageBuilderTest method addHeadingsCreatesExpectedSupportLevel.

@Test
public void addHeadingsCreatesExpectedSupportLevel() {
    HtmlSubsetLanguage subsetLanguage = (HtmlSubsetLanguage) builder.add(BlockType.PARAGRAPH).addHeadings(3).name("Test").create();
    assertEquals(3, subsetLanguage.getSupportedHeadingLevel());
}
Also used : HtmlSubsetLanguage(org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage) Test(org.junit.Test)

Aggregations

HtmlSubsetLanguage (org.eclipse.mylyn.wikitext.html.internal.HtmlSubsetLanguage)5 Test (org.junit.Test)3 StringWriter (java.io.StringWriter)1 DocumentBuilder (org.eclipse.mylyn.wikitext.parser.DocumentBuilder)1