Search in sources :

Example 21 with Attributes

use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.

the class AsciiDocDocumentBuilderTest method testEntityReference.

@Test
public void testEntityReference() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("5 ");
    builder.entityReference("gt");
    builder.characters(" 4");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("5 > 4\n\n");
}
Also used : ImageAttributes(org.eclipse.mylyn.wikitext.parser.ImageAttributes) LinkAttributes(org.eclipse.mylyn.wikitext.parser.LinkAttributes) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Test(org.junit.Test)

Example 22 with Attributes

use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.

the class AsciiDocDocumentBuilderTest method testBlockQuoteConsecutive.

@Test
public void testBlockQuoteConsecutive() {
    builder.beginDocument();
    builder.beginBlock(BlockType.QUOTE, new Attributes());
    builder.characters("Quote 1");
    builder.endBlock();
    builder.beginBlock(BlockType.QUOTE, new Attributes());
    builder.characters("Quote 2");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("[quote]\n----\nQuote 1\n----\n[quote]\n----\nQuote 2\n----\n");
}
Also used : ImageAttributes(org.eclipse.mylyn.wikitext.parser.ImageAttributes) LinkAttributes(org.eclipse.mylyn.wikitext.parser.LinkAttributes) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Test(org.junit.Test)

Example 23 with Attributes

use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.

the class AsciiDocDocumentBuilderTest method testListWithParagraphs.

@Test
public void testListWithParagraphs() {
    builder.beginDocument();
    builder.beginBlock(BlockType.BULLETED_LIST, new Attributes());
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("X");
    builder.endBlock();
    builder.endBlock();
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Y");
    builder.endBlock();
    builder.endBlock();
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Z");
    builder.endBlock();
    builder.endBlock();
    builder.endBlock();
    builder.endDocument();
    assertMarkup("* X\n\n* Y\n\n* Z\n\n");
}
Also used : ImageAttributes(org.eclipse.mylyn.wikitext.parser.ImageAttributes) LinkAttributes(org.eclipse.mylyn.wikitext.parser.LinkAttributes) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Test(org.junit.Test)

Example 24 with Attributes

use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.

the class AsciiDocDocumentBuilderTest method testLinkImplicitParagraph.

@Test
public void testLinkImplicitParagraph() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("A paragraph.");
    builder.endBlock();
    builder.link("http://example.com/", "A link");
    builder.characters(" opens an implicit paragraph.");
    builder.endDocument();
    assertMarkup("A paragraph.\n\nlink:http://example.com/[A link] opens an implicit paragraph.\n\n");
}
Also used : ImageAttributes(org.eclipse.mylyn.wikitext.parser.ImageAttributes) LinkAttributes(org.eclipse.mylyn.wikitext.parser.LinkAttributes) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Test(org.junit.Test)

Example 25 with Attributes

use of org.eclipse.mylyn.wikitext.parser.Attributes in project mylyn.docs by eclipse.

the class AsciiDocDocumentBuilderTest method testPreformattedBlock.

@Test
public void testPreformattedBlock() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Paragraph:");
    builder.endBlock();
    builder.beginBlock(BlockType.PREFORMATTED, new Attributes());
    builder.characters("Code block.");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("Paragraph:\n\n[listing]\n----\nCode block.\n----\n\n");
}
Also used : ImageAttributes(org.eclipse.mylyn.wikitext.parser.ImageAttributes) LinkAttributes(org.eclipse.mylyn.wikitext.parser.LinkAttributes) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Test(org.junit.Test)

Aggregations

Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)428 LinkAttributes (org.eclipse.mylyn.wikitext.parser.LinkAttributes)248 ImageAttributes (org.eclipse.mylyn.wikitext.parser.ImageAttributes)223 Test (org.junit.Test)176 Matcher (java.util.regex.Matcher)33 ListAttributes (org.eclipse.mylyn.wikitext.parser.ListAttributes)29 TableAttributes (org.eclipse.mylyn.wikitext.parser.TableAttributes)17 StringWriter (java.io.StringWriter)14 BlockType (org.eclipse.mylyn.wikitext.parser.DocumentBuilder.BlockType)12 HtmlDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder)10 Pattern (java.util.regex.Pattern)9 DocumentBuilder (org.eclipse.mylyn.wikitext.parser.DocumentBuilder)9 SpanStrategies (org.eclipse.mylyn.wikitext.html.internal.SpanStrategies)8 Block (org.eclipse.mylyn.wikitext.parser.markup.Block)8 SpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SpanStrategy)6 SubstitutionBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy)6 SubstitutionSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionSpanStrategy)6 SubstitutionWithoutCssSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy)6 TableCellAttributes (org.eclipse.mylyn.wikitext.parser.TableCellAttributes)6 EventDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder)6