mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-12-16 14:35:32 +00:00
Bugfix: doppelte Marginalien
This commit is contained in:
42
HaWeb/Settings/NodeRules/MarginalCollection.cs
Normal file
42
HaWeb/Settings/NodeRules/MarginalCollection.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using HaWeb.Models;
|
||||
using System.Xml.Linq;
|
||||
using HaWeb.XMLTests;
|
||||
namespace HaWeb.Settings.NodeRules;
|
||||
|
||||
public class MarginalCollectionRules : ICollectionRule {
|
||||
public string Name { get; } = "marginal";
|
||||
public HamannXPath[] Bases { get; } = {
|
||||
new HamannXPath() { Documents = new[] { "stellenkommentar" }, XPath = "//marginal"}
|
||||
};
|
||||
public HamannXPath[] Backlinks { get; } = {};
|
||||
|
||||
public IEnumerable<(string, XElement, XMLRootDocument)> GenerateIdentificationStrings(IEnumerable<(XElement, XMLRootDocument)> list) {
|
||||
foreach (var e in list) {
|
||||
var id = e.Item1.Attribute("letter")!.Value;
|
||||
id += "-";
|
||||
id += e.Item1.Attribute("page")!.Value;
|
||||
id += "-";
|
||||
id += e.Item1.Attribute("line")!.Value;
|
||||
if (e.Item1.HasAttributes && e.Item1.Attribute("sort") != null) {
|
||||
id += "-";
|
||||
id += e.Item1.Attribute("sort")!.Value;
|
||||
}
|
||||
yield return (
|
||||
id,
|
||||
e.Item1,
|
||||
e.Item2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<(string, XElement, XMLRootDocument, bool)> GenerateBacklinkString(IEnumerable<(XElement, XMLRootDocument)> list) => null;
|
||||
|
||||
|
||||
public bool CheckDatatypes(XElement element) {
|
||||
if (element.HasAttributes && element.Attribute("sort") != null ) {
|
||||
return Int32.TryParse(element.Attribute("sort").Value, out var _);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,4 +44,8 @@ public class StructureCollection : ICollectionRule {
|
||||
partialmatch);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckDatatypes(XElement element) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user