Bloom.Publish.EpubMaker.MakeNavPage C# (CSharp) Method

MakeNavPage() private method

private MakeNavPage ( ) : void
return void
        private void MakeNavPage()
        {
            XNamespace xhtml = "http://www.w3.org/1999/xhtml";
            // Todo: improve this or at least make a way "Cover" and "Content" can be put in the book's language.
            var content = XElement.Parse(@"
            <html xmlns='http://www.w3.org/1999/xhtml' xmlns:epub='http://www.idpf.org/2007/ops'>
            <head>
            <meta charset='utf-8' />
            </head>
            <body>
            <nav epub:type='toc' id='toc'>
            <ol>
                <li><a>Cover</a></li>
                <li><a>Content</a></li>
            </ol>
            </nav>
            </body>
            </html>");
            var ol = content.Element(xhtml + "body").Element(xhtml + "nav").Element(xhtml + "ol");
            var items = ol.Elements(xhtml + "li").ToArray();
            var coverItem = items[0];
            var contentItem = items[1];
            if (_firstContentPageItem == null)
                contentItem.Remove();
            else
                contentItem.Element(xhtml + "a").SetAttributeValue("href", _firstContentPageItem);
            if (_coverPage == _firstContentPageItem)
                coverItem.Remove();
            else
                coverItem.Element(xhtml + "a").SetAttributeValue("href", _coverPage);
            _navFileName = "nav.xhtml";
            var navPath = Path.Combine(_contentFolder, _navFileName);

            using (var writer = XmlWriter.Create(navPath))
                content.WriteTo(writer);
            _manifestItems.Add(_navFileName);
        }