Search in sources :

Example 1 with SubstitutionBlockStrategy

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

the class BlockStrategiesTest method assertFallback.

protected void assertFallback(BlockType supportedType, BlockType blockType) {
    BlockStrategies strategies = new BlockStrategies(Sets.newHashSet(supportedType));
    BlockStrategy strategy = strategies.getStrategy(blockType, new Attributes());
    assertNotNull(strategy);
    assertEquals(blockType.name(), SubstitutionBlockStrategy.class, strategy.getClass());
    assertEquals(blockType.name(), supportedType, ((SubstitutionBlockStrategy) strategy).getBlockType());
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) UnsupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedBlockStrategy) NoOpBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.NoOpBlockStrategy) BlockStrategy(org.eclipse.mylyn.wikitext.html.internal.BlockStrategy) SupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SupportedBlockStrategy) SubstitutionBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy)

Example 2 with SubstitutionBlockStrategy

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

the class SubstitutionBlockStrategyTest method substitution.

@Test
public void substitution() {
    SubstitutionBlockStrategy strategy = new SubstitutionBlockStrategy(BlockType.PARAGRAPH);
    strategy.beginBlock(builder, BlockType.CODE, new Attributes());
    builder.characters("test");
    strategy.endBlock(builder);
    assertEquals("<p>test</p>", writer.toString());
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) SubstitutionBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy) Test(org.junit.Test)

Example 3 with SubstitutionBlockStrategy

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

the class BlockStrategiesTest method alternatives.

@Test
public void alternatives() {
    BlockStrategies strategies = new BlockStrategies(Sets.newHashSet(BlockType.PARAGRAPH));
    assertTrue(strategies.getStrategy(BlockType.CODE, new Attributes()) instanceof SubstitutionBlockStrategy);
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) SubstitutionBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy) BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) Test(org.junit.Test)

Aggregations

SubstitutionBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy)3 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)3 BlockStrategies (org.eclipse.mylyn.wikitext.html.internal.BlockStrategies)2 Test (org.junit.Test)2 BlockStrategy (org.eclipse.mylyn.wikitext.html.internal.BlockStrategy)1 NoOpBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.NoOpBlockStrategy)1 SupportedBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.SupportedBlockStrategy)1 UnsupportedBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.UnsupportedBlockStrategy)1