|
|
@@ -39,96 +39,126 @@ internal class TableOfContentsTests : ConformanceTestBase
|
|
|
column.Item().Element(GeneratePlaceholderContentSection);
|
|
|
});
|
|
|
});
|
|
|
- })
|
|
|
- .WithMetadata(new DocumentMetadata
|
|
|
- {
|
|
|
- Language = "en-US",
|
|
|
- Title = "Conformance Test",
|
|
|
- Subject = "Table of Contents"
|
|
|
});
|
|
|
- }
|
|
|
-
|
|
|
- protected override SemanticTreeNode? GetExpectedSemanticTree()
|
|
|
- {
|
|
|
- throw new NotImplementedException();
|
|
|
- }
|
|
|
-
|
|
|
- private void GenerateTableOfContentsSection(IContainer container)
|
|
|
- {
|
|
|
- container
|
|
|
- .SemanticSection()
|
|
|
- .Column(column =>
|
|
|
- {
|
|
|
- column.Spacing(15);
|
|
|
-
|
|
|
- column
|
|
|
- .Item()
|
|
|
- .Text("Table of Contents")
|
|
|
- .Bold()
|
|
|
- .FontSize(20)
|
|
|
- .FontColor(Colors.Blue.Medium);
|
|
|
-
|
|
|
- column.Item()
|
|
|
- .SemanticTableOfContents()
|
|
|
- .Column(column =>
|
|
|
- {
|
|
|
- column.Spacing(5);
|
|
|
-
|
|
|
- foreach (var i in Enumerable.Range(1, 10))
|
|
|
+
|
|
|
+ static void GenerateTableOfContentsSection(IContainer container)
|
|
|
+ {
|
|
|
+ container
|
|
|
+ .SemanticSection()
|
|
|
+ .Column(column =>
|
|
|
+ {
|
|
|
+ column.Spacing(15);
|
|
|
+
|
|
|
+ column
|
|
|
+ .Item()
|
|
|
+ .Text("Table of Contents")
|
|
|
+ .Bold()
|
|
|
+ .FontSize(20)
|
|
|
+ .FontColor(Colors.Blue.Medium);
|
|
|
+
|
|
|
+ column.Item()
|
|
|
+ .SemanticTableOfContents()
|
|
|
+ .Column(column =>
|
|
|
{
|
|
|
- column.Item()
|
|
|
- .SemanticTableOfContentsItem()
|
|
|
- .SemanticLink($"Link to section {i}")
|
|
|
- .SectionLink($"section-{i}")
|
|
|
- .Row(row =>
|
|
|
+ column.Spacing(5);
|
|
|
+
|
|
|
+ foreach (var i in Enumerable.Range(1, 10))
|
|
|
+ {
|
|
|
+ column.Item()
|
|
|
+ .SemanticTableOfContentsItem()
|
|
|
+ .SemanticLink($"Link to section {i}")
|
|
|
+ .SectionLink($"section-{i}")
|
|
|
+ .Row(row =>
|
|
|
+ {
|
|
|
+ row.ConstantItem(25).Text($"{i}.");
|
|
|
+ row.AutoItem().Text(Placeholders.Label());
|
|
|
+ row.RelativeItem().PaddingHorizontal(2).TranslateY(11).LineHorizontal(1).LineDashPattern([1, 3]);
|
|
|
+ row.AutoItem().Text(text => text.BeginPageNumberOfSection($"section-{i}"));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ static void GeneratePlaceholderContentSection(IContainer container)
|
|
|
+ {
|
|
|
+ container
|
|
|
+ .Column(column =>
|
|
|
+ {
|
|
|
+ foreach (var i in Enumerable.Range(1, 10))
|
|
|
+ {
|
|
|
+ column.Item()
|
|
|
+ .SemanticSection()
|
|
|
+ .Section($"section-{i}")
|
|
|
+ .Column(column =>
|
|
|
+ {
|
|
|
+ column.Spacing(15);
|
|
|
+
|
|
|
+ column.Item()
|
|
|
+ .SemanticHeader2()
|
|
|
+ .Text($"Section {i}")
|
|
|
+ .Bold()
|
|
|
+ .FontSize(20)
|
|
|
+ .FontColor(Colors.Blue.Medium);
|
|
|
+
|
|
|
+ column.Item().Text(Placeholders.Paragraph());
|
|
|
+
|
|
|
+ foreach (var j in Enumerable.Range(1, i))
|
|
|
{
|
|
|
- row.ConstantItem(25).Text($"{i}.");
|
|
|
- row.AutoItem().Text(Placeholders.Label());
|
|
|
- row.RelativeItem().PaddingHorizontal(2).TranslateY(11).LineHorizontal(1).LineDashPattern([1, 3]);
|
|
|
- row.AutoItem().Text(text => text.BeginPageNumberOfSection($"section-{i}"));
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
+ column.Item()
|
|
|
+ .ArtifactOther()
|
|
|
+ .Width(200)
|
|
|
+ .Height(150)
|
|
|
+ .CornerRadius(10)
|
|
|
+ .Background(Placeholders.BackgroundColor());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (i < 10)
|
|
|
+ column.Item().PageBreak();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void GeneratePlaceholderContentSection(IContainer container)
|
|
|
+ protected override SemanticTreeNode? GetExpectedSemanticTree()
|
|
|
{
|
|
|
- container
|
|
|
- .Column(column =>
|
|
|
+ return ExpectedSemanticTree.DocumentRoot(root =>
|
|
|
+ {
|
|
|
+ root.Child("H1", h1 => h1.Alt("Conformance Test:\nTable of Contents"));
|
|
|
+
|
|
|
+ // Table of Contents Section
|
|
|
+ root.Child("Sect", sect =>
|
|
|
{
|
|
|
- foreach (var i in Enumerable.Range(1, 10))
|
|
|
+ sect.Child("P");
|
|
|
+
|
|
|
+ sect.Child("TOC", toc =>
|
|
|
{
|
|
|
- column.Item()
|
|
|
- .SemanticSection()
|
|
|
- .Section($"section-{i}")
|
|
|
- .Column(column =>
|
|
|
+ foreach (var i in Enumerable.Range(1, 10))
|
|
|
+ {
|
|
|
+ toc.Child("TOCI", toci =>
|
|
|
{
|
|
|
- column.Spacing(15);
|
|
|
-
|
|
|
- column.Item()
|
|
|
- .SemanticHeader2()
|
|
|
- .Text($"Section {i}")
|
|
|
- .Bold()
|
|
|
- .FontSize(20)
|
|
|
- .FontColor(Colors.Blue.Medium);
|
|
|
-
|
|
|
- column.Item().Text(Placeholders.Paragraph());
|
|
|
-
|
|
|
- foreach (var j in Enumerable.Range(1, i))
|
|
|
+ toci.Child("Link", link =>
|
|
|
{
|
|
|
- column.Item()
|
|
|
- .ArtifactOther()
|
|
|
- .Width(200)
|
|
|
- .Height(150)
|
|
|
- .CornerRadius(10)
|
|
|
- .Background(Placeholders.BackgroundColor());
|
|
|
- }
|
|
|
+ link.Alt($"Link to section {i}");
|
|
|
+ link.Child("P"); // Number
|
|
|
+ link.Child("P"); // Label
|
|
|
+ link.Child("P"); // Page number
|
|
|
+ });
|
|
|
});
|
|
|
-
|
|
|
- if (i < 10)
|
|
|
- column.Item().PageBreak();
|
|
|
- }
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
+
|
|
|
+ // Content Sections
|
|
|
+ foreach (var i in Enumerable.Range(1, 10))
|
|
|
+ {
|
|
|
+ root.Child("Sect", sect =>
|
|
|
+ {
|
|
|
+ sect.Child("H2", h2 => h2.Alt($"Section {i}"));
|
|
|
+ sect.Child("P");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|