Ejemplo n.º 1
0
        protected override void OnPreProcessInternal(PonyTextStructureBase[] args)
        {
            AbstractTextElement abstractText = GetText(args[0]);

            abstractText.CustomProperty.SetProperty(MarkdownRenderSetting.MD_REGION_INLINE, MarkdownRenderSetting.MD_REGION_CODE);
            WriteText(abstractText);
        }
Ejemplo n.º 2
0
 protected PonyTextContext(AbstractTextElement textElement, IProcessorFactory processorFactory)
 {
     this.textElement = textElement;
     ProcessorFactory = processorFactory;
     MacroTable       = new MacroTable();
     ContextProperty  = new PropertyConfiguration();
     Metadata         = new ContextMetadata();
 }
Ejemplo n.º 3
0
 protected void WriteText(AbstractTextElement text, bool avaliableInRenderSatge = false)
 {
     if (avaliableInRenderSatge)
     {
         text.CustomProperty.SetProperty(RENDER_PROCESSOR_PROPERTY, ProcessorAttribute.ProcessorName);
     }
     ctx.WriteTextElement(text);
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
                }
            }
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
 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);
             }
         }
     }
 }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
 protected virtual void OnPostRenderInternal(AbstractTextElement textElement, AbstractRendererBase rendererBase)
 {
 }
Ejemplo n.º 15
0
 public DerivedTextContext(PonyTextContext origin, AbstractTextElement newConext) : base()
 {
     this.origin = origin;
     textElement = newConext;
 }
Ejemplo n.º 16
0
 protected override void OnPreRenderInternal(AbstractTextElement textElement, AbstractRendererBase rendererBase)
 {
 }
Ejemplo n.º 17
0
 public virtual void WriteTextElement(AbstractTextElement text)
 {
     textElement.AddTextElement(text);
 }
Ejemplo n.º 18
0
 public void PostRendering(PonyTextContext context, AbstractRendererBase rendererBase, AbstractTextElement textElement)
 {
     ctx = context;
     OnPostRenderInternal(textElement, rendererBase);
 }
Ejemplo n.º 19
0
 public override void AddTextElement(AbstractTextElement textElement)
 {
     // nothing todo
 }
Ejemplo n.º 20
0
        protected void WriteTextLiteral(string literal, bool avaliableInRenderSatge = false)
        {
            AbstractTextElement textElement = TextElementFactory.CreateTextElement(TextElementType.TextUnit, literal);

            WriteText(textElement, avaliableInRenderSatge);
        }
Ejemplo n.º 21
0
 public override void AddTextElement(AbstractTextElement textElement)
 {
     throw new NotImplementedException();
 }