Skip to content

Commit 348bdd8

Browse files
committed
replace temp MarkdownIndexFile property with Index which is now the generic MarkdownFile
1 parent c1b7f55 commit 348bdd8

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/Elastic.Markdown/IO/Navigation/DocumentationGroup.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ public class DocumentationGroup : INodeNavigationItem<MarkdownFile, INavigationI
102102

103103
public Uri NavigationSource { get; set; }
104104

105-
//TODO remove in favor of index
106-
public MarkdownFile MarkdownFileIndex { get; set; }
107-
108-
public MarkdownFile Index => MarkdownFileIndex;
105+
public MarkdownFile Index { get; }
109106

110107
public string Url => Index.Url;
111108

@@ -164,14 +161,14 @@ protected DocumentationGroup(string folderName,
164161
// ReSharper enable VirtualMemberCallInConstructor
165162
NavigationRoot = toplevelTree;
166163
// ReSharper restore VirtualMemberCallInConstructor
167-
MarkdownFileIndex = ProcessTocItems(context, toplevelTree, lookups, depth, virtualIndexFile, ref fileIndex, out var groups, out var files, out var navigationItems);
164+
Index = ProcessTocItems(context, toplevelTree, lookups, depth, virtualIndexFile, ref fileIndex, out var groups, out var files, out var navigationItems);
168165

169166
GroupsInOrder = groups;
170167
FilesInOrder = files;
171168
NavigationItems = navigationItems;
172169
Id = ShortId.Create(NavigationSource.ToString(), FolderName);
173170

174-
FilesInOrder = [.. FilesInOrder.Except([MarkdownFileIndex])];
171+
FilesInOrder = [.. FilesInOrder.Except([Index])];
175172
}
176173

177174
private MarkdownFile ProcessTocItems(BuildContext context,
@@ -298,7 +295,7 @@ public async Task Resolve(Cancel ctx = default)
298295
await Parallel.ForEachAsync(FilesInOrder, ctx, async (file, token) => await file.MinimalParseAsync(token));
299296
await Parallel.ForEachAsync(GroupsInOrder, ctx, async (group, token) => await group.Resolve(token));
300297

301-
_ = await MarkdownFileIndex.MinimalParseAsync(ctx);
298+
_ = await Index.MinimalParseAsync(ctx);
302299

303300
_resolved = true;
304301
}

src/Elastic.Markdown/Slices/HtmlWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private async Task<string> RenderLayout(MarkdownFile markdown, MarkdownDocument
6767
reportLinkParameter = new Uri(DocumentationSet.Context.CanonicalBaseUrl, Path.Combine(DocumentationSet.Context.UrlPathPrefix ?? string.Empty, markdown.Url));
6868
var reportUrl = $"https://github.com/elastic/docs-content/issues/new?template=issue-report.yaml&link={reportLinkParameter}&labels=source:web";
6969

70-
var siteName = DocumentationSet.Tree.MarkdownFileIndex.Title ?? "Elastic Documentation";
70+
var siteName = DocumentationSet.Tree.Index.Title ?? "Elastic Documentation";
7171

7272
var legacyPage = LegacyUrlMapper.MapLegacyUrl(markdown.YamlFrontMatter?.MappedPages);
7373

src/tooling/docs-assembler/Navigation/GlobalNavigation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ ref int navigationIndex
6767
fileNavigationItem.Parent = parent;
6868
_ = markdownFiles.Add(fileNavigationItem.Model);
6969
break;
70-
case DocumentationGroup { MarkdownFileIndex: not null } documentationGroup:
70+
case DocumentationGroup documentationGroup:
7171
var groupIndex = Interlocked.Increment(ref navigationIndex);
72-
documentationGroup.MarkdownFileIndex.NavigationIndex = groupIndex;
72+
documentationGroup.Index.NavigationIndex = groupIndex;
7373
if (parent is not null)
7474
documentationGroup.Parent = parent;
75-
_ = markdownFiles.Add(documentationGroup.MarkdownFileIndex);
75+
_ = markdownFiles.Add(documentationGroup.Index);
7676
UpdateNavigationIndex(markdownFiles, documentationGroup.NavigationItems, documentationGroup, ref navigationIndex);
7777
break;
7878
default:

tests/Elastic.Markdown.Tests/DocSet/NestedTocTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public void InjectsNestedTocsIntoDocumentationSet()
2222

2323
var parent = nav.Parent;
2424

25-
// ensure we link back up to main toc in docset yaml
25+
// ensure we link back up to the main toc in docset yaml
2626
parent.Should().NotBeNull();
2727

2828
// its parent should be null
2929
parent.Parent.Should().BeNull();
3030

3131
// its parent should point to an index
32-
var index = (parent as DocumentationGroup)?.MarkdownFileIndex;
32+
var index = (parent as DocumentationGroup)?.Index;
3333
index.Should().NotBeNull();
3434
index.RelativePath.Should().Be("index.md");
3535

0 commit comments

Comments
 (0)