Example #1
0
        /// <summary>
        ///		Convierte una estructura XML en HTML
        /// </summary>
        private string ConvertMLBulider(DocumentFileModel objDocument, string strOutputPath, string strRootPath,
                                        string strTitle, string strDescription,
                                        MLIntermedialBuilder objMLBuilder, string strFileNameTemplate)
        {
            string strResult = new Repository.Templates.TemplateRepository().LoadTextRootTemplate(strFileNameTemplate);
            string strHtml   = objConversor.Convert(strRootPath, objMLBuilder);

            // Reemplaza los datos de la plantilla de entrada
            if (strResult.IsEmpty())
            {
                strResult = strHtml;
            }
            else
            {                                     // Asigna el título y la descripción
                strResult = strResult.ReplaceWithStringComparison("{{Title}}", strTitle);
                strResult = strResult.ReplaceWithStringComparison("{{Description}}", strDescription);
                // Crea el vínculo a la página superior
                if (objDocument != null && objDocument.Parent != null)
                {
                    strResult = strResult.ReplaceWithStringComparison("{{TopPage}}", string.Format("<a href='{0}'>{1}</a>",
                                                                                                   GetUrl(objDocument.Parent, ""),
                                                                                                   objDocument.Parent.Name));
                }
                else
                {
                    strResult = strResult.ReplaceWithStringComparison("{{TopPage}}", "");
                }
                // Cambia los vínculos
                strResult = UpdateLinks(System.IO.Path.Combine(strRootPath, "filler.htm"), strResult);
                // Asigna el cuerpo
                strResult = strResult.ReplaceWithStringComparison("{{Body}}", strHtml);
            }
            // Devuelve el texto
            return(strResult);
        }
Example #2
0
        /// <summary>
        ///		Convierte una estructura XML en HTML
        /// </summary>
        private string ConvertMLBuilder(DocumentFileModel document, string rootPath,
                                        string title, string description, MLIntermedialBuilder builderML, string fileNameTemplate)
        {
            string result = new Repository.Templates.TemplateRepository().LoadTextRootTemplate(fileNameTemplate);
            string html   = conversor.Convert(rootPath, builderML);

            // Convierte los vínculos del cuerpo HTML
            html = UpdateLinksBody(System.IO.Path.Combine(rootPath, "filler.htm"), html);
            // Reemplaza los datos de la plantilla de entrada
            if (result.IsEmpty())
            {
                result = html;
            }
            else
            {
                // Asigna el título y la descripción
                result = result.ReplaceWithStringComparison("{{Title}}", title);
                result = result.ReplaceWithStringComparison("{{Description}}", description);
                // Crea el vínculo a la página superior
                if (document != null && document.Parent != null)
                {
                    result = result.ReplaceWithStringComparison("{{TopPage}}", string.Format("<a href='{0}'>{1}</a>",
                                                                                             GetUrl(document.Parent, ""),
                                                                                             document.Parent.Name));
                }
                else
                {
                    result = result.ReplaceWithStringComparison("{{TopPage}}", "");
                }
                // Cambia los vínculos
                result = UpdateLinks(System.IO.Path.Combine(rootPath, "filler.htm"), result);
                // Asigna el cuerpo
                result = result.ReplaceWithStringComparison("{{Body}}", html);
            }
            // Devuelve el texto
            return(result);
        }