コード例 #1
0
ファイル: SlugTests.cs プロジェクト: Biswo/n2cms
        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);
        }
コード例 #2
0
ファイル: SlugTests.cs プロジェクト: Biswo/n2cms
        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);
        }
コード例 #3
0
ファイル: SlugTests.cs プロジェクト: Biswo/n2cms
        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);
        }
コード例 #4
0
ファイル: NameEditor.cs プロジェクト: amarwadi/n2cms
        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;
        }