Пример #1
0
        /// <summary>
        /// Adds a list of ignored paths anytime new assets are introduced into the current instance.
        /// </summary>
        /// <param name="source">an asset or panel to read values from</param>
        /// <param name="field">field to read</param>
        /// <returns></returns>
        public SitemapBuilder AddIgnoredPaths(CrownPeak.CMSAPI.CustomLibrary.IFieldAccessor source, string field = Constants.FieldNames.SitemapInput_IgnoredPaths)
        {
            var ignoredPathsRegexArray =
                SitemapUtils.SplitMultilineInput(source.Raw[field])
                .Select(_ => CPContrib.SiteMap.SitemapUtils.PathspecToRegex(_)).ToArray();

            this._IgnoredPaths.AddRange(ignoredPathsRegexArray);

            return(this);
        }
Пример #2
0
        /// <summary>
        /// Splits the input into an IEnumerable&lt;string&gt;
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        internal static IEnumerable <string> SplitMultilineInput(string value, bool filterComments = true)
        {
            IEnumerable <string> split = value.Replace("\r\n", "\n").Split('\n');

            if (filterComments)
            {
                split = SitemapUtils.FilterComments(split);
            }

            return(split);
        }