public void executeScriptInstruction(IRenderExecutionContext context, docScriptInstructionCompiled instruction)
 {
 }
Пример #2
0
 public void executeScriptInstruction(IRenderExecutionContext context, docScriptInstructionCompiled instruction)
 {
     //  throw new NotImplementedException();
 }
        /// <summary>
        /// Executes the script instruction.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="instruction">The instruction.</param>
        public void executeScriptInstruction(IRenderExecutionContext context, docScriptInstructionCompiled instruction)
        {
            // outputRender.SubcontentStart(templateFieldSubcontent.main, false);

            if (outputRender is imbStringBuilderBase)
            {
                imbStringBuilderBase outputRender_imbStringBuilderBase = (imbStringBuilderBase)outputRender;
                outputRender_imbStringBuilderBase.data = context.data;
            }

            appendType final = runComplexInstruction(context, instruction);

            if (final != appendType.none)
            {
                final = runSpecialInstruction(context, instruction);
            }

            if (final == appendType.none)
            {
                // context.log("Complex instruction performed inside Output instruction");
                return;
            }

            if (outputRender is builderForMarkdown)
            {
                List <string> lines = new List <string>();
                if (instruction.containsKey(d.dsa_content))
                {
                    lines.AddRange((IEnumerable <string>)instruction[d.dsa_content]);
                }
                if (instruction.containsKey(d.dsa_contentLine))
                {
                    lines.Add((string)instruction[d.dsa_contentLine]);
                }
                for (int i = 0; i < lines.Count(); i++)
                {
                    outputRender.Append(lines[i], instruction.type, !instruction.isHorizontal);
                }
                return;
            }

            string str = instruction.getProperString(d.dsa_contentLine, d.dsa_title, d.dsa_description);

            appendRole role = instruction.getProperEnum <appendRole>(appendRole.paragraph, d.dsa_role);

            styleTextShot tshot = null;

            styleContainerShot sshot = null;

            if (role != appendRole.none)
            {
                tshot = new styleTextShot(role, context.theme);
                sshot = new styleContainerShot(role, instruction.type, context.theme);
            }
            else
            {
                tshot = new styleTextShot(instruction.type, context.theme);
            }

            //instruction.getProperObject<List<String>>(d.dsa_content);

            //if (lines == null) lines = instruction.getFirstOfType<List<String>>(true);

            //if (!str.isNullOrEmpty())
            //{
            //    lines.Add(str);
            //}

            //Boolean hasDocRender = false;
            //IDocumentRender docRender = outputRender as IDocumentRender; //builder.documentBuilder as IDocumentRender;

            //if (docRender != null)
            //{
            //    hasDocRender = true;
            //}

            //if (lines.Any())
            //{
            //    foreach (String logLine in lines)
            //    {
            //        //if (hasDocRender)
            //        //{
            //        //    if (tshot != null) docRender.ApplyStyle(tshot, builder.documentBuilder.c.getPencil(pencilType.point, 1));
            //        //    if (sshot != null) docRender.ApplyStyle(sshot, builder.documentBuilder.c.getPencil(pencilType.point, 1));
            //        //}
            //        outputRender.Append(logLine, instruction.type, !instruction.isHorizontal);

            //    }
            //}
            //else
            //{
            //    context.executionError("content and contentLine is missing for instruction", instruction);
            //}

            //  outputRender.SubcontentClose();

            //throw new NotImplementedException();
        }