Example #1
0
        /// <summary>
        ///		Obtiene el nombre de archivo HTML de un vínculo
        /// </summary>
        private string GetHtmlFileName(string actualPath, MLNode nodeML)
        {
            string href = System.IO.Path.Combine(MLBuilder.GetHref(nodeML), GetFileName(nodeML.Value));

            // Obtiene la Url relativa
            if (!actualPath.StartsWith("C:", StringComparison.CurrentCultureIgnoreCase))
            {
                href = GetUrlRelative(System.IO.Path.Combine(GetFirstPath(href), actualPath) + "\\index.htm", href);
            }
            else
            {
                string rootPath = GetFirstPath(href);

                href = href.Right(href.Length - rootPath.Length);
            }
            // Quita las barras iniciales
            while (!href.IsEmpty() && href.StartsWith("\\"))
            {
                href = href.Substring(1);
            }
            // Cambia los caracteres de separación
            if (!href.IsEmpty())
            {
                href = href.Replace('\\', '/');
            }
            // Devuelve la URL
            return(href);
        }
Example #2
0
        /// <summary>
        ///		Añade un nodo con el vínculo
        /// </summary>
        private string GetNodeLink(MLNode nodeML)
        {
            string attributes = "";

            // Asigna los atributos
            foreach (MLAttribute attributeML in nodeML.Attributes)
            {
                if (!MLBuilder.CheckIsHref(attributeML))
                {
                    attributes = attributes.AddWithSeparator(ConvertAttribute(attributeML), " ", false);
                }
            }
            // Añade el atributo con la referencia
            attributes = attributes.AddWithSeparator(ConvertAttribute("href", MLBuilder.GetHref(nodeML)), " ", false);
            // Añade las llaves de los atributos
            if (!attributes.IsEmpty())
            {
                attributes = "{ " + attributes + " }";
            }
            // Añade el nodo con el vínculo
            return(string.Format("#a {0} {1}#", attributes, nodeML.Value));
        }
        /// <summary>
        ///		Añade un nodo con el vínculo
        /// </summary>
        private string GetNodeLink(MLNode objMLNode)
        {
            string strAttributes = "";

            // Asigna los atributos
            foreach (MLAttribute objMLAttribute in objMLNode.Attributes)
            {
                if (!MLBuilder.CheckIsHref(objMLAttribute))
                {
                    strAttributes = strAttributes.AddWithSeparator(ConvertAttribute(objMLAttribute), " ", false);
                }
            }
            // Añade el atributo con la referencia
            strAttributes = strAttributes.AddWithSeparator(ConvertAttribute("href", MLBuilder.GetHref(objMLNode)), " ", false);
            // Añade las llaves de los atributos
            if (!strAttributes.IsEmpty())
            {
                strAttributes = "{ " + strAttributes + " }";
            }
            // Añade el nodo con el vínculo
            return(string.Format("#a {0} {1}#", strAttributes, objMLNode.Value));
        }