Search in sources :

Example 6 with Attributes

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

the class AsciiDocDocumentBuilderTest method testTable.

@Test
public void testTable() {
    builder.beginDocument();
    builder.beginBlock(BlockType.TABLE, new Attributes());
    builder.beginBlock(BlockType.TABLE_ROW, new Attributes());
    builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
    builder.characters("cell 1");
    builder.endBlock();
    builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
    builder.characters("cell 2");
    builder.endBlock();
    builder.endBlock();
    builder.beginBlock(BlockType.TABLE_ROW, new Attributes());
    builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
    builder.characters("cell a");
    builder.endBlock();
    builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
    builder.characters("cell b");
    builder.endBlock();
    builder.endBlock();
    builder.beginBlock(BlockType.TABLE_ROW, new Attributes());
    builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
    builder.characters("cell A");
    builder.endBlock();
    builder.beginBlock(BlockType.TABLE_CELL_NORMAL, new Attributes());
    builder.characters("cell B");
    builder.endBlock();
    builder.endBlock();
    builder.endBlock();
    builder.endDocument();
    assertMarkup("|===\n|cell 1 |cell 2 \n\n|cell a |cell b \n\n|cell A |cell B \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 7 with Attributes

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

the class AsciiDocDocumentBuilderTest method testCodeBlockConsecutive.

@Test
public void testCodeBlockConsecutive() {
    builder.beginDocument();
    builder.beginBlock(BlockType.CODE, new Attributes());
    builder.characters("// comment");
    builder.endBlock();
    builder.beginBlock(BlockType.CODE, new Attributes());
    builder.characters("code();");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("[listing]\n----\n// comment\n----\n\n[listing]\n----\ncode();\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)

Example 8 with Attributes

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

the class AsciiDocDocumentBuilderTest method testSuperscript.

@Test
public void testSuperscript() {
    builder.beginDocument();
    builder.beginSpan(SpanType.SUPERSCRIPT, new Attributes());
    builder.characters("superscript");
    builder.endSpan();
    builder.endDocument();
    assertMarkup("^superscript^\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 9 with Attributes

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

the class AsciiDocDocumentBuilderTest method testHighlight.

@Test
public void testHighlight() {
    builder.beginDocument();
    builder.beginSpan(SpanType.MARK, new Attributes());
    builder.characters("highlight");
    builder.endSpan();
    builder.endDocument();
    assertMarkup("#highlight#\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 10 with Attributes

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

the class AsciiDocDocumentBuilderTest method testImageImplicitParagraph.

@Test
public void testImageImplicitParagraph() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Below is an image:");
    builder.endBlock();
    builder.image(new ImageAttributes(), "/path/to/img.jpg");
    builder.endDocument();
    assertMarkup("Below is an image:\n\nimage:/path/to/img.jpg[]\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) ImageAttributes(org.eclipse.mylyn.wikitext.parser.ImageAttributes) 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