Search in sources :

Example 26 with Attributes

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

the class AsciiDocDocumentBuilderTest method testUnsupportedBlock.

@Test
public void testUnsupportedBlock() {
    builder.beginDocument();
    builder.beginBlock(BlockType.FOOTNOTE, new Attributes());
    builder.characters("unsupported");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("unsupported\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 27 with Attributes

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

the class AsciiDocDocumentBuilderTest method testBlockQuoteNestedList.

@Test
public void testBlockQuoteNestedList() {
    builder.beginDocument();
    builder.beginBlock(BlockType.QUOTE, new Attributes());
    builder.beginHeading(2, new Attributes());
    builder.characters("Header.");
    builder.endHeading();
    builder.beginBlock(BlockType.BULLETED_LIST, new Attributes());
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.characters("First item.");
    builder.endBlock();
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.characters("Second item.");
    builder.endBlock();
    builder.endBlock();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Lorem Ipsum");
    builder.endBlock();
    builder.endBlock();
    builder.endDocument();
    assertMarkup("[quote]\n----\n== Header.\n\n* First item.\n* Second item.\n\nLorem Ipsum\n\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 28 with Attributes

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

the class AsciiDocDocumentBuilderTest method testListItemWithHangingParagraph.

@Test
public void testListItemWithHangingParagraph() {
    builder.beginDocument();
    builder.beginBlock(BlockType.BULLETED_LIST, new Attributes());
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("List item with two paragraphs.");
    builder.endBlock();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Second paragraph.");
    builder.endBlock();
    builder.endBlock();
    builder.beginBlock(BlockType.LIST_ITEM, new Attributes());
    builder.characters("Simple list item.");
    builder.endBlock();
    builder.endBlock();
    builder.endDocument();
    assertMarkup("* List item with two paragraphs.\n\nSecond paragraph.\n\n* Simple list item.\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 29 with Attributes

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

the class AsciiDocDocumentBuilderTest method testParagraph.

@Test
public void testParagraph() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("A paragraph ends when a blank line begins!");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("A paragraph ends when a blank line begins!\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 30 with Attributes

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

the class AsciiDocDocumentBuilderTest method testDiv.

@Test
public void testDiv() {
    builder.beginDocument();
    builder.beginBlock(BlockType.DIV, new Attributes());
    builder.characters("A div.");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("A div.");
}
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