Search in sources :

Example 96 with Attributes

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

the class TextileTest method testLeftPaddingCssClass.

public void testLeftPaddingCssClass() {
    Pattern pattern = Pattern.compile("h1" + Textile.REGEX_BLOCK_ATTRIBUTES + "\\. (.*)?");
    Matcher matcher = pattern.matcher("h1(((foo). foo");
    assertTrue(matcher.matches());
    Attributes attributes = new Attributes();
    Textile.configureAttributes(attributes, matcher, 1, true);
    assertEquals("padding-left: 2em;", attributes.getCssStyle());
    assertEquals("foo", attributes.getCssClass());
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes)

Example 97 with Attributes

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

the class TextileTest method testRightAlignment.

public void testRightAlignment() {
    Pattern pattern = Pattern.compile("h1" + Textile.REGEX_BLOCK_ATTRIBUTES + "\\. (.*)?");
    Matcher matcher = pattern.matcher("h1>. foo");
    assertTrue(matcher.matches());
    Attributes attributes = new Attributes();
    Textile.configureAttributes(attributes, matcher, 1, true);
    assertEquals("text-align: right;", attributes.getCssStyle());
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes)

Example 98 with Attributes

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

the class TextileTest method testLeftAlignment.

public void testLeftAlignment() {
    Pattern pattern = Pattern.compile("h1" + Textile.REGEX_BLOCK_ATTRIBUTES + "\\. (.*)?");
    Matcher matcher = pattern.matcher("h1<. foo");
    assertTrue(matcher.matches());
    Attributes attributes = new Attributes();
    Textile.configureAttributes(attributes, matcher, 1, true);
    assertEquals("text-align: left;", attributes.getCssStyle());
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes)

Example 99 with Attributes

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

the class TextileTest method testLeftPadding.

public void testLeftPadding() {
    Pattern pattern = Pattern.compile("h1" + Textile.REGEX_BLOCK_ATTRIBUTES + "\\. (.*)?");
    Matcher matcher = pattern.matcher("h1((. foo");
    assertTrue(matcher.matches());
    Attributes attributes = new Attributes();
    Textile.configureAttributes(attributes, matcher, 1, true);
    assertEquals("padding-left: 2em;", attributes.getCssStyle());
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes)

Example 100 with Attributes

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

the class FootnoteBlock method processLineContent.

@Override
public int processLineContent(String line, int offset) {
    if (blockLineCount == 0) {
        Attributes attributes = new Attributes();
        // $NON-NLS-1$
        attributes.setCssClass("footnote");
        // 0-offset matches may start with the "fnnn. " prefix.
        footnote = matcher.group(1);
        ((TextileContentState) state).footnoteBlockDetected(footnote);
        attributes.setId(state.getFootnoteId(footnote));
        Textile.configureAttributes(attributes, matcher, 2, true);
        offset = matcher.start(LINE_REMAINDER_GROUP_OFFSET);
        builder.beginBlock(BlockType.PARAGRAPH, attributes);
        builder.beginSpan(SpanType.SUPERSCRIPT, new Attributes());
        builder.characters(footnote);
        builder.endSpan();
        // $NON-NLS-1$
        builder.characters(" ");
    }
    if (markupLanguage.isEmptyLine(line)) {
        setClosed(true);
        return 0;
    }
    if (blockLineCount != 0) {
        builder.lineBreak();
    }
    ++blockLineCount;
    getMarkupLanguage().emitMarkupLine(getParser(), state, line, offset);
    return -1;
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) TextileContentState(org.eclipse.mylyn.wikitext.textile.internal.TextileContentState)

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