Search in sources :

Example 1 with SpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SpanStrategy 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 SpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SpanStrategy 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 SpanStrategy

use of org.eclipse.mylyn.wikitext.html.internal.SpanStrategy 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 SpanStrategy

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

the class SpanStrategiesTest method spanWithTextDecorationLinethroughToDeleted.

@Test
public void spanWithTextDecorationLinethroughToDeleted() {
    SpanStrategies strategies = new SpanStrategies(Sets.newHashSet(SpanType.DELETED), Collections.<SpanHtmlElementStrategy>emptyList());
    SpanStrategy strategy = strategies.getStrategy(SpanType.SPAN, new Attributes(null, null, "text-decoration:  line-through;", null));
    assertTrue(strategy instanceof SubstitutionWithoutCssSpanStrategy);
    assertEquals(SpanType.DELETED, ((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 5 with SpanStrategy

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

the class FontElementStrategyTest method spanStrategyBuildsNonHtml.

@Test
public void spanStrategyBuildsNonHtml() {
    EventDocumentBuilder builder = new EventDocumentBuilder();
    SpanStrategy spanStrategy = strategy.spanStrategy();
    spanStrategy.beginSpan(builder, SpanType.SPAN, new Attributes(null, null, "color: red", null));
    builder.characters("test");
    spanStrategy.endSpan(builder);
    assertEquals(Arrays.asList(new BeginSpanEvent(SpanType.SPAN, new Attributes(null, null, "color: red", null)), new CharactersEvent("test"), new EndSpanEvent()), builder.getDocumentBuilderEvents().getEvents());
}
Also used : SpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SpanStrategy) CharactersEvent(org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) 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) Test(org.junit.Test)

Aggregations

SpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SpanStrategy)6 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)6 Test (org.junit.Test)5 SpanStrategies (org.eclipse.mylyn.wikitext.html.internal.SpanStrategies)4 SubstitutionSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionSpanStrategy)4 SubstitutionWithoutCssSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy)4 SupportedSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SupportedSpanStrategy)4 UnsupportedSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.UnsupportedSpanStrategy)4 StringWriter (java.io.StringWriter)1 EventDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder)1 HtmlDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder)1 BeginSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent)1 CharactersEvent (org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent)1 EndSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.EndSpanEvent)1