| 
266 | 266 |     @await RenderSectionAsync("Scripts", required: false);  | 
267 | 267 |     <script>  | 
268 | 268 |         @{  | 
269 |  | -            object GetItems(IEnumerable<SiteMapping> chapterItems, int indentLevel) => chapterItems  | 
270 |  | -            // Skip the chapter entry itself  | 
271 |  | -            .Skip(1)  | 
272 |  | -            // Examine all items up until we move up to a level higher than where we're starting,  | 
273 |  | -            // which would indicate that we've reached the end of the entries nested under `indentationLevel`  | 
274 |  | -            .TakeWhile(i => i.IndentLevel >= indentLevel)  | 
275 |  | -            // Of all the multi-level descendants we found, take only those at the current level that we're wanting to render.  | 
276 |  | -            .Where(i => i.IndentLevel == indentLevel)  | 
277 |  | -            .Select(i => new  | 
278 |  | -            {  | 
279 |  | -                Level = indentLevel,  | 
280 |  | -                Key = i.Keys.First(),  | 
281 |  | -                Href = $"{i.Keys.First()}#{i.AnchorId}",  | 
282 |  | -                Title = i.RawHeading,  | 
283 |  | -                // Any children of this node will be /after/ this node,  | 
284 |  | -                // so skip any items that are /before/ the current node.  | 
285 |  | -                Items = GetItems(chapterItems.SkipWhile(q => i.Keys.First() != q.Keys.First()), indentLevel + 1)  | 
286 |  | -            });  | 
287 |  | -            var tocData = _SiteMappings.SiteMappings.GroupBy(x => x.ChapterNumber).OrderBy(x => x.Key).Select(x => new  | 
288 |  | -            {  | 
289 |  | -                Level = 0,  | 
290 |  | -                Key = x.First().Keys.First(),  | 
291 |  | -                Href = $"{x.First().Keys.First()}#{x.First().AnchorId}",  | 
292 |  | -                Title = $"Chapter {x.Key}: {x.First().ChapterTitle}",  | 
293 |  | -                Items = GetItems(x, 1)  | 
294 |  | -            });  | 
 | 269 | +            // object GetItems(IEnumerable<SiteMapping> chapterItems, int indentLevel) => chapterItems  | 
 | 270 | +            // // Skip the chapter entry itself  | 
 | 271 | +            // .Skip(1)  | 
 | 272 | +            // // Examine all items up until we move up to a level higher than where we're starting,  | 
 | 273 | +            // // which would indicate that we've reached the end of the entries nested under `indentationLevel`  | 
 | 274 | +            // .TakeWhile(i => i.IndentLevel >= indentLevel)  | 
 | 275 | +            // // Of all the multi-level descendants we found, take only those at the current level that we're wanting to render.  | 
 | 276 | +            // .Where(i => i.IndentLevel == indentLevel)  | 
 | 277 | +            // .Select(i => new  | 
 | 278 | +            // {  | 
 | 279 | +            //     Level = indentLevel,  | 
 | 280 | +            //     Key = i.Keys,  | 
 | 281 | +            //     Href = $"{i.Keys.First()}#{i.AnchorId}",  | 
 | 282 | +            //     Title = i.RawHeading,  | 
 | 283 | +            //     // Any children of this node will be /after/ this node,  | 
 | 284 | +            //     // so skip any items that are /before/ the current node.  | 
 | 285 | +            //     Items = GetItems(chapterItems.SkipWhile(q => i.Keys.First() != q.Keys.First()), indentLevel + 1)  | 
 | 286 | +            // });  | 
 | 287 | +            // var tocData = _SiteMappings.SiteMappings.GroupBy(x => x.ChapterNumber).OrderBy(x => x.Key).Select(x => new  | 
 | 288 | +            // {  | 
 | 289 | +            //     Level = 0,  | 
 | 290 | +            //     Key = x.First().Keys.First(),  | 
 | 291 | +            //     Href = $"{x.First().Keys.First()}#{x.First().AnchorId}",  | 
 | 292 | +            //     Title = $"Chapter {x.Key}: {x.First().ChapterTitle}",  | 
 | 293 | +            //     Items = GetItems(x, 1)  | 
 | 294 | +            // });  | 
 | 295 | +            var tocData = _SiteMappings.GetTocData();  | 
295 | 296 |         }  | 
296 | 297 | 
  | 
297 | 298 |             PREVIOUS_PAGE = @Json.Serialize(ViewBag.PreviousPage)  | 
 | 
0 commit comments