protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { AbstractTextElement abstractText = GetText(args[0]); abstractText.CustomProperty.SetProperty(MarkdownRenderSetting.MD_REGION_INLINE, MarkdownRenderSetting.MD_REGION_CODE); WriteText(abstractText); }
protected PonyTextContext(AbstractTextElement textElement, IProcessorFactory processorFactory) { this.textElement = textElement; ProcessorFactory = processorFactory; MacroTable = new MacroTable(); ContextProperty = new PropertyConfiguration(); Metadata = new ContextMetadata(); }
protected void WriteText(AbstractTextElement text, bool avaliableInRenderSatge = false) { if (avaliableInRenderSatge) { text.CustomProperty.SetProperty(RENDER_PROCESSOR_PROPERTY, ProcessorAttribute.ProcessorName); } ctx.WriteTextElement(text); }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { foreach (var item in args) { AbstractTextElement textElement = GetText(item); textElement.CustomProperty.AppendProperty(RenderSettingField.TEXT_STYLE, RenderSettingField.TEXT_STYLE_DELETELINE); WriteText(textElement); } }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { Dictionary <string, object> style = CreatePrimitiveMapping(args[0]); for (int i = 1; i < args.Length; i++) { var item = args[i]; AbstractTextElement textElement = GetText(item); textElement.CustomProperty.Merge(style); WriteText(textElement); } }
protected override void OnPostRenderInternal(AbstractTextElement textElement, AbstractRendererBase rendererBase) { string opt; if (rendererBase.PropertyChain.TryGetProperty(MarkdownRenderSetting.MD_REGION, out opt)) { if (opt == MarkdownRenderSetting.MD_REGION_CODE) { rendererBase.RenderText("```\r\n", null); } } }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { string format = "D"; if (args.Length == 1) { AbstractTextElement abstractTextElement = GetText(args[0]); if (abstractTextElement.TextElementType == TextElementType.TextUnit) { format = (abstractTextElement as TextUnit).Content; } } WriteTextLiteral(DateTime.Now.ToString(format)); }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { AbstractTextElement abstractTextElement = GetText(args[1]); string type = args[0].GetUnderlyingObject() as string; if (abstractTextElement.TextElementType == TextElementType.TextUnit) { AbstractTextElement paragraph = ctx.TextElementFactory.CreateTextElement(TextElementType.Paragraph); paragraph.AddTextElement(abstractTextElement); abstractTextElement = paragraph; } abstractTextElement.CustomProperty.SetProperty(MarkdownRenderSetting.MD_REGION, type); WriteText(abstractTextElement, true); }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { string title = args[0].GetUnderlyingObject() as string; AbstractTextElement text = TextElementFactory.CreateTextElement(TextElementType.Paragraph, title); text.CustomProperty.SetProperty(RenderSettingField.HORIZONTAL_ALIGN, RenderSettingField.ALIGN_VH_MID); text.CustomProperty.SetProperty(RenderSettingField.VERTICAL_ALIGN, RenderSettingField.ALIGN_VH_MID); text.CustomProperty.SetProperty(RenderSettingField.TEXT_FONTSIZE, "26"); if (args.Length == 2) { text.CustomProperty.Merge(CreatePrimitiveMapping(args[1])); } WriteText(text); }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { AbstractTextElement abstractText = TextElementFactory.CreateTextElement(TextElementType.TextUnit); PropertyConfiguration configuration = abstractText.CustomProperty; if (args.Length == 2) { configuration.Merge(CreatePrimitiveMapping(args[1])); } string path = ctx.Metadata.GetAbsolutePath(args[0].GetUnderlyingObject() as string); configuration.SetProperty("utype", "img"); configuration.SetProperty("path", path); WriteText(abstractText); }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { AbstractTextElement abstractText = GetText(args[0]); string halignDirection = args[1].GetUnderlyingObject() as string; abstractText.CustomProperty.SetProperty(RenderSettingField.HORIZONTAL_ALIGN, halignDirection); if (args.Length >= 3) { string valignDirection = args[2].GetUnderlyingObject() as string; abstractText.CustomProperty.SetProperty(RenderSettingField.VERTICAL_ALIGN, valignDirection); } if (args.Length == 4) { abstractText.CustomProperty.Merge(CreatePrimitiveMapping(args[3])); } WriteText(abstractText); }
protected override void OnPreProcessInternal(PonyTextStructureBase[] args) { foreach (var item in args) { AbstractTextElement element = GetText(item); if (element.TextElementType == TextElementType.TextUnit) { WriteText(element); } else { foreach (var text in element.UnfoldToAtomic()) { WriteText(text); } } } }
public static List <AbstractTextElement> UnfoldToAtomic(this AbstractTextElement textElement) { var textElements = new List <AbstractTextElement>(); switch (textElement.TextElementType) { case TextElementType.TextUnit: textElements.Add(textElement); break; case TextElementType.TextElementCollection: var collection = (TextElementCollection)textElement; foreach (var item in collection) { var atomics = item.UnfoldToAtomic(); foreach (var atomic in atomics) { atomic.CustomProperty.Merge(collection.CustomProperty.ToDictionary()); textElements.Add(atomic); } } break; case TextElementType.Paragraph: var paragraph = (Paragraph)textElement; foreach (var item in paragraph) { item.CustomProperty.Merge(paragraph.CustomProperty.ToDictionary()); textElements.Add(item); } break; default: break; } return(textElements); }
protected virtual void OnPostRenderInternal(AbstractTextElement textElement, AbstractRendererBase rendererBase) { }
public DerivedTextContext(PonyTextContext origin, AbstractTextElement newConext) : base() { this.origin = origin; textElement = newConext; }
protected override void OnPreRenderInternal(AbstractTextElement textElement, AbstractRendererBase rendererBase) { }
public virtual void WriteTextElement(AbstractTextElement text) { textElement.AddTextElement(text); }
public void PostRendering(PonyTextContext context, AbstractRendererBase rendererBase, AbstractTextElement textElement) { ctx = context; OnPostRenderInternal(textElement, rendererBase); }
public override void AddTextElement(AbstractTextElement textElement) { // nothing todo }
protected void WriteTextLiteral(string literal, bool avaliableInRenderSatge = false) { AbstractTextElement textElement = TextElementFactory.CreateTextElement(TextElementType.TextUnit, literal); WriteText(textElement, avaliableInRenderSatge); }
public override void AddTextElement(AbstractTextElement textElement) { throw new NotImplementedException(); }