This project is read-only.
1
Vote

InstanceBlockModifier

description

Hello,

I want to change the source of images. I'll add blocModifier by Instance

In the class 'TextileFormatter',

I have add :
private List<BlockModifier> _instanceBlockModifiers = new List<BlockModifier>();

public void RegisterByInstanceBlockModifier(BlockModifier blockModifer) {
   _instanceBlockModifiers.Add(blockModifer);            
}
and in the format method :
List<BlockModifier> blocks = new List<BlockModifier>(s_blockModifiers);
blocks.AddRange(_instanceBlockModifiers);

 // Modify the line with our block modifiers.
 if (CurrentState == null || CurrentState.ShouldFormatBlocks(tmp))
 {
        foreach (BlockModifier blockModifier in blocks)
So I can do :
StringBuilderTextileFormatter s = new StringBuilderTextileFormatter();
TextileFormatter f = new TextileFormatter(s);
f.RegisterByInstanceBlockModifier(new MyImageBlockModifier(
      url => {  return CustomerMyUrl(url); }
));
 f.Format(textile);

comments