Exemplo n.º 1
0
        public void TestHeadingPrefix()
        {
            header.Count(2);
            Assert.AreEqual("0.0.1.0.0.0", header.getHeadingNumbering(5));
            header.Count(3);
            Assert.AreEqual("0.0.1.1.0.0", header.getHeadingNumbering(5));
            header.Count(4);
            header.Count(4);
            Assert.AreEqual("0.0.1.1.2.0", header.getHeadingNumbering(5));
            header.Count(5);
            header.Count(5);
            header.Count(5);
            Assert.AreEqual("0.0.1.1.2.3", header.getHeadingNumbering(5));
            header.Reset(3);
            Assert.AreEqual("0.0.1.0.0.0", header.getHeadingNumbering(5));
            header.Count(1);
            Assert.AreEqual("0.1.0.0.0.0", header.getHeadingNumbering(5));

            header.ResetAll();
            Assert.AreEqual("0.0.0.0.0.0", header.getHeadingNumbering(5));
        }
Exemplo n.º 2
0
        protected override void OnPreProcessInternal(PonyTextStructureBase[] args)
        {
            int level = decimal.ToInt32((decimal)args[0].GetUnderlyingObject());

            ctx.GetCurrentContext().CustomProperty.SetProperty(RenderSettingField.HEADING_LEVEL, level);
            if (headerCounter.EnableNumbering)
            {
                string prefix = headerCounter.getHeadingNumbering(level - 1);
                headerCounter.Count(level - 1);
                WriteTextLiteral(prefix);
            }
            if (args.Length > 1)
            {
                args[1].Evaluate(ctx);
            }
            //WriteText(textElement);
        }