Exemple #1
0
        public static TocItem Create(IMetadataDictionary data)
        {
            var tocItem = new TocItem()
            {
                Title = data.Get <string>("title"),
                Link  = data.Get <string>("link"),
            };

            if (data.ContainsKey("children"))
            {
                tocItem.Children = Create(data.GetList <IMetadataDictionary>("children"));
            }

            return(tocItem);
        }
Exemple #2
0
 public static List <TocItem> Create(IEnumerable <IMetadataDictionary> objects, TocItem parent = null) => objects?.Select(Create).ToList() ?? new List <TocItem>();