Exemplo n.º 1
0
        public string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            var sb    = new cape.StringBuilder();
            var array = getParagraphs();

            if (array != null)
            {
                var n = 0;
                var m = array.Count;
                for (n = 0; n < m; n++)
                {
                    var paragraph = array[n];
                    if (paragraph != null)
                    {
                        var html = paragraph.toHtml(refs);
                        if (cape.String.isEmpty(html) == false)
                        {
                            sb.append(html);
                            sb.append('\n');
                        }
                    }
                }
            }
            return(sb.toString());
        }
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            var ids = "";

            if (cape.String.isEmpty(id) == false)
            {
                ids = " " + capex.text.HTMLString.sanitize(id);
            }
            var content = capex.text.RichTextStyledParagraph.forString(text);

            return("<div class=\"block" + ids + "\">" + content.toHtml(refs) + "</div>");
        }
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            string cc = null;

            if (refs != null && !(object.Equals(contentId, null)))
            {
                cc = refs.getContentString(contentId);
            }
            if (object.Equals(cc, null))
            {
                cc = "";
            }
            return(cc);
        }
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            var ids = "";

            if (cape.String.isEmpty(id) == false)
            {
                ids = " id=\"" + capex.text.HTMLString.sanitize(id) + "\"";
            }
            var codeo = "";
            var codec = "";

            if (cape.String.equals("code", id))
            {
                codeo = "<code>";
                codec = "</code>";
            }
            return("<pre" + ids + ">" + codeo + capex.text.HTMLString.sanitize(text) + codec + "</pre>");
        }
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            var href = capex.text.HTMLString.sanitize(link);
            var tt   = text;

            if (cape.String.isEmpty(tt))
            {
                tt = href;
            }
            if (cape.String.isEmpty(tt))
            {
                tt = "(empty link)";
            }
            var targetblank = "";

            if (popup)
            {
                targetblank = " target=\"_blank\"";
            }
            return("<p class=\"link\"><a href=\"" + href + "\"" + targetblank + ">" + tt + "</a></p>\n");
        }
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            string reftitle = null;
            string href     = null;

            if (cape.String.isEmpty(text) == false)
            {
                reftitle = text;
            }
            if (cape.String.isEmpty(reftitle))
            {
                if (refs != null)
                {
                    reftitle = refs.getReferenceTitle(reference);
                }
                else
                {
                    reftitle = reference;
                }
            }
            if (refs != null)
            {
                href = refs.getReferenceHref(reference);
            }
            else
            {
                href = reference;
            }
            if (cape.String.isEmpty(href))
            {
                return("");
            }
            if (cape.String.isEmpty(reftitle))
            {
                reftitle = href;
            }
            return("<p class=\"reference\"><a href=\"" + capex.text.HTMLString.sanitize(href) + "\">" + capex.text.HTMLString.sanitize(reftitle) + "</a></p>\n");
        }
Exemplo n.º 7
0
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            var sb = new cape.StringBuilder();

            if (width >= 100)
            {
                sb.append("<div class=\"img100\">");
            }
            else if (width >= 75)
            {
                sb.append("<div class=\"img75\">");
            }
            else if (width >= 50)
            {
                sb.append("<div class=\"img50\">");
            }
            else
            {
                sb.append("<div class=\"img25\">");
            }
            sb.append("<img src=\"" + capex.text.HTMLString.sanitize(filename) + "\" />");
            sb.append("</div>\n");
            return(sb.toString());
        }
 public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
 {
     return("<hr />\n");
 }
 public virtual string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
 {
     return(null);
 }
        public override string toHtml(capex.text.RichTextDocumentReferenceResolver refs)
        {
            var sb  = new cape.StringBuilder();
            var tag = "p";

            if (heading > 0)
            {
                tag = "h" + cape.String.forInteger(heading);
            }
            sb.append("<");
            sb.append(tag);
            sb.append(">");
            if (segments != null)
            {
                var n = 0;
                var m = segments.Count;
                for (n = 0; n < m; n++)
                {
                    var sg = segments[n];
                    if (sg != null)
                    {
                        var aOpen = false;
                        var text  = sg.getText();
                        var link  = sg.getLink();
                        if (cape.String.isEmpty(link) == false)
                        {
                            if (sg.getIsInline())
                            {
                                sb.append("<img src=\"" + capex.text.HTMLString.sanitize(link) + "\" />");
                            }
                            else
                            {
                                var targetblank = "";
                                if (sg.getLinkPopup())
                                {
                                    targetblank = " target=\"_blank\"";
                                }
                                sb.append("<a" + targetblank + " class=\"urlLink\" href=\"" + capex.text.HTMLString.sanitize(link) + "\">");
                                aOpen = true;
                            }
                        }
                        if (cape.String.isEmpty(sg.getReference()) == false)
                        {
                            var    @ref = sg.getReference();
                            string href = null;
                            if (refs != null)
                            {
                                href = refs.getReferenceHref(@ref);
                                if (cape.String.isEmpty(text))
                                {
                                    text = refs.getReferenceTitle(@ref);
                                }
                            }
                            if (cape.String.isEmpty(href) == false)
                            {
                                if (cape.String.isEmpty(text))
                                {
                                    text = @ref;
                                }
                                sb.append("<a class=\"referenceLink\" href=\"" + capex.text.HTMLString.sanitize(href) + "\">");
                                aOpen = true;
                            }
                        }
                        var span = false;
                        if (sg.getBold() || sg.getItalic() || sg.getUnderline() || cape.String.isEmpty(sg.getColor()) == false)
                        {
                            span = true;
                            sb.append("<span style=\"");
                            if (sg.getBold())
                            {
                                sb.append(" font-weight: bold;");
                            }
                            if (sg.getItalic())
                            {
                                sb.append(" font-style: italic;");
                            }
                            if (sg.getUnderline())
                            {
                                sb.append(" text-decoration: underline;");
                            }
                            if (cape.String.isEmpty(sg.getColor()) == false)
                            {
                                sb.append(" color: " + capex.text.HTMLString.sanitize(sg.getColor()) + "");
                            }
                            sb.append("\">");
                        }
                        if (sg.getIsInline() == false)
                        {
                            sb.append(capex.text.HTMLString.sanitize(text));
                        }
                        if (span)
                        {
                            sb.append("</span>");
                        }
                        if (aOpen)
                        {
                            sb.append("</a>");
                        }
                    }
                }
            }
            sb.append("</" + tag + ">");
            return(sb.toString());
        }