Exemple #1
0
        /// <summary>
        ///		Obtiene el texto de los spans de un nodo
        /// </summary>
        private string ConvertSpansText(string actualPath, MLNode nodeML)
        {
            string text = "";

            // Crea el texto a partir de los nodos de span
            if (nodeML.Nodes.Count == 0)
            {
                text = GetSpanText(nodeML.Value, MLBuilder.GetFormats(nodeML),
                                   MLBuilder.CheckIsBold(nodeML), MLBuilder.CheckIsItalic(nodeML));
            }
            else
            {
                foreach (MLNode childML in nodeML.Nodes)
                {
                    if (MLBuilder.CheckIsSpanNode(childML))
                    {
                        text = text.AddWithSeparator(GetSpanText(childML.Value, MLBuilder.GetFormats(childML),
                                                                 MLBuilder.CheckIsBold(nodeML) || MLBuilder.CheckIsBold(childML),
                                                                 MLBuilder.CheckIsItalic(nodeML) || MLBuilder.CheckIsItalic(childML)),
                                                     " ", false);
                    }
                    else if (MLBuilder.CheckIsLinkNode(childML))
                    {
                        text = text.AddWithSeparator(GetLinkTag(actualPath, childML), " ", false);
                    }
                    else
                    {
                        text = text.AddWithSeparator(childML.Value, " ", false);
                    }
                }
            }
            // Devuelve el texto convertido
            return(text);
        }
        /// <summary>
        ///		Obtiene el texto de los spans de un nodo
        /// </summary>
        private string ConvertSpansText(string strActualPath, MLNode objMLNode)
        {
            string strText = "";

            // Crea el texto a partir de los nodos de span
            if (objMLNode.Nodes.Count == 0)
            {
                strText = GetSpanText(objMLNode.Value, MLBuilder.CheckIsBold(objMLNode), MLBuilder.CheckIsItalic(objMLNode));
            }
            else
            {
                foreach (MLNode objMLChild in objMLNode.Nodes)
                {
                    if (MLBuilder.CheckIsSpanNode(objMLChild))
                    {
                        strText = strText.AddWithSeparator(GetSpanText(objMLChild.Value,
                                                                       MLBuilder.CheckIsBold(objMLNode) || MLBuilder.CheckIsBold(objMLChild),
                                                                       MLBuilder.CheckIsItalic(objMLNode) || MLBuilder.CheckIsItalic(objMLChild)),
                                                           " ", false);
                    }
                    else if (MLBuilder.CheckIsLinkNode(objMLChild))
                    {
                        strText = strText.AddWithSeparator(GetLinkTag(strActualPath, objMLChild), " ", false);
                    }
                    else
                    {
                        strText = strText.AddWithSeparator(objMLChild.Value, " ", false);
                    }
                }
            }
            // Devuelve el texto convertido
            return(strText);
        }
Exemple #3
0
        /// <summary>
        ///		Convierte el texto del span
        /// </summary>
        private string ConvertSpanText(MLNode nodeML)
        {
            string startTag   = "";
            string endTag     = "";
            string attributes = "";

            // Añade el texto que indica si está en negrita o en cursiva
            if (MLBuilder.CheckIsBold(nodeML) || MLBuilder.CheckIsItalic(nodeML))
            {
                // Añade las etiquetas para el inicio y el fin
                if (MLBuilder.CheckIsBold(nodeML))
                {
                    startTag = startTag.AddWithSeparator("#b", " ", false);
                    endTag   = endTag.AddWithSeparator("#", " ", false);
                }
                if (MLBuilder.CheckIsItalic(nodeML))
                {
                    startTag = startTag.AddWithSeparator("#em", " ", false);
                    endTag   = endTag.AddWithSeparator("#", " ", false);
                }
            }
            // Añade los atributos
            foreach (MLAttribute attributeML in nodeML.Attributes)
            {
                if (!MLBuilder.CheckIsBold(attributeML) && !MLBuilder.CheckIsItalic(attributeML))
                {
                    attributes = attributes.AddWithSeparator(ConvertAttribute(attributeML), " ", false);
                }
            }
            // Añade las llaves a los atributos
            if (!attributes.IsEmpty())
            {
                attributes = " { " + attributes + " } ";
            }
            // Devuelve el texto
            return((startTag + attributes + " " + nodeML.Value + " " + endTag).TrimIgnoreNull());
        }
        /// <summary>
        ///		Convierte el texto del span
        /// </summary>
        private string ConvertSpanText(MLNode objMLNode)
        {
            string strStartTag   = "";
            string strEndTag     = "";
            string strAttributes = "";

            // Añade el texto que indica si está en negrita o en cursiva
            if (MLBuilder.CheckIsBold(objMLNode) || MLBuilder.CheckIsItalic(objMLNode))
            {                                     // Añade las etiquetas para el inicio y el fin
                if (MLBuilder.CheckIsBold(objMLNode))
                {
                    strStartTag = strStartTag.AddWithSeparator("#b", " ", false);
                    strEndTag   = strEndTag.AddWithSeparator("#", " ", false);
                }
                if (MLBuilder.CheckIsItalic(objMLNode))
                {
                    strStartTag = strStartTag.AddWithSeparator("#em", " ", false);
                    strEndTag   = strEndTag.AddWithSeparator("#", " ", false);
                }
            }
            // Añade los atributos
            foreach (MLAttribute objMLAttribute in objMLNode.Attributes)
            {
                if (!MLBuilder.CheckIsBold(objMLAttribute) && !MLBuilder.CheckIsItalic(objMLAttribute))
                {
                    strAttributes = strAttributes.AddWithSeparator(ConvertAttribute(objMLAttribute), " ", false);
                }
            }
            // Añade las llaves a los atributos
            if (!strAttributes.IsEmpty())
            {
                strAttributes = " { " + strAttributes + " } ";
            }
            // Devuelve el texto
            return((strStartTag + strAttributes + " " + objMLNode.Value + " " + strEndTag).TrimIgnoreNull());
        }