private List <BaseXHTMLFileV2> SplitSimpleText(SimpleHTML5Text simpleEPubText) { var list = new List <BaseXHTMLFileV2>(); var newDoc = new BaseXHTMLFileV2 { PageTitle = PageTitle, NotPartOfNavigation = true, Type = SectionTypeEnum.Text, FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder) }; newDoc.StyleFiles.AddRange(StyleFiles); newDoc.GuideRole = GuideRole; newDoc.NavigationParent = NavigationParent; newDoc.Content = new Div(Compatibility); var newParagraph = new Paragraph(Compatibility); newDoc.Content.Add(newParagraph); var newText = new SimpleHTML5Text(Compatibility) { Text = "" }; newParagraph.Add(newText); foreach (var word in simpleEPubText.Text.Split(' ')) { newText.Text += ' '; newText.Text += word; ulong itemSize = EstimateSize(newParagraph); if (itemSize >= MaxSize) { list.Add(newDoc); newDoc = new BaseXHTMLFileV2 { PageTitle = InternalPageTitle, NotPartOfNavigation = true, Type = SectionTypeEnum.Text, FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder), GuideRole = GuideRole, NavigationParent = NavigationParent, Content = new Div(Compatibility) }; newParagraph = new Paragraph(Compatibility); newDoc.Content.Add(newParagraph); newDoc.StyleFiles.AddRange(StyleFiles); newText = new SimpleHTML5Text(Compatibility) { Text = "" }; newParagraph.Add(newText); } } list.Add(newDoc); return(list); }
private List <BaseXHTMLFileV3> SplitSimpleText(SimpleHTML5Text simpleEPubText) { var list = new List <BaseXHTMLFileV3>(); var newDoc = new BaseXHTMLFileV3 { PageTitle = InternalPageTitle, NotPartOfNavigation = true }; newDoc.StyleFiles.AddRange(StyleFiles); newDoc.GuideRole = GuideRole; newDoc.NavigationParent = NavigationParent; newDoc.Content = new Div(Compatibility); var newParagraph = new Paragraph(Compatibility); newDoc.Content.Add(newParagraph); var newText = new SimpleHTML5Text(Compatibility) { Text = "" }; newParagraph.Add(newText); foreach (var word in simpleEPubText.Text.Split(' ')) { newText.Text += ' '; newText.Text += word; ulong itemSize = EstimateSize(newParagraph); if (itemSize >= MaxSize) { list.Add(newDoc); newDoc = new BaseXHTMLFileV3 { PageTitle = PageTitle, NotPartOfNavigation = true }; newDoc.StyleFiles.AddRange(StyleFiles); newDoc.GuideRole = GuideRole; newDoc.NavigationParent = NavigationParent; newDoc.Content = new Div(Compatibility); newParagraph = new Paragraph(Compatibility); newDoc.Content.Add(newParagraph); newText = new SimpleHTML5Text(Compatibility) { Text = "" }; newParagraph.Add(newText); } } list.Add(newDoc); return(list); }
public override void GenerateBody() { base.GenerateBody(); Div page = new Div(Compatibility); page.GlobalAttributes.Class.Value = "about"; H1 heading = new H1(Compatibility); heading.Add(new SimpleHTML5Text(Compatibility) { Text = "About" }); page.Add(heading); foreach (var text in AboutTexts) { var p1 = new Paragraph(Compatibility); var text1 = new SimpleHTML5Text(Compatibility) { Text = text }; p1.Add(text1); page.Add(p1); } foreach (var text in AboutLinks) { var p1 = new Paragraph(Compatibility); var anch = new Anchor(Compatibility); anch.HRef.Value = text; anch.GlobalAttributes.Title.Value = text; var text3 = new SimpleHTML5Text(Compatibility) { Text = text }; anch.Add(text3); p1.Add(anch); page.Add(p1); } BodyElement.Add(page); }
public Title(HTMLElementType htmlStandard) : base(htmlStandard) { TextContent = new SimpleHTML5Text(htmlStandard); }
public WordBreakOportunity(HTMLElementType htmlStandard) : base(htmlStandard) { TextContent = new SimpleHTML5Text(htmlStandard); }
public override void GenerateBody() { base.GenerateBody(); var titlePage = new Div(Compatibility); titlePage.GlobalAttributes.Class.Value = ElementStylesV2.TitlePage; if (!string.IsNullOrEmpty(BookTitle)) { // try to use FB2 book's title var p = new H2(Compatibility); p.Add(new SimpleHTML5Text(Compatibility) { Text = BookTitle }); p.GlobalAttributes.Class.Value = string.Format(ElementStylesV2.TitleItemFormat, 1); titlePage.Add(p); } else { titlePage.Add(new SimpleHTML5Text(Compatibility) { Text = "Unnamed" }); } titlePage.Add(new EmptyLine(Compatibility)); var sbSeries = new StringBuilder(); foreach (var serie in _series) { if (!string.IsNullOrEmpty(sbSeries.ToString())) { sbSeries.Append(" , "); } sbSeries.Append(serie); } if (sbSeries.ToString() != string.Empty) { var seriesItem = new SimpleHTML5Text(Compatibility) { Text = string.Format("( {0} )", sbSeries) }; var containingText = new EmphasisedText(Compatibility); containingText.Add(seriesItem); var seriesHeading = new H3(Compatibility); seriesHeading.GlobalAttributes.Class.Value = ElementStylesV2.TitleSeries; seriesHeading.Add(containingText); titlePage.Add(seriesHeading); } foreach (var author in _authors) { var authorsHeading = new H3(Compatibility); var authorLine = new SimpleHTML5Text(Compatibility) { Text = author }; authorsHeading.Add(authorLine); authorsHeading.GlobalAttributes.Class.Value = ElementStylesV2.TitleAuthors; titlePage.Add(authorsHeading); } BodyElement.Add(titlePage); }
public WordBreakOportunity(HTMLElementType htmlStandard) : base(htmlStandard) { TextContent = new SimpleHTML5Text(htmlStandard); }
public Title(HTMLElementType htmlStandard) : base(htmlStandard) { TextContent = new SimpleHTML5Text(htmlStandard); }