Files
hamann-ausgabe-core/HaWeb/Settings/XMLCollections/TraditionCollection.cs
2023-09-16 15:43:11 +02:00

21 lines
1.1 KiB
C#

namespace HaWeb.Settings.XMLCollections;
using HaWeb.Models;
using System.Xml.Linq;
public class TraditionCollection : HaWeb.XMLParser.IXMLCollection {
public string Key { get; } = "traditions";
public string[] xPath { get; } = new string[] { "/opus/data/traditions/letterTradition", "/opus/traditions/letterTradition" };
public Func<XElement, string?> GenerateKey { get; } = GetKey;
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = null;
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = null;
public Func<IEnumerable<CollectedItem>, IDictionary<string, IEnumerable<CollectedItem>>?>? SortingsGeneration { get; } = null;
public HaWeb.XMLParser.IXMLCollection[]? SubCollections { get; } = null;
public bool Searchable { get; } = true;
public static Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("letter");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;
return null;
};
}