private static string GeneratePage(IEpubMetadata metadata, IHtmlResourceManager resourceManager, ICssStyleManager styleManager)
        {
            var document = new DocumentMarkupNode(
                "Content",
                ListOf(
                    new HeaderMarkupNode(
                        metadata.Title,
                        1,
                        ListOf(
                            new ListMarkupNode(
                                ListStyle.Numbered,
                                from page in metadata.Pages
                                select new HyperlinkMarkupNode(
                                    page.Uri.GetPackagePath(),
                                    ListOf(new TextRunMarkupNode(page.Title))
                                    )
                                )
                            )
                        )
                    )
                );

            var compiler = new HtmlCompiler(resourceManager, styleManager);
            var html = compiler.Compile(document);

            return html.ToString();
        }
Ejemplo n.º 2
0
 void IMarkupNodeVisitor.Visit(DocumentMarkupNode node)
 {
     foreach (var child in node.Children)
     {
         child.Accept(this);
     }
 }
Ejemplo n.º 3
0
 void IMarkupNodeVisitor.Visit(DocumentMarkupNode node)
 {
     writer.BeginTag("document");
        foreach (var child in node.Children)
        {
        child.Accept(this);
        }
        writer.EndTag();
 }
Ejemplo n.º 4
0
        void IMarkupNodeVisitor.Visit(DocumentMarkupNode node)
        {
            container.Add(new XDocumentType("html", null, null, null));
            using (NestedContainer(HtmlTags.Html))
            {
                using (NestedContainer(HtmlTags.Head))
                {
                    container.AddElement(HtmlTags.Title).Add(node.Title);
                    container.AddElement(HtmlTags.Meta)
                        .AddAttribute(HtmlAttributes.HttpEquiv, "Content-Type")
                        .AddAttribute(HtmlAttributes.Content, "text/html; charset=utf-8");
                }

                using (NestedContainer(HtmlTags.Body))
                {
                    ProcessCompositeNode(node);
                }
            }
        }