Exemplo n.º 1
0
 public void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = _standardLink.Replace(content.Html, match => BuildLink(context, match.Groups["Foo"].Value, match.Groups["Foo"].Value, null));
     content.Html = _anchoredLink.Replace(content.Html, match => BuildLink(context, match.Groups["Foo"].Value, match.Groups["Foo"].Value, match.Groups["Bar"].Value));
     content.Html = _namedLink.Replace(content.Html, match => BuildLink(context, match.Groups["Foo"].Value, match.Groups["Foobar"].Value, null));
     content.Html = _namedAnchoredLink.Replace(content.Html, match => BuildLink(context, match.Groups["Foo"].Value, match.Groups["Foobar"].Value, match.Groups["Bar"].Value));
 }
Exemplo n.º 2
0
 public override void Apply(Content content, MarkupRendererContext context)
 {
     var match = Expression.Match(content.Html);
     if (match.Success)
     {
         content.Parent = match.Groups["parent"].Value;
         content.Html = Expression.Replace(content.Html, "");
     }
 }
Exemplo n.º 3
0
 public Content Render(string markupContent)
 {
     var content = new Content() { Html = markupContent };
     foreach (var formatter in _formatters)
     {
         formatter.Apply(content, _context);
     }
     return content;
 }
Exemplo n.º 4
0
 public void Apply(Content content, MarkupRendererContext context)
 {
     var lines = content.Html.Split('\n');
     var writer = new HtmlParagraphWriter();
     foreach (var line in lines)
     {
         writer.WriteLine(line);
     }
     content.Html = writer.ToString();
 }
Exemplo n.º 5
0
 public override void Apply(Content content, MarkupRendererContext context)
 {
     var match = Expression.Match(content.Html);
     while (match != null && match.Success)
     {
         var tagname = "h" + (match.Groups[1].Value.Length + 1);
         content.Html = content.Html.Replace(match.Groups[0].Value, string.Format("<{0}>{1}</{0}>\r\n\r\n", tagname, match.Groups[2].Value));
         match = Expression.Match(content.Html);
     }
 }
Exemplo n.º 6
0
 public override void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = Expression.Replace(content.Html,
         delegate (Match match)
             {
                 var childContent = context.LoadSiblingContent(match.Groups["path"].Value);
                 if (childContent == null) return "";
                 content.SourceFiles.AddRange(childContent.SourceFiles);
                 return childContent.Html;
             }
         );
 }
Exemplo n.º 7
0
 public override void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = Expression.Replace(content.Html,
         delegate (Match match)
             {
                 var image = context.ResolveContentAttachmentPath(match.Groups["image"].Value);
                 var builder = new StringBuilder();
                 builder.AppendLine("<div class='image'>");
                 builder.AppendFormat("<img src='{0}' alt='Image {1}: {2}' />", image, match.Groups["index"].Value, match.Groups["caption"]).AppendLine();
                 builder.AppendFormat("<div>Image {0}: {1}</div>", match.Groups["index"].Value, match.Groups["caption"]);
                 builder.AppendLine("</div>");
                 return builder.ToString();
             }
         );
 }
Exemplo n.º 8
0
 public override void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = Expression.Replace(content.Html, "$1<strong>$2</strong>");
 }
 public override void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = Expression.Replace(content.Html, "<hr />");
 }
Exemplo n.º 10
0
 public void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = _listMatcher.Replace(content.Html, MatchFormatter);
 }
Exemplo n.º 11
0
 public void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = content.Html.Replace("\\", "");
 }
Exemplo n.º 12
0
 public abstract void Apply(Content content, MarkupRendererContext context);
Exemplo n.º 13
0
 public override void Apply(Content content, MarkupRendererContext context)
 {
     content.Html = Expression.Replace(content.Html, "<blockquote><p>${Quote}</p><p><span class='author'>${Author}</span></p></blockquote>");
 }