mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 17:25:32 +00:00
1. Beta-Version mit Korrekturanmerkungen
This commit is contained in:
16
HaWeb/Settings/NodeRules/AppNode.cs
Normal file
16
HaWeb/Settings/NodeRules/AppNode.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace HaWeb.Settings.NodeRules;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using HaWeb.XMLTests;
|
||||
|
||||
public class AppNode : INodeRule
|
||||
{
|
||||
public string Name => "app";
|
||||
public string XPath => "//app";
|
||||
public string[]? Attributes { get; } = { "ref" };
|
||||
public string? uniquenessAttribute => null;
|
||||
public List<(string, string, string)>? References { get; } = new List<(string, string, string)>()
|
||||
{
|
||||
("ref", "//appDef", "index")
|
||||
};
|
||||
}
|
||||
17
HaWeb/Settings/NodeRules/LinkNode.cs
Normal file
17
HaWeb/Settings/NodeRules/LinkNode.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace HaWeb.Settings.NodeRules;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using HaWeb.XMLTests;
|
||||
|
||||
public class LinkNode : INodeRule
|
||||
{
|
||||
public string Name => "link";
|
||||
public string XPath => "//link";
|
||||
public string[]? Attributes { get; } = null;
|
||||
public string? uniquenessAttribute => null;
|
||||
public List<(string, string, string)>? References { get; } = new List<(string, string, string)>()
|
||||
{
|
||||
("ref", "//kommentar", "id"),
|
||||
("subref", "//subsection", "id")
|
||||
};
|
||||
}
|
||||
40
HaWeb/Settings/NodeRules/StructureCollection.cs
Normal file
40
HaWeb/Settings/NodeRules/StructureCollection.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using HaWeb.Models;
|
||||
using System.Xml.Linq;
|
||||
using HaWeb.XMLTests;
|
||||
namespace HaWeb.Settings.NodeRules;
|
||||
|
||||
public class StructureCollection : ICollectionRule {
|
||||
public string Name { get; } = "structure";
|
||||
public string[] Bases { get; } = { "//letterText", "//letterTradition" };
|
||||
public string[] Backlinks { get; } = { "//intlink", "//marginal" };
|
||||
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 currpage = String.Empty;
|
||||
var currline = String.Empty;
|
||||
foreach (var el in e.Item1.Descendants()) {
|
||||
if (el.Name == "page" && el.Attribute("index") != null) currpage = el.Attribute("index")!.Value;
|
||||
if (el.Name == "line" && el.Attribute("index") != null) {
|
||||
currline = el.Attribute("index")!.Value;
|
||||
yield return (
|
||||
id + "-" + currpage + "-" + currline,
|
||||
e.Item1,
|
||||
e.Item2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public IEnumerable<(string, XElement, XMLRootDocument, bool)> GenerateBacklinkString(IEnumerable<(XElement, XMLRootDocument)> list) {
|
||||
foreach (var e in list) {
|
||||
var letter = e.Item1.Attribute("letter") != null ? e.Item1.Attribute("letter")!.Value : "NA";
|
||||
var page = e.Item1.Attribute("page") != null ? e.Item1.Attribute("page")!.Value : "NA";
|
||||
var line = e.Item1.Attribute("line") != null ? e.Item1.Attribute("line")!.Value : "NA";
|
||||
var partialmatch = e.Item1.Name == "marginal" ? false : true;
|
||||
yield return (
|
||||
letter + "-" + page + "-" + line,
|
||||
e.Item1,
|
||||
e.Item2,
|
||||
partialmatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user