mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
Indexnumber parsing disabled
This commit is contained in:
@@ -14,24 +14,26 @@ public class BackLinkCollection : HaWeb.XMLParser.IXMLCollection {
|
||||
public bool Searchable { get; } = true;
|
||||
|
||||
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var margid = (string?)elem.Ancestors("marginal").First().Attribute("index");
|
||||
if (String.IsNullOrWhiteSpace(margid)) return null;
|
||||
return margid + _random.Next().ToString();
|
||||
var letter = (string?)elem.Attribute("letter");
|
||||
var page = (string?)elem.Attribute("page");
|
||||
var line = (string?)elem.Attribute("line");
|
||||
if (letter == null) return null;
|
||||
var index = letter + "-" + page ?? "" + "-" + line ?? "";
|
||||
if (String.IsNullOrWhiteSpace(index)) return null;
|
||||
return index + _random.Next().ToString();
|
||||
};
|
||||
|
||||
public static IDictionary<string, string>? GetDataFields(XElement element) {
|
||||
var res = new Dictionary<string, string>();
|
||||
var marg = element.Ancestors("marginal").First();
|
||||
var index = (string?)marg.Attribute("index");
|
||||
var letter = (string?)marg.Attribute("letter");
|
||||
var page = (string?)marg.Attribute("page");
|
||||
var line = (string?)marg.Attribute("line");
|
||||
var refere = (string?)element.Attribute("ref");
|
||||
var subref = (string?)element.Attribute("subref");
|
||||
if (index == null || letter == null || (refere == null && subref == null)) return null;
|
||||
if (letter == null || (refere == null && subref == null)) return null;
|
||||
if (subref != null) res.Add("ref", subref);
|
||||
else res.Add("ref", refere!);
|
||||
res.Add("index", index);
|
||||
res.Add("letter", letter);
|
||||
if (page != null) res.Add("page", page);
|
||||
if (line != null) res.Add("line", line);
|
||||
|
||||
@@ -22,9 +22,9 @@ public static class CommentCollectionHelpers {
|
||||
|
||||
public static IDictionary<string, ILookup<string, CollectedItem>>? GetLookups(IEnumerable<CollectedItem> items) {
|
||||
var res = new Dictionary<string, ILookup<string, CollectedItem>>();
|
||||
var lemmas = items.Where(x => !String.IsNullOrWhiteSpace(x.Index));
|
||||
var lemmas = items.Where(x => !String.IsNullOrWhiteSpace(x.ID));
|
||||
if (lemmas != null && lemmas.Any())
|
||||
res.Add("lemma", lemmas.ToLookup(x => x.Index.Substring(0, 1).ToUpper()));
|
||||
res.Add("lemma", lemmas.ToLookup(x => x.ID.Substring(0, 1).ToUpper()));
|
||||
// If we use lemmas
|
||||
// var lemmas = items.Where(x => x.Fields != null && x.Fields.ContainsKey("lemma"));
|
||||
// if (lemmas != null && lemmas.Any())
|
||||
|
||||
@@ -13,7 +13,7 @@ public class LetterCollection : HaWeb.XMLParser.IXMLCollection {
|
||||
public bool Searchable { get; } = true;
|
||||
|
||||
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var index = elem.Attribute("index");
|
||||
var index = elem.Attribute("letter");
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
return index.Value;
|
||||
else return null;
|
||||
|
||||
@@ -13,9 +13,14 @@ public class MarginalCollection : HaWeb.XMLParser.IXMLCollection {
|
||||
public bool Searchable { get; } = true;
|
||||
|
||||
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var index = elem.Attribute("index");
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
return index.Value;
|
||||
var letter = (string?)elem.Attribute("letter");
|
||||
var page = (string?)elem.Attribute("page");
|
||||
var line = (string?)elem.Attribute("line");
|
||||
var sort = (string?)elem.Attribute("sort");
|
||||
if (letter == null || page == null || line == null) return null;
|
||||
var index = letter + "-" + page + "-" + line + sort ?? "";
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index))
|
||||
return index;
|
||||
else return null;
|
||||
};
|
||||
|
||||
@@ -24,10 +29,12 @@ public class MarginalCollection : HaWeb.XMLParser.IXMLCollection {
|
||||
var letter = (string?)element.Attribute("letter");
|
||||
var page = (string?)element.Attribute("page");
|
||||
var line = (string?)element.Attribute("line");
|
||||
var sort = (string?)element.Attribute("sort");
|
||||
if (letter == null || page == null || line == null) return null;
|
||||
res.Add("letter", letter);
|
||||
res.Add("page", page);
|
||||
res.Add("line", line);
|
||||
if (sort != null) res.Add("sort", sort);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class MetaCollection : HaWeb.XMLParser.IXMLCollection {
|
||||
public bool Searchable { get; } = false;
|
||||
|
||||
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var index = elem.Attribute("ref");
|
||||
var index = elem.Attribute("letter");
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
return index.Value;
|
||||
return null;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class TraditionCollection : HaWeb.XMLParser.IXMLCollection {
|
||||
public bool Searchable { get; } = true;
|
||||
|
||||
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var index = elem.Attribute("ref");
|
||||
var index = elem.Attribute("letter");
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
return index.Value;
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user