mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-12-16 06:25:31 +00:00
Indexnumber parsing disabled
This commit is contained in:
@@ -10,8 +10,8 @@ public class LetterDescNode : INodeRule
|
||||
Documents = new[] { "metadaten" },
|
||||
XPath = "//letterDesc"
|
||||
};
|
||||
public string[]? Attributes { get; } = { "ref" };
|
||||
public string? uniquenessAttribute => "ref" ;
|
||||
public string[]? Attributes { get; } = { "letter" };
|
||||
public string? uniquenessAttribute => "letter" ;
|
||||
public List<(string, HamannXPath, string)>? References { get; } = new List<(string, HamannXPath, string)>()
|
||||
{
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@ public class LetterTextNode : INodeRule
|
||||
Documents = new[] { "brieftext" },
|
||||
XPath = "//letterText"
|
||||
};
|
||||
public string[]? Attributes { get; } = { "index" };
|
||||
public string? uniquenessAttribute => "index" ;
|
||||
public string[]? Attributes { get; } = { "letter" };
|
||||
public string? uniquenessAttribute => "letter" ;
|
||||
public List<(string, HamannXPath, string)>? References { get; } = new List<(string, HamannXPath, string)>()
|
||||
{
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@ public class LetterTraditionNode : INodeRule
|
||||
Documents = new[] { "ueberlieferung" },
|
||||
XPath = "//letterTradition"
|
||||
};
|
||||
public string[]? Attributes { get; } = { "ref" };
|
||||
public string? uniquenessAttribute => "ref" ;
|
||||
public string[]? Attributes { get; } = { "letter" };
|
||||
public string? uniquenessAttribute => "letter" ;
|
||||
public List<(string, HamannXPath, string)>? References { get; } = new List<(string, HamannXPath, string)>()
|
||||
{
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@ public class MarginalNode : INodeRule
|
||||
Documents = new[] { "stellenkommentar" },
|
||||
XPath = "//marginal"
|
||||
};
|
||||
public string[]? Attributes { get; } = { "index", "letter", "page", "line" };
|
||||
public string? uniquenessAttribute => "index";
|
||||
public string[]? Attributes { get; } = { "letter", "page", "line" };
|
||||
public string? uniquenessAttribute { get; }
|
||||
public List<(string, HamannXPath, string)>? References { get; } = new List<(string, HamannXPath, string)>()
|
||||
{
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StructureCollection : ICollectionRule {
|
||||
|
||||
public IEnumerable<(string, XElement, XMLRootDocument)> GenerateIdentificationStrings(IEnumerable<(XElement, XMLRootDocument)> list) {
|
||||
foreach (var e in list) {
|
||||
var id = e.Item1.Name == "letterText" ? e.Item1.Attribute("index")!.Value : e.Item1.Attribute("ref")!.Value;
|
||||
var id = e.Item1.Attribute("letter")!.Value;
|
||||
var currpage = String.Empty;
|
||||
var currline = String.Empty;
|
||||
foreach (var el in e.Item1.Descendants()) {
|
||||
|
||||
@@ -233,7 +233,7 @@ public class TextRules {
|
||||
{
|
||||
if(reader.State.ParsedMarginals == null) reader.State.ParsedMarginals = new List<(string, string, string)>();
|
||||
var sb2 = new StringBuilder();
|
||||
margs = margs.OrderBy(x => Int32.Parse(x.Index));
|
||||
if (margs.Count() > 1) margs = margs.OrderBy(x => Int32.Parse(x.Sort));
|
||||
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.COMMENTMARKERCLASS, "ma-" + reader.State.currpage + "-" + reader.State.currline));
|
||||
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
|
||||
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.MARGINGALBOXCLASS));
|
||||
|
||||
@@ -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