예제 #1
0
                public String AsHtml(DocumentLinkResolver linkResolver)
                {
                    String imgTag = "<img alt=\"" + alt + "\" src=\"" + url + "\" width=\"" + width + "\" height=\"" + height + "\" />";

                    if (this.linkTo != null)
                    {
                        String u = "about:blank";
                        if (this.linkTo is WebLink)
                        {
                            u = ((WebLink)this.linkTo).Url;
                        }
                        else if (this.linkTo is ImageLink)
                        {
                            u = ((ImageLink)this.linkTo).Url;
                        }
                        else if (this.linkTo is DocumentLink)
                        {
                            u = ((DocumentLink)this.linkTo).IsBroken
                                                                ? "#broken"
                                                                : linkResolver.Resolve((DocumentLink)this.LinkTo);
                        }
                        return("<a href=\"" + u + "\">" + imgTag + "</a>");
                    }
                    else
                    {
                        return(imgTag);
                    }
                }
예제 #2
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>");
 }
예제 #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
 public String GetUrl(DocumentLinkResolver resolver)
 {
     return(resolver.Resolve(this));
 }
예제 #5
0
 public new String AsHtml(DocumentLinkResolver linkResolver)
 {
     return ("<a " + (linkResolver.GetTitle(this) == null ? "" : "title=\"" + linkResolver.GetTitle(this) + "\" ") + "href=\"" + linkResolver.Resolve(this) + "\">" + slug + "</a>");
 }
예제 #6
0
 public String GetUrl(DocumentLinkResolver resolver)
 {
     return resolver.Resolve (this);
 }
예제 #7
0
 public String AsHtml(DocumentLinkResolver linkResolver)
 {
     String imgTag = "<img alt=\"" + alt + "\" src=\"" + url + "\" width=\"" + width + "\" height=\"" + height + "\" />";
     if (this.linkTo != null) {
         String u = "about:blank";
         if (this.linkTo is WebLink) {
             u = ((WebLink) this.linkTo).Url;
         } else if (this.linkTo is ImageLink) {
             u = ((ImageLink) this.linkTo).Url;
         } else if (this.linkTo is DocumentLink) {
             u = ((DocumentLink)this.linkTo).IsBroken
                 ? "#broken"
                 : linkResolver.Resolve((DocumentLink) this.LinkTo);
         }
         return "<a href=\"" + u + "\">" + imgTag + "</a>";
     } else {
         return imgTag;
     }
 }
예제 #8
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>";
 }