Пример #1
0
 private static String serialize(Span span, String content, DocumentLinkResolver linkResolver, HtmlSerializer htmlSerializer)
 {
     if (htmlSerializer != null)
     {
         String customHtml = htmlSerializer.Serialize(span, content);
         if (customHtml != null)
         {
             return(customHtml);
         }
     }
     if (span is Strong)
     {
         return("<strong>" + content + "</strong>");
     }
     if (span is Em)
     {
         return("<em>" + content + "</em>");
     }
     if (span is LabelSpan)
     {
         return("<span class=\"" + ((LabelSpan)span).Label + "\">" + content + "</span>");
     }
     if (span is Hyperlink)
     {
         Hyperlink hyperlink = (Hyperlink)span;
         if (hyperlink.Link is WebLink)
         {
             WebLink webLink = (WebLink)hyperlink.Link;
             return("<a href=\"" + webLink.Url + "\">" + content + "</a>");
         }
         else if (hyperlink.Link is FileLink)
         {
             FileLink fileLink = (FileLink)hyperlink.Link;
             return("<a href=\"" + fileLink.Url + "\">" + content + "</a>");
         }
         else if (hyperlink.Link is ImageLink)
         {
             ImageLink imageLink = (ImageLink)hyperlink.Link;
             return("<a href=\"" + imageLink.Url + "\">" + content + "</a>");
         }
         else if (hyperlink.Link is DocumentLink)
         {
             DocumentLink documentLink = (DocumentLink)hyperlink.Link;
             String       url          = linkResolver.Resolve(documentLink);
             return("<a " + (linkResolver.GetTitle(documentLink) == null ? "" : "title=\"" + linkResolver.GetTitle(documentLink) + "\" ") + "href=\"" + url + "\">" + content + "</a>");
         }
     }
     return("<span>" + content + "</span>");
 }
Пример #2
0
 public new String AsHtml(DocumentLinkResolver linkResolver)
 {
     return("<a " + (linkResolver.GetTitle(this) == null ? "" : "title=\"" + linkResolver.GetTitle(this) + "\" ") + "href=\"" + linkResolver.Resolve(this) + "\">" + slug + "</a>");
 }
Пример #3
0
 public new String AsHtml(DocumentLinkResolver linkResolver)
 {
     return ("<a " + (linkResolver.GetTitle(this) == null ? "" : "title=\"" + linkResolver.GetTitle(this) + "\" ") + "href=\"" + linkResolver.Resolve(this) + "\">" + slug + "</a>");
 }
Пример #4
0
 private static String serialize(Span span, String content, DocumentLinkResolver linkResolver, HtmlSerializer htmlSerializer)
 {
     if (htmlSerializer != null) {
         String customHtml = htmlSerializer.Serialize(span, content);
         if (customHtml != null) {
             return customHtml;
         }
     }
     if (span is Strong) {
         return "<strong>" + content + "</strong>";
     }
     if (span is Em) {
         return "<em>" + content + "</em>";
     }
     if (span is LabelSpan) {
         return "<span class=\"" + ((LabelSpan)span).Label + "\">" + content + "</span>";
     }
     if (span is Hyperlink) {
         Hyperlink hyperlink = (Hyperlink)span;
         if(hyperlink.Link is WebLink) {
             WebLink webLink = (WebLink)hyperlink.Link;
             return "<a href=\""+ webLink.Url + "\">" + content + "</a>";
         }
         else if(hyperlink.Link is FileLink) {
             FileLink fileLink = (FileLink)hyperlink.Link;
             return "<a href=\"" + fileLink.Url + "\">" + content + "</a>";
         }
         else if(hyperlink.Link is ImageLink) {
             ImageLink imageLink = (ImageLink)hyperlink.Link;
             return "<a href=\""+ imageLink.Url + "\">" + content + "</a>";
         }
         else if(hyperlink.Link is DocumentLink) {
             DocumentLink documentLink = (DocumentLink)hyperlink.Link;
             String url = linkResolver.Resolve(documentLink);
             return "<a " + (linkResolver.GetTitle(documentLink) == null ? "" : "title=\"" + linkResolver.GetTitle(documentLink) + "\" ") + "href=\""+ url+ "\">" + content + "</a>";
         }
     }
     return "<span>" + content + "</span>";
 }