/// <summary> /// Setting dsa_linkType argument /// </summary> /// <param name="linkType">Value for dsa_linkType</param> /// <param name="url">The URL.</param> /// <param name="title">The title to pop up</param> /// <param name="name">Link name shown</param> /// <returns> /// Instruction /// </returns> public docScriptInstruction arg(appendLinkType linkType, string url, string title, string name) { this.add(docScriptArguments.dsa_name, name); this.add(docScriptArguments.dsa_url, url); this.add(docScriptArguments.dsa_title, title); this.add(docScriptArguments.dsa_linkType, linkType); return(this); }
/// <summary> /// Gets the file extension. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public static String getFileExtension(this appendLinkType type) { switch (type) { case appendLinkType.anchor: break; case appendLinkType.image: return(".png"); break; case appendLinkType.link: return(".html"); break; case appendLinkType.reference: case appendLinkType.referenceImage: return(".png"); break; case appendLinkType.referenceLink: break; case appendLinkType.scriptLink: case appendLinkType.scriptPostLink: return(".js"); break; case appendLinkType.styleLink: return(".css"); break; case appendLinkType.unknown: break; default: return(".js"); break; } return(""); }
public deliveryUnitItemSupportFile(string __sourcepath, string __outputfolder) : base(deliveryUnitItemType.supportFile) { location = deliveryUnitItemLocationBase.globalDeliveryResource; flags = deliveryUnitItemFlags.filenameExtensionIsStatic | deliveryUnitItemFlags.linkToPrimaryContent | deliveryUnitItemFlags.filenameIsDataTemplate | deliveryUnitItemFlags.useCopy; sourcepath.setup(__sourcepath); string opath = __outputfolder.add(sourcepath.filenameWithExtension, "\\"); outputpath.setup(opath); switch (sourcepath.extension) { case ".css": linkType = appendLinkType.styleLink; break; case ".js": linkType = appendLinkType.scriptLink; break; } }
/// <summary> /// Renders link, image or reference /// </summary> /// <param name="url">url or reference id</param> /// <param name="name">Name of link</param> /// <param name="caption">Title - popup content</param> /// <param name="linkType">Select if output is link, image or reference</param> public void AppendLink(String url, String name, String caption = "", appendLinkType linkType = appendLinkType.link) { _AppendLine(url.markdownLink(name, caption, linkType)); }
/// <summary> /// Creates markdown link, image, reference or referencedLink /// </summary> /// <param name="url"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="linkType"></param> /// <returns></returns> public static string textLink(this String url, String name, String caption = "", appendLinkType linkType = appendLinkType.link) { // url = url.markdownEscape(); //name = name.markdownEscape(); //caption = caption.markdownEscape(); switch (linkType) { case appendLinkType.image: return(String.Format("Image [{0}]: {1}", name, url)); break; case appendLinkType.link: if (!imbSciStringExtensions.isNullOrEmptyString(caption)) { return(String.Format("Link [{0}] = ({1} \"{2}\")", name, url, caption)); } else { return(String.Format("Link [{0}] = ({1})", name, url)); } break; case appendLinkType.reference: return(String.Format("Ref [{0}]: {1}", name, url)); break; case appendLinkType.referenceLink: return(String.Format("Ref [{0}][{1}]", name, url)); break; default: return(url); break; } }
public override void AppendLink(string url, string name, string caption = "", appendLinkType linkType = appendLinkType.unknown) { String c = "<a href=\"" + url + "\">" + name + "</a>"; if (!caption.isNullOrEmpty()) { c += "<label>" + caption + "</label>" + c; } _AppendLine(c); }
/// <summary> /// Adds a theme support file. /// </summary> /// <param name="sourcePath">The source path - relative to reportTheme folder</param> /// <param name="outputPath">The output path - relative to deliveryInstance output folder</param> /// <returns></returns> public deliveryUnitItemSupportFile AddThemeSupportFile(string sourcePath, string outputPath = "include\\", appendLinkType linkType = appendLinkType.unknown) { string tsf_path = deliveryUnitBuilder.themepath.add(sourcePath, "\\"); FileInfo fi = new FileInfo(tsf_path); deliveryUnitItemSupportFile spf = new deliveryUnitItemSupportFile(fi.FullName, outputPath); if (linkType != appendLinkType.unknown) { spf.linkType = linkType; } Add(spf, fi); return(spf); }
/// <summary> /// Creates markdown link, image, reference or referencedLink /// </summary> /// <param name="url"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="linkType"></param> /// <returns></returns> public static string markdownLink(this String url, String name, String caption = "", appendLinkType linkType = appendLinkType.link) { url = url; if (url.Contains("..//")) { url = url.Replace("..//", "../"); } name = name.markdownEscape(); caption = caption.markdownEscape(); switch (linkType) { case appendLinkType.image: return(String.Format("![{0}]:({1})", name, url)); break; case appendLinkType.referenceImage: return(String.Format("![{0}][{1}]", name, url)); break; case appendLinkType.link: if (!imbSciStringExtensions.isNullOrEmptyString(caption)) { return(String.Format("[{0}]({1} \"{2}\")", name, url, caption)); } else { return(String.Format("[{0}]({1})", name, url)); } break; case appendLinkType.reference: return(String.Format("[{0}]: {1}", name, url)); break; case appendLinkType.referenceLink: return(String.Format("[{0}][{1}]", name, url)); break; case appendLinkType.anchor: return(String.Format(" * [{0}](#{1})", name, url)); break; case appendLinkType.scriptPostLink: case appendLinkType.scriptLink: return("<script src=\"" + url + "\" charset=\"utf-8\" ></script>"); break; case appendLinkType.styleLink: return("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + url + "\" >"); break; case appendLinkType.unknown: default: return(url); break; } }