mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 17:55:32 +00:00
Fast fertig für v 2.0
This commit is contained in:
@@ -31,7 +31,8 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
_normalizeWhitespace = normalizeWhitespace;
|
||||
lib.Letters = new Dictionary<string, Letter>();
|
||||
lib.Hands = new Dictionary<string, List<Hand>>();
|
||||
if (lib.Hands == null)
|
||||
lib.Hands = new Dictionary<string, List<Hand>>();
|
||||
if (lib.LetterPageLines == null)
|
||||
lib.LetterPageLines = new Dictionary<string, Dictionary<string, HashSet<string>>>();
|
||||
CreatedHands = lib.Hands;
|
||||
@@ -126,7 +127,10 @@ namespace HaDocument.Reactors
|
||||
CreatedInstances.TryAdd(Index, letter);
|
||||
if (_hands != null)
|
||||
{
|
||||
CreatedHands.Add(Index, _hands);
|
||||
if (!CreatedHands.ContainsKey(Index))
|
||||
CreatedHands.Add(Index, _hands);
|
||||
else
|
||||
CreatedHands[Index].AddRange(_hands);
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace HaDocument.Reactors
|
||||
{
|
||||
internal Dictionary<string, Tradition> CreatedInstances;
|
||||
internal Dictionary<string, Dictionary<string, HashSet<string>>> CreatedStructure;
|
||||
internal Dictionary<string, List<Hand>> CreatedHands;
|
||||
private bool _normalizeWhitespace = false;
|
||||
|
||||
// State
|
||||
@@ -18,6 +19,12 @@ namespace HaDocument.Reactors
|
||||
private string _page = "";
|
||||
private string _line = "";
|
||||
|
||||
|
||||
private List<Hand> _hands;
|
||||
private string _person = "";
|
||||
private string _handstartpg = "";
|
||||
private string _handstartln = "";
|
||||
|
||||
private ElementStringBinder _element = null;
|
||||
|
||||
internal TraditionsReactor(IReader reader, IntermediateLibrary lib, bool normalizeWhitespace) : base(reader, lib)
|
||||
@@ -26,6 +33,9 @@ namespace HaDocument.Reactors
|
||||
_lib.Traditions = new Dictionary<string, Tradition>();
|
||||
if (lib.LetterPageLines == null)
|
||||
lib.LetterPageLines = new Dictionary<string, Dictionary<string, HashSet<string>>>();
|
||||
if (lib.Hands == null)
|
||||
lib.Hands = new Dictionary<string, List<Hand>>();
|
||||
CreatedHands = lib.Hands;
|
||||
CreatedInstances = _lib.Traditions;
|
||||
CreatedStructure = lib.LetterPageLines;
|
||||
reader.Tag += Listen;
|
||||
@@ -76,6 +86,28 @@ namespace HaDocument.Reactors
|
||||
CreatedStructure[Index].Add(_page, new HashSet<string>());
|
||||
}
|
||||
}
|
||||
else if (
|
||||
!tag.EndTag &&
|
||||
!tag.IsEmpty &&
|
||||
tag.Name == "hand" &&
|
||||
!String.IsNullOrWhiteSpace(tag["ref"])
|
||||
)
|
||||
{
|
||||
_person = tag["ref"];
|
||||
_handstartln = _line;
|
||||
_handstartpg = _page;
|
||||
}
|
||||
else if (
|
||||
tag.EndTag &&
|
||||
tag.Name == "hand"
|
||||
)
|
||||
{
|
||||
if (_hands == null)
|
||||
{
|
||||
_hands = new List<Hand>();
|
||||
}
|
||||
_hands.Add(new Hand(Index, _person, _handstartpg, _handstartln, _page, _line));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Activate(IReader reader, Tag tag)
|
||||
@@ -95,6 +127,13 @@ namespace HaDocument.Reactors
|
||||
Index,
|
||||
element);
|
||||
CreatedInstances.TryAdd(Index, reason);
|
||||
if (_hands != null)
|
||||
{
|
||||
if (!CreatedHands.ContainsKey(Index))
|
||||
CreatedHands.Add(Index, _hands);
|
||||
else
|
||||
CreatedHands[Index].AddRange(_hands);
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -105,6 +144,7 @@ namespace HaDocument.Reactors
|
||||
_line = "";
|
||||
_active = false;
|
||||
_element = null;
|
||||
_hands = null;
|
||||
}
|
||||
|
||||
protected void Deactivate()
|
||||
|
||||
Reference in New Issue
Block a user