Esempio n. 1
0
        private Slug CreateDefaultSlug()
        {
            NameEditorElement nameEditorElement = new NameEditorElement();
            EditSection editSection = new EditSection { NameEditor = nameEditorElement };

            ConfigurationManagerWrapper cmw = new ConfigurationManagerWrapper
            {
                Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, editSection)
            };

            return new Slug(cmw);
        }
Esempio n. 2
0
        private Slug CreateLowercaseSlug()
        {
            NameEditorElement nameEditorElement = new NameEditorElement
            {
                WhitespaceReplacement = '-',
                Replacements = new PatternValueCollection(),
                ToLower = true
            };

            EditSection editSection = new EditSection { NameEditor = nameEditorElement };

            ConfigurationManagerWrapper cmw = new ConfigurationManagerWrapper
            {
                Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, editSection)
            };

            return new Slug(cmw);
        }
Esempio n. 3
0
        private Slug CreateCustomReplacementSlug()
        {
            PatternValueCollection patterns = new PatternValueCollection();
            patterns.Clear(); // to remove all those added by constructor
            patterns.Add(new PatternValueElement("c1", "[@]", "at", true));

            NameEditorElement nameEditorElement = new NameEditorElement
            {
                // WhitespaceReplacement = '-',
                Replacements = patterns //,
                // ToLower = true
            };

            EditSection editSection = new EditSection { NameEditor = nameEditorElement };

            ConfigurationManagerWrapper cmw = new ConfigurationManagerWrapper
            {
                Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, editSection)
            };

            return new Slug(cmw);
        }
Esempio n. 4
0
        private static NameEditorElement LoadConfiguration()
        {
            EditSection editSection = ConfigurationManager.GetSection("n2/edit") as EditSection;
            if (editSection != null)
                return editSection.NameEditor;

            NameEditorElement config = new NameEditorElement();
            config.WhitespaceReplacement = '-';
            config.ShowKeepUpdated = true;
            config.ToLower = true;
            return config;
        }