Search in sources :

Example 1 with SubstitutionWithoutCssSpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy in project mylyn.docs by eclipse.

the class SpanStrategiesTest method spanWithTextDecorationUnderlineToUnderlined.

@Test
public void spanWithTextDecorationUnderlineToUnderlined() {
    SpanStrategies strategies = new SpanStrategies(Sets.newHashSet(SpanType.UNDERLINED), Collections.<SpanHtmlElementStrategy>emptyList());
    SpanStrategy strategy = strategies.getStrategy(SpanType.SPAN, new Attributes(null, null, "text-decoration:  underline;", null));
    assertTrue(strategy instanceof SubstitutionWithoutCssSpanStrategy);
    assertEquals(SpanType.UNDERLINED, ((SubstitutionWithoutCssSpanStrategy) strategy).getType());
}
Also used : SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) SupportedSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SupportedSpanStrategy) UnsupportedSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedSpanStrategy) SubstitutionSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionSpanStrategy) SpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SpanStrategy) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) SpanStrategies(org.eclipse.mylyn.wikitext.html.internal.SpanStrategies) SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) Test(org.junit.Test)

Example 2 with SubstitutionWithoutCssSpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy in project mylyn.docs by eclipse.

the class SpanStrategiesTest method spanWithFontWeightToBold.

@Test
public void spanWithFontWeightToBold() {
    SpanStrategies strategies = new SpanStrategies(Sets.newHashSet(SpanType.BOLD), Collections.<SpanHtmlElementStrategy>emptyList());
    SpanStrategy strategy = strategies.getStrategy(SpanType.SPAN, new Attributes(null, null, "font-weight:  bold", null));
    assertTrue(strategy instanceof SubstitutionWithoutCssSpanStrategy);
    assertEquals(SpanType.BOLD, ((SubstitutionWithoutCssSpanStrategy) strategy).getType());
}
Also used : SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) SupportedSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SupportedSpanStrategy) UnsupportedSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedSpanStrategy) SubstitutionSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionSpanStrategy) SpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SpanStrategy) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) SpanStrategies(org.eclipse.mylyn.wikitext.html.internal.SpanStrategies) SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) Test(org.junit.Test)

Example 3 with SubstitutionWithoutCssSpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy in project mylyn.docs by eclipse.

the class SpanStrategiesTest method spanWithFontWeightToStrong.

@Test
public void spanWithFontWeightToStrong() {
    SpanStrategies strategies = new SpanStrategies(Sets.newHashSet(SpanType.STRONG), Collections.<SpanHtmlElementStrategy>emptyList());
    SpanStrategy strategy = strategies.getStrategy(SpanType.SPAN, new Attributes(null, null, "font-weight:  bold", null));
    assertTrue(strategy instanceof SubstitutionWithoutCssSpanStrategy);
    assertEquals(SpanType.STRONG, ((SubstitutionWithoutCssSpanStrategy) strategy).getType());
}
Also used : SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) SupportedSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SupportedSpanStrategy) UnsupportedSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedSpanStrategy) SubstitutionSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionSpanStrategy) SpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SpanStrategy) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) SpanStrategies(org.eclipse.mylyn.wikitext.html.internal.SpanStrategies) SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) Test(org.junit.Test)

Example 4 with SubstitutionWithoutCssSpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy in project mylyn.docs by eclipse.

the class SubstitutionWithoutCssSpanStrategyTest method test.

@Test
public void test() {
    SubstitutionWithoutCssSpanStrategy strategy = new SubstitutionWithoutCssSpanStrategy(SpanType.BOLD);
    EventDocumentBuilder builder = new EventDocumentBuilder();
    strategy.beginSpan(builder, SpanType.ITALIC, new Attributes("1", "class", "style", "lang"));
    List<DocumentBuilderEvent> events = builder.getDocumentBuilderEvents().getEvents();
    assertEquals(ImmutableList.of(new BeginSpanEvent(SpanType.BOLD, new Attributes("1", "class", null, "lang"))), events);
}
Also used : DocumentBuilderEvent(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BeginSpanEvent(org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent) SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) Test(org.junit.Test)

Example 5 with SubstitutionWithoutCssSpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy in project mylyn.docs by eclipse.

the class CompositeSpanStrategyTest method test.

@Test
public void test() {
    CompositeSpanStrategy strategy = new CompositeSpanStrategy(Lists.<SpanStrategy>newArrayList(new SubstitutionWithoutCssSpanStrategy(SpanType.BOLD), new SubstitutionWithoutCssSpanStrategy(SpanType.ITALIC)));
    EventDocumentBuilder builder = new EventDocumentBuilder();
    strategy.beginSpan(builder, SpanType.DELETED, new Attributes());
    strategy.endSpan(builder);
    DocumentBuilderEvents events = builder.getDocumentBuilderEvents();
    assertEquals(ImmutableList.of(new BeginSpanEvent(SpanType.BOLD, new Attributes()), new BeginSpanEvent(SpanType.ITALIC, new Attributes()), new EndSpanEvent(), new EndSpanEvent()), events.getEvents());
}
Also used : DocumentBuilderEvents(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) CompositeSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.CompositeSpanStrategy) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BeginSpanEvent(org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent) EndSpanEvent(org.eclipse.mylyn.wikitext.parser.builder.event.EndSpanEvent) SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) Test(org.junit.Test)

Aggregations

SubstitutionWithoutCssSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy)6 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)6 Test (org.junit.Test)6 SpanStrategies (org.eclipse.mylyn.wikitext.html.internal.SpanStrategies)4 SpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SpanStrategy)4 SubstitutionSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionSpanStrategy)4 SupportedSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SupportedSpanStrategy)4 UnsupportedSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.UnsupportedSpanStrategy)4 EventDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder)2 BeginSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent)2 CompositeSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.CompositeSpanStrategy)1 DocumentBuilderEvent (org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent)1 DocumentBuilderEvents (org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents)1 EndSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.EndSpanEvent)1