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:
@@ -70,14 +70,14 @@ namespace HaDocument.Reactors {
|
||||
!tag.IsEmpty &&
|
||||
tag.Name == "letterText"
|
||||
) {
|
||||
letter = tag["index"];
|
||||
letter = tag["letter"];
|
||||
}
|
||||
else if (
|
||||
!tag.EndTag &&
|
||||
!tag.IsEmpty &&
|
||||
tag.Name == "letterTradition"
|
||||
) {
|
||||
letter = tag["ref"];
|
||||
letter = tag["letter"];
|
||||
}
|
||||
else if (
|
||||
!tag.EndTag &&
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace HaDocument.Reactors {
|
||||
// State
|
||||
private string Index;
|
||||
private string Name;
|
||||
private string? Komm;
|
||||
|
||||
internal HandDefsReactor(IReader reader, IntermediateLibrary lib) : base(reader, lib) {
|
||||
lib.HandPersons = new Dictionary<string, Person>();
|
||||
@@ -39,7 +38,6 @@ namespace HaDocument.Reactors {
|
||||
_active = true;
|
||||
Index = tag["index"];
|
||||
Name = tag["name"];
|
||||
if (!String.IsNullOrWhiteSpace(tag["komm"])) Komm = tag["komm"];
|
||||
Add();
|
||||
_active = false;
|
||||
}
|
||||
@@ -51,7 +49,7 @@ namespace HaDocument.Reactors {
|
||||
}
|
||||
|
||||
protected void Add() {
|
||||
CreatedInstances.Add(Index, new Person(Index, Name, "", "", Komm));
|
||||
CreatedInstances.Add(Index, new Person(Index, Name, null, null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace HaDocument.Reactors
|
||||
internal Dictionary<string, Dictionary<string, HashSet<string>>> CreatedStructure;
|
||||
|
||||
// State
|
||||
private string Index = "";
|
||||
private string Letter = "";
|
||||
private ElementStringBinder _element = null;
|
||||
|
||||
private bool _normalizeWhitespace = false;
|
||||
@@ -49,12 +49,12 @@ namespace HaDocument.Reactors
|
||||
!tag.EndTag &&
|
||||
!tag.IsEmpty &&
|
||||
tag.Name == "letterText" &&
|
||||
!String.IsNullOrWhiteSpace(tag["index"])
|
||||
!String.IsNullOrWhiteSpace(tag["letter"])
|
||||
)
|
||||
{
|
||||
Activate(_reader, tag);
|
||||
if (!CreatedStructure.ContainsKey(tag["index"]))
|
||||
this.CreatedStructure.Add(tag["index"], new Dictionary<string, HashSet<string>>());
|
||||
if (!CreatedStructure.ContainsKey(tag["letter"]))
|
||||
this.CreatedStructure.Add(tag["letter"], new Dictionary<string, HashSet<string>>());
|
||||
}
|
||||
else if (
|
||||
!tag.EndTag &&
|
||||
@@ -64,9 +64,9 @@ namespace HaDocument.Reactors
|
||||
)
|
||||
{
|
||||
_line = tag["index"];
|
||||
if (!CreatedStructure[Index][_page].Contains(_line))
|
||||
if (!CreatedStructure[Letter][_page].Contains(_line))
|
||||
{
|
||||
CreatedStructure[Index][_page].Add(_line);
|
||||
CreatedStructure[Letter][_page].Add(_line);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
@@ -77,8 +77,8 @@ namespace HaDocument.Reactors
|
||||
)
|
||||
{
|
||||
_page = tag["index"];
|
||||
if (!CreatedStructure[Index].ContainsKey(_page))
|
||||
CreatedStructure[Index].Add(_page, new HashSet<string>());
|
||||
if (!CreatedStructure[Letter].ContainsKey(_page))
|
||||
CreatedStructure[Letter].Add(_page, new HashSet<string>());
|
||||
}
|
||||
else if (
|
||||
_active &&
|
||||
@@ -100,7 +100,7 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
if (_hands == null)
|
||||
_hands = new List<Hand>();
|
||||
_hands.Add(new Hand(Index, _person, _handstartpg, _handstartln, _page, _line));
|
||||
_hands.Add(new Hand(Letter, _person, _handstartpg, _handstartln, _page, _line));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
_active = true;
|
||||
_reader = reader;
|
||||
Index = tag["index"];
|
||||
Letter = tag["letter"];
|
||||
_element = new ElementStringBinder(reader, tag, Add, _normalizeWhitespace);
|
||||
}
|
||||
}
|
||||
@@ -119,23 +119,23 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(text)) return;
|
||||
var letter = new Letter(
|
||||
Index,
|
||||
Letter,
|
||||
text
|
||||
);
|
||||
CreatedInstances.TryAdd(Index, letter);
|
||||
CreatedInstances.TryAdd(Letter, letter);
|
||||
if (_hands != null)
|
||||
{
|
||||
if (!CreatedHands.ContainsKey(Index))
|
||||
CreatedHands.Add(Index, _hands);
|
||||
if (!CreatedHands.ContainsKey(Letter))
|
||||
CreatedHands.Add(Letter, _hands);
|
||||
else
|
||||
CreatedHands[Index].AddRange(_hands);
|
||||
CreatedHands[Letter].AddRange(_hands);
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
Index = "";
|
||||
Letter = "";
|
||||
_active = false;
|
||||
_element = null;
|
||||
_hands = null;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace HaDocument.Reactors {
|
||||
// State
|
||||
private string Index;
|
||||
private string Name;
|
||||
private string? Reference;
|
||||
|
||||
internal LocationDefsReactor(IReader reader, IntermediateLibrary lib) : base(reader, lib) {
|
||||
lib.Locations = new Dictionary<string, Location>();
|
||||
@@ -39,6 +40,7 @@ namespace HaDocument.Reactors {
|
||||
_active = true;
|
||||
Index = tag["index"];
|
||||
Name = tag["name"];
|
||||
Reference = String.IsNullOrWhiteSpace(tag["ref"]) ? null : tag["ref"];
|
||||
Add();
|
||||
_active = false;
|
||||
}
|
||||
@@ -47,10 +49,11 @@ namespace HaDocument.Reactors {
|
||||
protected override void Reset() {
|
||||
Index = "";
|
||||
Name = "";
|
||||
Reference = null;
|
||||
}
|
||||
|
||||
protected void Add() {
|
||||
CreatedInstances.Add(Index, new Location(Index, Name));
|
||||
CreatedInstances.Add(Index, new Location(Index, Name, Reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ using System;
|
||||
|
||||
namespace HaDocument.Reactors {
|
||||
class MarginalReactor : Reactor {
|
||||
internal Dictionary<string, Marginal> CreatedInstances;
|
||||
internal Dictionary<string, List<Marginal>> CreatedInstances;
|
||||
internal Dictionary<string, List<Backlink>> CreatedBacklinks;
|
||||
private bool _normalizeWhitespace = false;
|
||||
|
||||
// State
|
||||
private string Index = "";
|
||||
private string? Sort = "";
|
||||
private string Letter = "";
|
||||
private string Page = "";
|
||||
private string Line = "";
|
||||
@@ -20,8 +20,8 @@ namespace HaDocument.Reactors {
|
||||
|
||||
internal MarginalReactor(IReader reader, IntermediateLibrary lib, bool normalizeWhitespace) : base(reader, lib) {
|
||||
_normalizeWhitespace = normalizeWhitespace;
|
||||
lib.Marginals = new Dictionary<string, Marginal>();
|
||||
lib.Backlinks = new Dictionary<string, List<Backlink>>();
|
||||
lib.Marginals = new ();
|
||||
lib.Backlinks = new ();
|
||||
CreatedBacklinks = lib.Backlinks;
|
||||
CreatedInstances = lib.Marginals;
|
||||
reader.OpenTag += Listen;
|
||||
@@ -32,7 +32,6 @@ namespace HaDocument.Reactors {
|
||||
!tag.EndTag &&
|
||||
!tag.IsEmpty &&
|
||||
tag.Name == "marginal" &&
|
||||
!String.IsNullOrEmpty(tag["index"]) &&
|
||||
!String.IsNullOrWhiteSpace(tag["letter"]) &&
|
||||
!String.IsNullOrWhiteSpace(tag["page"]) &&
|
||||
!String.IsNullOrWhiteSpace(tag["line"])
|
||||
@@ -45,7 +44,7 @@ namespace HaDocument.Reactors {
|
||||
if (!_active && reader != null && tag != null) {
|
||||
_active = true;
|
||||
_reader = reader;
|
||||
Index = tag["index"];
|
||||
Sort = tag["sort"];
|
||||
Letter = tag["letter"];
|
||||
Page = tag["page"];
|
||||
Line = tag["line"];
|
||||
@@ -67,7 +66,7 @@ namespace HaDocument.Reactors {
|
||||
if (!String.IsNullOrWhiteSpace(id)) {
|
||||
if (!CreatedBacklinks.ContainsKey(id))
|
||||
CreatedBacklinks.Add(id, new List<Backlink>());
|
||||
CreatedBacklinks[id].Add(new Backlink(id, Letter, Page, Line, Index));
|
||||
CreatedBacklinks[id].Add(new Backlink(id, Letter, Page, Line));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,18 +74,19 @@ namespace HaDocument.Reactors {
|
||||
private void Add(string element) {
|
||||
if (String.IsNullOrWhiteSpace(element)) return;
|
||||
var marg = new Marginal(
|
||||
Index,
|
||||
Letter,
|
||||
Page,
|
||||
Line,
|
||||
String.IsNullOrWhiteSpace(Sort) ? null : Sort,
|
||||
element
|
||||
);
|
||||
CreatedInstances.TryAdd(Index, marg);
|
||||
if (!CreatedInstances.ContainsKey(Letter)) CreatedInstances.Add(Letter, new());
|
||||
CreatedInstances[Letter].Add(marg);
|
||||
Reset();
|
||||
}
|
||||
|
||||
protected override void Reset() {
|
||||
Index = "";
|
||||
Sort = "";
|
||||
_active = false;
|
||||
_element = null;
|
||||
_reader.Tag -= OnTag;
|
||||
|
||||
@@ -14,8 +14,7 @@ namespace HaDocument.Reactors {
|
||||
private (int, int) _availableYearRange;
|
||||
|
||||
// State
|
||||
private string Index { get; set; } = "";
|
||||
private string Autopsic { get; set; } = "";
|
||||
private string ID { get; set; } = "";
|
||||
private string Volume { get; set; } = "";
|
||||
private string Page { get; set; } = "";
|
||||
private string Date { get; set; } = "";
|
||||
@@ -23,9 +22,9 @@ namespace HaDocument.Reactors {
|
||||
private int Order { get; set; } = -1;
|
||||
private bool AltLineNumbering { get; set; } = false;
|
||||
private bool inZH { get; set; } = false;
|
||||
private OptionalBool hasOriginal { get; set; } = OptionalBool.None;
|
||||
private OptionalBool isProofread { get; set; } = OptionalBool.None;
|
||||
private OptionalBool isDraft { get; set; } = OptionalBool.None;
|
||||
private bool? hasOriginal { get; set; } = null;
|
||||
private bool? isProofread { get; set; } = null;
|
||||
private bool? isDraft { get; set; } = null;
|
||||
private bool dateChanged {get; set; } = false;
|
||||
private string Location { get; set; } = "";
|
||||
private List<string> Senders { get; set; } = null;
|
||||
@@ -46,7 +45,7 @@ namespace HaDocument.Reactors {
|
||||
!tag.EndTag &&
|
||||
!tag.IsEmpty &&
|
||||
tag.Name =="letterDesc" &&
|
||||
!String.IsNullOrWhiteSpace(tag["ref"])
|
||||
!String.IsNullOrWhiteSpace(tag["letter"])
|
||||
) {
|
||||
Activate(_reader, tag);
|
||||
}
|
||||
@@ -56,7 +55,7 @@ namespace HaDocument.Reactors {
|
||||
if (!_active && reader != null && tag != null) {
|
||||
Reset();
|
||||
_active = true;
|
||||
Index = tag["ref"];
|
||||
ID = tag["letter"];
|
||||
reader.Tag += OnTag;
|
||||
_reader = reader;
|
||||
}
|
||||
@@ -79,10 +78,6 @@ namespace HaDocument.Reactors {
|
||||
private void OnTag(object _, Tag tag) {
|
||||
switch (tag.Name)
|
||||
{
|
||||
case "autopsic":
|
||||
Autopsic = tag["value"];
|
||||
if (String.IsNullOrWhiteSpace(Autopsic)) Abort();
|
||||
break;
|
||||
case "begin":
|
||||
Page = tag["page"];
|
||||
Volume = tag["vol"];
|
||||
@@ -110,29 +105,29 @@ namespace HaDocument.Reactors {
|
||||
case "hasOriginal":
|
||||
var val = tag["value"];
|
||||
if (val.ToLower() == "true")
|
||||
hasOriginal = OptionalBool.True;
|
||||
hasOriginal = true;
|
||||
else if (val.ToLower() == "false")
|
||||
hasOriginal = OptionalBool.False;
|
||||
hasOriginal = false;
|
||||
else
|
||||
hasOriginal = OptionalBool.None;
|
||||
hasOriginal = null;
|
||||
break;
|
||||
case "isProofread":
|
||||
var val2 = tag["value"];
|
||||
if (val2.ToLower() == "true")
|
||||
isProofread = OptionalBool.True;
|
||||
isProofread = true;
|
||||
else if (val2.ToLower() == "false")
|
||||
isProofread = OptionalBool.False;
|
||||
isProofread = false;
|
||||
else
|
||||
isProofread = OptionalBool.None;
|
||||
isProofread = null;
|
||||
break;
|
||||
case "isDraft":
|
||||
var val3 = tag["value"];
|
||||
if (val3.ToLower() == "true")
|
||||
isDraft = OptionalBool.True;
|
||||
isDraft = true;
|
||||
else if (val3.ToLower() == "false")
|
||||
isDraft = OptionalBool.False;
|
||||
isDraft = false;
|
||||
else
|
||||
isDraft = OptionalBool.None;
|
||||
isDraft = null;
|
||||
break;
|
||||
case "ZHInfo":
|
||||
if (!tag.EndTag) {
|
||||
@@ -154,8 +149,7 @@ namespace HaDocument.Reactors {
|
||||
private void Add() {
|
||||
var ZHInfo = !inZH ? null : new ZHInfo(AltLineNumbering, dateChanged, Volume, Page);
|
||||
var meta = new Meta(
|
||||
Index,
|
||||
Autopsic,
|
||||
ID,
|
||||
Date,
|
||||
Sort,
|
||||
Order,
|
||||
@@ -172,21 +166,20 @@ namespace HaDocument.Reactors {
|
||||
(Sort.Year >= _availableYearRange.Item1 && Sort.Year <= _availableYearRange.Item2) ||
|
||||
(_availableVolumes == null && _availableYearRange.Item1 == 0 && _availableYearRange.Item2 == 0)
|
||||
) {
|
||||
CreatedInstances.TryAdd(meta.Index, meta);
|
||||
CreatedInstances.TryAdd(meta.ID, meta);
|
||||
}
|
||||
else {
|
||||
ExcludedInstances.TryAdd(meta.Index, meta);
|
||||
ExcludedInstances.TryAdd(meta.ID, meta);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Reset() {
|
||||
inZH = true;
|
||||
hasOriginal = OptionalBool.None;
|
||||
isProofread = OptionalBool.None;
|
||||
isDraft = OptionalBool.None;
|
||||
hasOriginal = null;
|
||||
isProofread = null;
|
||||
isDraft = null;
|
||||
dateChanged = false;
|
||||
Index = "";
|
||||
Autopsic = "";
|
||||
ID = "";
|
||||
Volume = "";
|
||||
Page = "";
|
||||
Date = "";
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace HaDocument.Reactors {
|
||||
private string Name;
|
||||
private string Prename = "";
|
||||
private string Surname = "";
|
||||
private string? Reference;
|
||||
private string? Komm;
|
||||
|
||||
internal PersonDefsReactor(IReader reader, IntermediateLibrary lib) : base(reader, lib) {
|
||||
@@ -42,6 +43,7 @@ namespace HaDocument.Reactors {
|
||||
Name = tag["name"];
|
||||
Prename = tag["vorname"];
|
||||
Surname = tag["nachname"];
|
||||
Reference = String.IsNullOrWhiteSpace(tag["ref"]) ? null : tag["ref"];
|
||||
if (!String.IsNullOrWhiteSpace(tag["komm"])) Komm = tag["komm"];
|
||||
Add();
|
||||
_active = false;
|
||||
@@ -53,11 +55,12 @@ namespace HaDocument.Reactors {
|
||||
Name = "";
|
||||
Prename = "";
|
||||
Surname = "";
|
||||
Reference = null;
|
||||
Komm = null;
|
||||
}
|
||||
|
||||
public void Add() {
|
||||
CreatedInstances.Add(Index, new Person(Index, Name, Prename, Surname, Komm));
|
||||
CreatedInstances.Add(Index, new Person(Index, Name, Prename, Surname, Komm, Reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace HaDocument.Reactors
|
||||
private bool _normalizeWhitespace = false;
|
||||
|
||||
// State
|
||||
private string Index = "";
|
||||
private string ID = "";
|
||||
|
||||
private string _page = "";
|
||||
private string _line = "";
|
||||
@@ -46,7 +46,7 @@ namespace HaDocument.Reactors
|
||||
if (!tag.EndTag &&
|
||||
!tag.IsEmpty &&
|
||||
tag.Name == "letterTradition" &&
|
||||
!String.IsNullOrWhiteSpace(tag["ref"])
|
||||
!String.IsNullOrWhiteSpace(tag["letter"])
|
||||
)
|
||||
{
|
||||
Activate(_reader, tag);
|
||||
@@ -57,33 +57,33 @@ namespace HaDocument.Reactors
|
||||
tag.Name == "ZHText"
|
||||
)
|
||||
{
|
||||
if (!CreatedStructure.ContainsKey(tag["index"]))
|
||||
this.CreatedStructure.Add(tag["index"], new Dictionary<string, HashSet<string>>());
|
||||
if (!CreatedStructure.ContainsKey(tag["letter"]))
|
||||
this.CreatedStructure.Add(tag["letter"], new Dictionary<string, HashSet<string>>());
|
||||
}
|
||||
else if (
|
||||
!tag.EndTag &&
|
||||
_active &&
|
||||
tag.Name == "line" &&
|
||||
!String.IsNullOrWhiteSpace(tag["index"])
|
||||
!String.IsNullOrWhiteSpace(tag["letter"])
|
||||
)
|
||||
{
|
||||
_line = tag["index"];
|
||||
if (!CreatedStructure[Index][_page].Contains(_line))
|
||||
_line = tag["letter"];
|
||||
if (!CreatedStructure[ID][_page].Contains(_line))
|
||||
{
|
||||
CreatedStructure[Index][_page].Add(_line);
|
||||
CreatedStructure[ID][_page].Add(_line);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
!tag.EndTag &&
|
||||
_active &&
|
||||
tag.Name == "page" &&
|
||||
!String.IsNullOrWhiteSpace(tag["index"])
|
||||
!String.IsNullOrWhiteSpace(tag["letter"])
|
||||
)
|
||||
{
|
||||
_page = tag["index"];
|
||||
if (!CreatedStructure[Index].ContainsKey(_page))
|
||||
_page = tag["letter"];
|
||||
if (!CreatedStructure[ID].ContainsKey(_page))
|
||||
{
|
||||
CreatedStructure[Index].Add(_page, new HashSet<string>());
|
||||
CreatedStructure[ID].Add(_page, new HashSet<string>());
|
||||
}
|
||||
}
|
||||
else if (
|
||||
@@ -106,7 +106,7 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
if (_hands == null)
|
||||
_hands = new List<Hand>();
|
||||
_hands.Add(new Hand(Index, _person, _handstartpg, _handstartln, _page, _line));
|
||||
_hands.Add(new Hand(ID, _person, _handstartpg, _handstartln, _page, _line));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace HaDocument.Reactors
|
||||
if (!_active && reader != null && tag != null)
|
||||
{
|
||||
_active = true;
|
||||
Index = tag["ref"];
|
||||
ID = tag["letter"];
|
||||
_element = new ElementStringBinder(reader, tag, Add, _normalizeWhitespace);
|
||||
}
|
||||
}
|
||||
@@ -124,22 +124,22 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(element)) return;
|
||||
var reason = new Tradition(
|
||||
Index,
|
||||
ID,
|
||||
element);
|
||||
CreatedInstances.TryAdd(Index, reason);
|
||||
CreatedInstances.TryAdd(ID, reason);
|
||||
if (_hands != null)
|
||||
{
|
||||
if (!CreatedHands.ContainsKey(Index))
|
||||
CreatedHands.Add(Index, _hands);
|
||||
if (!CreatedHands.ContainsKey(ID))
|
||||
CreatedHands.Add(ID, _hands);
|
||||
else
|
||||
CreatedHands[Index].AddRange(_hands);
|
||||
CreatedHands[ID].AddRange(_hands);
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
protected override void Reset()
|
||||
{
|
||||
Index = "";
|
||||
ID = "";
|
||||
_page = "";
|
||||
_line = "";
|
||||
_active = false;
|
||||
|
||||
Reference in New Issue
Block a user