Search in sources :

Example 1 with PatternBasedElementProcessor

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

the class CssClassPhraseModifier method newProcessor.

@Override
protected PatternBasedElementProcessor newProcessor() {
    return new PatternBasedElementProcessor() {

        @Override
        public void emit() {
            Attributes attributes = new Attributes();
            SpanType span = SpanType.SPAN;
            String cssClass = group(1);
            if (cssClass != null && !cssClass.isEmpty()) {
                attributes.setCssClass(cssClass);
            } else {
                span = SpanType.MARK;
            }
            getBuilder().beginSpan(span, attributes);
            getBuilder().characters(group(2));
            getBuilder().endSpan();
        }
    };
}
Also used : SpanType(org.eclipse.mylyn.wikitext.parser.DocumentBuilder.SpanType) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) PatternBasedElementProcessor(org.eclipse.mylyn.wikitext.parser.markup.PatternBasedElementProcessor)

Aggregations

Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)1 SpanType (org.eclipse.mylyn.wikitext.parser.DocumentBuilder.SpanType)1 PatternBasedElementProcessor (org.eclipse.mylyn.wikitext.parser.markup.PatternBasedElementProcessor)1