예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context">Processing context</param>
        /// <returns></returns>
        public void ProcessHtml(PostLoadProcessorContext context)
        {
            int pos = context.HtmlBody.IndexOf("[:child-pages]", System.StringComparison.Ordinal);
            if (pos != -1)
            {
                string html = @"<ul class=""child-pages"">";
                foreach (var child in context.Page.Children)
                {
                    var relative = context.Page.PagePath.GetPathRelativeTo(child.PagePath);
                    html += string.Format(@"<li><a href=""{0}/"" class=""wiki-link"">{1}</a></li>", relative, child.Title);
                }

                html += "</ul>\r\n";
                context.HtmlBody = context.HtmlBody.Substring(0, pos) + html + context.HtmlBody.Substring(pos + 14);
            }
        }
        /// <summary>
        ///   Process wiki body
        /// </summary>
        /// <param name="context"> Page to process </param>
        /// <returns> Processed HTML body </returns>
        public void Process(PostLoadProcessorContext context)
        {
            var generationExceptions = new List<Exception>();
            foreach (var postProcessor in _processors)
            {
                try
                {
                    postProcessor.ProcessHtml(context);
                }
                catch (Exception err)
                {
                    generationExceptions.Add(err);
                }
            }

            if (generationExceptions.Any())
            {
                throw new TargetInvocationErrorsException("Failed to post load process context " + context,
                                                          generationExceptions);
            }
        }
예제 #3
0
 public void ProcessHtml(PostLoadProcessorContext context)
 {
     context.HtmlBody = Regex.Replace(context.HtmlBody, @"<a href=""(.*)""", Evaluator);
 }