Search in sources :

Example 31 with Attributes

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

the class AsciiDocDocumentBuilderTest method testEmptyBlock.

@Test
public void testEmptyBlock() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.endBlock();
    builder.endDocument();
    assertMarkup("");
}
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 32 with Attributes

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

the class AsciiDocDocumentBuilderTest method testParagraphConsecutive.

@Test
public void testParagraphConsecutive() {
    builder.beginDocument();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Paragraph 1");
    builder.endBlock();
    builder.beginBlock(BlockType.PARAGRAPH, new Attributes());
    builder.characters("Paragraph 2");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("Paragraph 1\n\nParagraph 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 33 with Attributes

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

the class AsciiDocDocumentBuilderTest method testLinkSpanEmptyAttributes.

@Test
public void testLinkSpanEmptyAttributes() {
    builder.beginDocument();
    builder.beginSpan(SpanType.LINK, new Attributes());
    builder.characters("http://example.com");
    builder.endSpan();
    builder.endDocument();
    assertMarkup("http://example.com\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 34 with Attributes

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

the class AsciiDocDocumentBuilderTest method testBlockQuote.

@Test
public void testBlockQuote() {
    builder.beginDocument();
    builder.beginBlock(BlockType.QUOTE, new Attributes());
    builder.characters("A quote by someone important.");
    builder.endBlock();
    builder.endDocument();
    assertMarkup("[quote]\n----\nA quote by someone important.\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 35 with Attributes

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

the class DefinitionListBlock method handleItem.

private void handleItem() {
    String key = matcher.group(1);
    String value = matcher.group(3);
    int keyOffset = matcher.start(1);
    int level = matcher.group(2).length();
    if (isCurrentLevel(level)) {
        closeItemBlockIfOpen();
    } else if (isNewLevel(level)) {
        openLevel(level);
    } else {
        dropToLevel(level);
    }
    state.setLineCharacterOffset(keyOffset);
    state.setLineSegmentEndOffset(keyOffset + key.length());
    // $NON-NLS-1$
    builder.beginBlock(BlockType.DEFINITION_TERM, new Attributes(null, "hdlist1", null, null));
    markupLanguage.emitMarkupLine(parser, state, keyOffset, key, 0);
    builder.endBlock();
    if (value != null) {
        int valueOffset = matcher.start(3);
        openItemBlock(value, valueOffset);
    }
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) ListAttributes(org.eclipse.mylyn.wikitext.parser.ListAttributes)

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