protected override void OnPreProcessInternal(PonyTextStructureBase[] args)
        {
            Dictionary <string, object> config = CreatePrimitiveMapping(args[0]);

            config.ApplyConfigTo <string>(HeaderCounter.ConfigEnableNumbering, (val) => {
                headerCounter.EnableNumbering = val.Equals("true");
            });

            config.ApplyConfigTo <decimal>(HeaderCounter.ConfigStartingNumber, (val) => {
                headerCounter.StartNumber = decimal.ToInt32(val);
                headerCounter.ResetAll();
            });

            foreach (var item in config)
            {
                if (item.Key.StartsWith(HeaderCounter.ConfigLevel))
                {
                    string level        = item.Key[HeaderCounter.ConfigLevel.Length..];
Exemplo n.º 2
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));
        }