added basic start page setup; began rewrite of parser

This commit is contained in:
schnulller
2022-06-14 00:31:52 +02:00
parent 6be85d495b
commit 9e53de8be3
61 changed files with 532745 additions and 661 deletions

View File

@@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using HaDocument.Models;
// namespace HaDocument.Comparers {
// public class CommentComparer : IComparer<Comment> {
// public CommentComparer() : base() { }
// public int Compare(Comment first, Comment second) {
// if (first.Order != second.Order)
// return first.Order.CompareTo(second.Order);
// else
// return first.Index.CompareTo(second.Index);
// }
// }
// }

View File

@@ -0,0 +1,22 @@
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;
// using System.Threading.Tasks;
// using HaDocument.Models;
// namespace HaDocument.Comparers
// {
// public class DefaultComparer : IComparer<Meta>
// {
// public int Compare(Meta first, Meta second)
// {
// if (first.Sort != second.Sort)
// return System.DateTime.Compare(first.Sort, second.Sort);
// else if (first.Order != second.Order)
// return first.Order.CompareTo(second.Order);
// else
// return String.Compare(first.Index, second.Index);
// }
// }
// }

View File

@@ -0,0 +1,13 @@
// using System;
// using HaDocument.Models;
// using System.Collections.Generic;
// namespace HaDocument.Comparers {
// public class PersonComparer : IComparer<Person> {
// public int Compare(Person first, Person second) {
// var cmp = String.Compare(first.Surname, second.Surname);
// if (cmp == 0) cmp = String.Compare(first.Name, second.Name);
// return cmp;
// }
// }
// }

View File

@@ -0,0 +1,41 @@
// using System;
// using System.Collections.Generic;
// using System.Linq;
// using System.Text;
// using System.Threading.Tasks;
// using HaDocument.Models;
// namespace HaDocument.Comparers
// {
// public class ZHComparer : IComparer<Meta>
// {
// public int Compare(Meta first, Meta second)
// {
// var firstNumber = 0;
// var secondNumber = 0;
// Int32.TryParse(first.Index, out firstNumber);
// Int32.TryParse(second.Index, out secondNumber);
// return firstNumber.CompareTo(secondNumber);
// //var firstIndex = from c in first.Meta.Autopsic
// // where char.IsDigit(c)
// // select c;
// //var secondIndex = from c in second.Meta.Autopsic
// // where char.IsDigit(c)
// // select c;
// //int firstNumber = 0;
// //int secondNumber = 0;
// //Int32.TryParse(String.Join("", firstIndex), out firstNumber);
// //Int32.TryParse(String.Join("", secondIndex), out secondNumber);
// //if (firstNumber.CompareTo(secondNumber) != 0)
// // return firstNumber.CompareTo(secondNumber);
// //var firstChar = from c in first.Meta.Autopsic
// // where char.IsMeta(c)
// // select c;
// //var secondChar = from c in first.Meta.Autopsic
// // where char.IsMeta(c)
// // select c;
// //return String.Compare(String.Join("", firstChar), String.Join("", secondChar));
// }
// }
// }

View File

@@ -1,5 +1,4 @@
namespace HaDocument; namespace HaDocument;
public class Document public class Document {
{
} }

View File

@@ -1,5 +0,0 @@
namespace HaDocument.Interfaces;
public interface IDocument {
}

View File

@@ -0,0 +1,64 @@
namespace HaDocument.Interfaces;
using System.Xml.Linq;
using System.Xml.XPath;
using HaDocument.Models;
public interface IXMLRoot {
// Name of the IXMLRoot
public abstract string Type { get; }
// Name of the file prefix
public abstract string Prefix { get; }
// XPaths to determine if container is present
public abstract string[] XPathContainer { get; }
// Tag Name of child objects to be collected
public abstract Predicate<XElement> IsCollectedObject { get; }
// Gets the Key of a collected object
// public abstract Func<XElement, string?> GetKey { get; }
// Can the Root be found within that document?
public List<XElement>? IsTypeOf(XElement root) {
List<XElement>? ret = null;
foreach (var p in XPathContainer) {
var elements = root.XPathSelectElements(p);
if (elements != null && elements.Any()) {
if (ret == null) ret = new List<XElement>();
foreach (var e in elements)
if (!ret.Contains(e)) ret.Add(e);
}
}
return ret;
}
// Generate certain metadata fields to display about this root
// public abstract List<(string, string?)>? GenerateFields(XMLRootDocument document);
// Generate an identification string of which the hash will be the filename.
// The second string will be appended literally for convenience.
// If the queries of two document are equal they replace each other
// If the queries and the date of two documents are equal the later one gets deleted
public abstract (string?, string?) GenerateIdentificationString(XElement element);
// Further deciding which of two documents replaces which
// public abstract bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2);
// public Dictionary<string, XElement>? GetCollectedObjects(XMLRootDocument document) {
// Dictionary<string, XElement>? ret = null;
// var root = document.GetElement();
// root.Elements().Where(x => this.IsCollectedObject(x)).ToList().ForEach(x => {
// var id = this.GetKey(x);
// if (id != null) {
// if (ret == null) ret = new Dictionary<string, XElement>();
// ret.Add(id, x);
// }
// });
// return ret;
// }
public abstract XElement CreateHamannDocument(XElement element);
// public abstract void MergeIntoFile(XElement file, XMLRootDocument document);
}

View File

@@ -1,24 +1,20 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Backlink {
public string Index { get; } = "";
public string Letter { get; } = ""; public class Backlink {
public string Page { get; } = ""; public string Letter { get; }
public string Line { get; } = ""; public string? Page { get; }
public string MarginalIndex { get; } = ""; public string? Line { get; }
public string MarginalIndex { get; }
public Backlink( public Backlink(
string index, string letter,
string letter, string? page,
string page, string? line,
string line, string marginalindex
string marginalindex ) {
) { Letter = letter;
Index = index; Page = page;
Letter = letter; Line = line;
Page = page; MarginalIndex = marginalindex;
Line = line;
MarginalIndex = marginalindex;
}
} }
} }

View File

@@ -1,36 +1,39 @@
namespace HaDocument.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Xml.Linq;
namespace HaDocument.Models { public class Comment {
public class Comment{ public XElement Entry { get; }
public string Entry { get; } = ""; public string Value { get; }
public string Index { get; } = ""; public string Index { get; }
public string Type { get; } = ""; public string? Type { get; }
public string Lemma { get; } = ""; public string? Lemma { get; }
public string Parent { get; } = ""; public string? Parent { get; }
public int Order { get; } = -1; public int? Order { get; }
public ImmutableSortedDictionary<string, Comment> Kommentare { get; } public ImmutableSortedDictionary<string, Comment>? SubComments { get; }
public Comment( public Comment(
string entry, XElement entry,
string index, string value,
string type, string index,
string lemma, string? type,
int order, string? lemma,
SortedDictionary<string, Comment> subComments, int? order,
string parent="" SortedDictionary<string, Comment>? subComments,
) { string? parent
Entry = entry; ) {
Index = index; Value = value;
Type = type; Entry = entry;
Lemma = lemma; Index = index;
Order = order; Type = type;
Parent = parent; Lemma = lemma;
if (subComments != null) Order = order;
Kommentare = ImmutableSortedDictionary.ToImmutableSortedDictionary(subComments); Parent = parent;
else if (subComments != null)
Kommentare = null; SubComments = ImmutableSortedDictionary.ToImmutableSortedDictionary(subComments);
} else
SubComments = null;
} }
} }

View File

@@ -0,0 +1,23 @@
namespace HaDocument.Models;
public class Edit {
public string StartPage { get; }
public string StartLine { get; }
public string EndPage { get; }
public string EndLine { get; }
public string Reference { get; }
public Edit(
string reference,
string startpage,
string startline,
string endpage,
string endline
) {
StartPage = startpage;
StartLine = startline;
EndPage = endpage;
EndLine = endline;
Reference = reference;
}
}

View File

@@ -1,32 +1,21 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Editreason { using System.Xml.Linq;
public string Index { get; } = "";
public string Element { get; } = "";
public string Letter { get; } = "";
public string StartPage { get; } = "";
public string StartLine { get; } = "";
public string EndPage { get; } = "";
public string EndLine { get; } = "";
public string Reference { get; } = "";
public Editreason( public class Editreason {
string index, public string Index { get; }
string element, public XElement Element { get; }
string letter = "", public string Value { get; }
string startpage = "", public string Letter { get; }
string startline = "",
string endpage = "", public Editreason(
string endline = "", string index,
string reference = "" XElement element,
) { string value,
Index = index; string letter
Element = element; ) {
Letter = letter; Index = index;
StartPage = startpage; Value = value;
StartLine = startline; Element = element;
EndPage = endpage; Letter = letter;
EndLine = endline;
Reference = reference;
}
} }
} }

View File

@@ -1,15 +0,0 @@
using System;
using HaXMLReader.EvArgs;
using System.Collections.Generic;
namespace HaDocument.Models {
public abstract class HaModel {
protected static List<(Func<Tag, bool>, Action<Tag>)> FieldActions = null;
internal static void AddAction(Func<Tag, bool> If, Action<Tag> Then) {
if (If == null || Then == null) throw new ArgumentNullException();
if (FieldActions == null) FieldActions = new List<(Func<Tag, bool>, Action<Tag>)>();
FieldActions.Add((If, Then));
}
}
}

View File

@@ -1,26 +1,26 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Hand : HaModel {
public string Letter { get; } = "";
public string Person { get; } = "";
public string StartPage { get; } = "";
public string StartLine { get; } = "";
public string EndPage { get; } = "";
public string EndLine {get; } = "";
public Hand( public class Hand {
string letter, public string Letter { get; }
string person, public string Reference { get; }
string startpage, public string StartPage { get; }
string startline, public string StartLine { get; }
string endpage, public string EndPage { get; }
string endline public string EndLine {get; }
) {
Letter = letter; public Hand(
Person = person; string letter,
StartPage = startpage; string reference,
StartLine = startline; string startpage,
EndPage = endpage; string startline,
EndLine = endline; string endpage,
} string endline
) {
Letter = letter;
Reference = reference;
StartPage = startpage;
StartLine = startline;
EndPage = endpage;
EndLine = endline;
} }
} }

View File

@@ -1,70 +1,70 @@
using System.Collections.Generic; // using System.Collections.Generic;
using HaDocument.Interfaces; // using HaDocument.Interfaces;
namespace HaDocument.Models // namespace HaDocument.Models
{ // {
public class IntermediateLibrary // public class IntermediateLibrary
{ // {
public Dictionary<string, Tradition> Traditions; // public Dictionary<string, Tradition> Traditions;
public Dictionary<string, Person> Persons; // public Dictionary<string, Person> Persons;
public Dictionary<string, Meta> Metas; // public Dictionary<string, Meta> Metas;
public Dictionary<string, Marginal> Marginals; // public Dictionary<string, Marginal> Marginals;
public Dictionary<string, Location> Locations; // public Dictionary<string, Location> Locations;
public Dictionary<string, Letter> Letters; // public Dictionary<string, Letter> Letters;
public Dictionary<string, Person> HandPersons; // public Dictionary<string, Person> HandPersons;
public Dictionary<string, Editreason> Editreasons; // public Dictionary<string, Editreason> Editreasons;
public Dictionary<string, Comment> Comments; // public Dictionary<string, Comment> Comments;
public Dictionary<string, List<Backlink>> Backlinks; // public Dictionary<string, List<Backlink>> Backlinks;
public Dictionary<string, List<Hand>> Hands; // public Dictionary<string, List<Hand>> Hands;
// Helper Library for precalculationg the Structure of the Document: // // Helper Library for precalculationg the Structure of the Document:
public Dictionary<string, Dictionary<string, HashSet<string>>> LetterPageLines; // public Dictionary<string, Dictionary<string, HashSet<string>>> LetterPageLines;
public Library GetLibrary(IHaDocumentOptions options) // public Library GetLibrary(IHaDocumentOptions options)
{ // {
var Structure = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>(); // var Structure = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
foreach (var letter in LetterPageLines) // foreach (var letter in LetterPageLines)
{ // {
if (Metas.ContainsKey(letter.Key) && // if (Metas.ContainsKey(letter.Key) &&
Metas[letter.Key].ZH != null) // Metas[letter.Key].ZH != null)
{ // {
if (!Structure.ContainsKey(Metas[letter.Key].ZH.Volume)) // if (!Structure.ContainsKey(Metas[letter.Key].ZH.Volume))
{ // {
Structure.Add(Metas[letter.Key].ZH.Volume, new Dictionary<string, Dictionary<string, string>>()); // Structure.Add(Metas[letter.Key].ZH.Volume, new Dictionary<string, Dictionary<string, string>>());
} // }
foreach (var page in letter.Value) // foreach (var page in letter.Value)
{ // {
if (!Structure[Metas[letter.Key].ZH.Volume].ContainsKey(page.Key)) // if (!Structure[Metas[letter.Key].ZH.Volume].ContainsKey(page.Key))
{ // {
Structure[Metas[letter.Key].ZH.Volume].Add(page.Key, new Dictionary<string, string>()); // Structure[Metas[letter.Key].ZH.Volume].Add(page.Key, new Dictionary<string, string>());
} // }
foreach (var line in page.Value) // foreach (var line in page.Value)
{ // {
if (!Structure[Metas[letter.Key].ZH.Volume][page.Key].ContainsKey(line)) // if (!Structure[Metas[letter.Key].ZH.Volume][page.Key].ContainsKey(line))
{ // {
Structure[Metas[letter.Key].ZH.Volume][page.Key].Add(line, letter.Key); // Structure[Metas[letter.Key].ZH.Volume][page.Key].Add(line, letter.Key);
} // }
} // }
} // }
} // }
} // }
return new Library( // return new Library(
Traditions, // Traditions,
Persons, // Persons,
Metas, // Metas,
Marginals, // Marginals,
Locations, // Locations,
Letters, // Letters,
HandPersons, // HandPersons,
Editreasons, // Editreasons,
Comments, // Comments,
Backlinks, // Backlinks,
Hands, // Hands,
Structure, // Structure,
options // options
); // );
} // }
} // }
} // }

View File

@@ -1,16 +1,19 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Letter : HaModel { using System.Xml.Linq;
public string Index { get; } = ""; using System.Xml;
public string Element { get; } = "";
public string Value { get; } = "";
public Letter( public class Letter {
string index, public string Index { get; }
string element, public XElement Element { get; }
string value public string Value { get; }
) {
Index = index; public Letter(
Element = element; string index,
} XElement element,
string value
) {
Index = index;
Element = element;
Value = value;
} }
} }

View File

@@ -1,150 +1,140 @@
using System; // namespace HaDocument.Models;
using HaDocument.Interfaces; // using System;
using System.Collections.Immutable; // using HaDocument.Interfaces;
using System.Collections.Generic; // using System.Collections.Immutable;
using HaDocument.Models; // using System.Collections.Generic;
using HaDocument.Comparers; // using HaDocument.Models;
using System.Linq; // using HaDocument.Comparers;
// using System.Linq;
namespace HaDocument.Models
{
public class Library : ILibrary
{
public IHaDocumentOptions Options { get; }
public ImmutableDictionary<string, Tradition> Traditions { get; }
public ImmutableDictionary<string, Person> Persons { get; }
public ImmutableDictionary<string, Meta> Metas { get; }
public ImmutableDictionary<string, Marginal> Marginals { get; }
public ImmutableDictionary<string, Location> Locations { get; }
public ImmutableDictionary<string, Letter> Letters { get; }
public ImmutableDictionary<string, Person> HandPersons { get; }
public ImmutableDictionary<string, Editreason> Editreasons { get; }
public ImmutableDictionary<string, Comment> Comments { get; }
public ImmutableDictionary<string, ImmutableList<Backlink>> Backlinks { get; }
public ImmutableDictionary<string, ImmutableList<Hand>> Hands { get; }
// Structure for lookups from ZH:
public ImmutableDictionary<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>> Structure { get; }
// Lookups:
// Auswählen von Kommentaren nach (1) Kategorie, (2) Anfangsbuchstaben vom Lemma.
// So: _ = CommentsByCategoryLetter['neuzeit']['A']
public ImmutableDictionary<string, Lookup<string, Comment>> CommentsByCategoryLetter { get; }
public Lookup<string, Comment> CommentsByCategory { get; }
// Auswählen von Subkommentaren nach ID
public ImmutableDictionary<string, Comment> SubCommentsByID { get; }
// Auswählen von Marginalien nach Briefen
public Lookup<string, Marginal> MarginalsByLetter { get; }
// Ausw?hlen von Edits nach Briefen
public Lookup<string, Editreason> EditreasonsByLetter { get; }
// Auswählen von Briefen nach autoptischer Numemr und in zeitlich sortierter Reihenfolge.
public ImmutableSortedSet<Meta> MetasByDate { get; }
// Auswählen von Briefen nach dem Jahr, sortiert nach Datum
public ILookup<string, Meta> MetasByYear { get; }
public Library( // public class Library : ILibrary {
Dictionary<string, Tradition> traditions, // public IHaDocumentOptions Options { get; }
Dictionary<string, Person> persons, // public ImmutableDictionary<string, Tradition> Traditions { get; }
Dictionary<string, Meta> meta, // public ImmutableDictionary<string, Person> Persons { get; }
Dictionary<string, Marginal> marginals, // public ImmutableDictionary<string, Meta> Metas { get; }
Dictionary<string, Location> locations, // public ImmutableDictionary<string, Marginal> Marginals { get; }
Dictionary<string, Letter> letters, // public ImmutableDictionary<string, Location> Locations { get; }
Dictionary<string, Person> handPersons, // public ImmutableDictionary<string, Letter> Letters { get; }
Dictionary<string, Editreason> editReasons, // public ImmutableDictionary<string, Person> HandPersons { get; }
Dictionary<string, Comment> comments, // public ImmutableDictionary<string, Editreason> Editreasons { get; }
Dictionary<string, List<Backlink>> backlinks, // public ImmutableDictionary<string, Comment> Comments { get; }
Dictionary<string, List<Hand>> hands, // public ImmutableDictionary<string, ImmutableList<Backlink>> Backlinks { get; }
Dictionary<string, Dictionary<string, Dictionary<string, string>>> Structure, // public ImmutableDictionary<string, ImmutableList<Hand>> Hands { get; }
IHaDocumentOptions options
)
{
// Dictionaries
Traditions = ImmutableDictionary.ToImmutableDictionary(traditions);
Persons = ImmutableDictionary.ToImmutableDictionary(persons);
Metas = ImmutableDictionary.ToImmutableDictionary(meta);
Marginals = ImmutableDictionary.ToImmutableDictionary(marginals);
Locations = ImmutableDictionary.ToImmutableDictionary(locations);
Letters = ImmutableDictionary.ToImmutableDictionary(letters);
HandPersons = ImmutableDictionary.ToImmutableDictionary(handPersons);
Editreasons = ImmutableDictionary.ToImmutableDictionary(editReasons);
Comments = ImmutableDictionary.ToImmutableDictionary(comments);
var backbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Backlink>>(); // // Structure for lookups from ZH:
foreach (var entry in backlinks) // public ImmutableDictionary<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>> Structure { get; }
backbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
Backlinks = backbuilder.ToImmutableDictionary();
var handbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Hand>>(); // // Lookups:
foreach (var entry in hands) // // Auswählen von Kommentaren nach (1) Kategorie, (2) Anfangsbuchstaben vom Lemma.
handbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value)); // // So: _ = CommentsByCategoryLetter['neuzeit']['A']
Hands = handbuilder.ToImmutableDictionary(); // public ImmutableDictionary<string, Lookup<string, Comment>> CommentsByCategoryLetter { get; }
// public Lookup<string, Comment> CommentsByCategory { get; }
// Lookups // // Auswählen von Subkommentaren nach ID
CommentsByCategory = (Lookup<string, Comment>)Comments.Values.ToLookup(x => x.Type); // public ImmutableDictionary<string, Comment> SubCommentsByID { get; }
var CommentsByLetter_builder = ImmutableDictionary.CreateBuilder<string, Lookup<string, Comment>>(); // // Auswählen von Marginalien nach Briefen
foreach (var ts in CommentsByCategory) // public Lookup<string, Marginal> MarginalsByLetter { get; }
{ // // Ausw?hlen von Edits nach Briefen
CommentsByLetter_builder.Add(ts.Key, (Lookup<string, Comment>)ts.ToLookup(x => x.Index.Substring(0, 1).ToUpper())); // public Lookup<string, Editreason> EditreasonsByLetter { get; }
} // // Auswählen von Briefen nach autoptischer Numemr und in zeitlich sortierter Reihenfolge.
CommentsByCategoryLetter = CommentsByLetter_builder.ToImmutableDictionary(); // public ImmutableSortedSet<Meta> MetasByDate { get; }
MarginalsByLetter = (Lookup<string, Marginal>)Marginals.Values.ToLookup(x => x.Letter); // // Auswählen von Briefen nach dem Jahr, sortiert nach Datum
EditreasonsByLetter = (Lookup<string, Editreason>)Editreasons.Values.ToLookup(x => x.Letter); // public ILookup<string, Meta> MetasByYear { get; }
MetasByDate = Metas.Values.ToImmutableSortedSet<Meta>(new DefaultComparer());
MetasByYear = Metas.Values.ToLookup(x => x.Sort.Year.ToString());
var tempbuilder = ImmutableDictionary.CreateBuilder<string, Comment>();
foreach (var comm in Comments)
if (comm.Value.Kommentare != null)
foreach (var subcomm in comm.Value.Kommentare)
if (!tempbuilder.ContainsKey(subcomm.Key))
tempbuilder.Add(subcomm.Key, subcomm.Value);
SubCommentsByID = tempbuilder.ToImmutableDictionary();
var tempstructurebuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>>();
foreach (var volume in Structure)
{
if (volume.Value != null)
{
var tempvolbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, string>>();
foreach (var page in volume.Value)
{
if (page.Value != null)
{
tempvolbuilder.Add(page.Key, page.Value.ToImmutableDictionary());
}
}
if (tempvolbuilder.Any())
{
tempstructurebuilder.Add(volume.Key, tempvolbuilder.ToImmutableDictionary());
}
}
}
this.Structure = tempstructurebuilder.ToImmutableDictionary();
Options = options;
}
// public List<Meta> MetasByDate() {
// var ret = Metas.OrderBy(x => x.Value, new DefaultComparer()).ToLookup(x => x.Value.Autopsic, x => x.Value);
// ret.Sort(new DefaultComparer());
// return ret;
// }
public ImmutableList<Meta> MetasByZH()
{
return Metas.Values.ToImmutableList().Sort(new Comparers.ZHComparer());
}
public List<Person> PersonByAlphabet()
{
var ret = Persons.Values.ToList();
ret.Sort(new PersonComparer());
return ret;
}
} // public Library(
} // Dictionary<string, Tradition> traditions,
// Dictionary<string, Person> persons,
// Dictionary<string, Meta> meta,
// Dictionary<string, Marginal> marginals,
// Dictionary<string, Location> locations,
// Dictionary<string, Letter> letters,
// Dictionary<string, Person> handPersons,
// Dictionary<string, Editreason> editReasons,
// Dictionary<string, Comment> comments,
// Dictionary<string, List<Backlink>> backlinks,
// Dictionary<string, List<Hand>> hands,
// Dictionary<string, Dictionary<string, Dictionary<string, string>>> Structure,
// IHaDocumentOptions options
// ) {
// // Dictionaries
// Traditions = ImmutableDictionary.ToImmutableDictionary(traditions);
// Persons = ImmutableDictionary.ToImmutableDictionary(persons);
// Metas = ImmutableDictionary.ToImmutableDictionary(meta);
// Marginals = ImmutableDictionary.ToImmutableDictionary(marginals);
// Locations = ImmutableDictionary.ToImmutableDictionary(locations);
// Letters = ImmutableDictionary.ToImmutableDictionary(letters);
// HandPersons = ImmutableDictionary.ToImmutableDictionary(handPersons);
// Editreasons = ImmutableDictionary.ToImmutableDictionary(editReasons);
// Comments = ImmutableDictionary.ToImmutableDictionary(comments);
// var backbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Backlink>>();
// foreach (var entry in backlinks)
// backbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
// Backlinks = backbuilder.ToImmutableDictionary();
// var handbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableList<Hand>>();
// foreach (var entry in hands)
// handbuilder.Add(entry.Key, ImmutableList.ToImmutableList(entry.Value));
// Hands = handbuilder.ToImmutableDictionary();
// // Lookups
// CommentsByCategory = (Lookup<string, Comment>)Comments.Values.ToLookup(x => x.Type);
// var CommentsByLetter_builder = ImmutableDictionary.CreateBuilder<string, Lookup<string, Comment>>();
// foreach (var ts in CommentsByCategory) {
// CommentsByLetter_builder.Add(ts.Key, (Lookup<string, Comment>)ts.ToLookup(x => x.Index.Substring(0, 1).ToUpper()));
// }
// CommentsByCategoryLetter = CommentsByLetter_builder.ToImmutableDictionary();
// MarginalsByLetter = (Lookup<string, Marginal>)Marginals.Values.ToLookup(x => x.Letter);
// EditreasonsByLetter = (Lookup<string, Editreason>)Editreasons.Values.ToLookup(x => x.Letter);
// MetasByDate = Metas.Values.ToImmutableSortedSet<Meta>(new DefaultComparer());
// MetasByYear = Metas.Values.ToLookup(x => x.Sort.Year.ToString());
// var tempbuilder = ImmutableDictionary.CreateBuilder<string, Comment>();
// foreach (var comm in Comments)
// if (comm.Value.SubComments != null)
// foreach (var subcomm in comm.Value.SubComments)
// if (!tempbuilder.ContainsKey(subcomm.Key))
// tempbuilder.Add(subcomm.Key, subcomm.Value);
// SubCommentsByID = tempbuilder.ToImmutableDictionary();
// var tempstructurebuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, ImmutableDictionary<string, string>>>();
// foreach (var volume in Structure) {
// if (volume.Value != null) {
// var tempvolbuilder = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, string>>();
// foreach (var page in volume.Value) {
// if (page.Value != null) {
// tempvolbuilder.Add(page.Key, page.Value.ToImmutableDictionary());
// }
// }
// if (tempvolbuilder.Any()) {
// tempstructurebuilder.Add(volume.Key, tempvolbuilder.ToImmutableDictionary());
// }
// }
// }
// this.Structure = tempstructurebuilder.ToImmutableDictionary();
// Options = options;
// }
// // public List<Meta> MetasByDate() {
// // var ret = Metas.OrderBy(x => x.Value, new DefaultComparer()).ToLookup(x => x.Value.Autopsic, x => x.Value);
// // ret.Sort(new DefaultComparer());
// // return ret;
// // }
// public ImmutableList<Meta> MetasByZH() {
// return Metas.Values.ToImmutableList().Sort(new Comparers.ZHComparer());
// }
// public List<Person> PersonByAlphabet() {
// var ret = Persons.Values.ToList();
// ret.Sort(new Comparers.PersonComparer());
// return ret;
// }
// }
// }

View File

@@ -1,14 +1,13 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Location { public class Location {
public string Index { get; } = ""; public string Index { get; } = "";
public string Name { get; } = ""; public string Name { get; } = "";
public Location( public Location(
string index, string index,
string name string name
) { ) {
Index = index; Index = index;
Name = name; Name = name;
}
} }
} }

View File

@@ -1,23 +1,27 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Marginal { using System.Xml.Linq;
public string Index { get; } = "";
public string Letter { get; } = "";
public string Page { get; } = "";
public string Line { get; } = "";
public string Element { get; } = "";
public Marginal( public class Marginal {
string index, public string Index { get; }
string letter, public string Letter { get; }
string page, public string Page { get; }
string line, public string Line { get; }
string elemnt public XElement Element { get; }
) { public string Value { get; }
Index = index;
Letter = letter; public Marginal(
Page = page; XElement element,
Line = line; string value,
Element = elemnt; string index,
} string letter,
string page,
string line
) {
Index = index;
Letter = letter;
Page = page;
Line = line;
Element = element;
Value = value;
} }
} }

View File

@@ -1,49 +1,47 @@
namespace HaDocument.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using HaXMLReader.EvArgs;
namespace HaDocument.Models { public class Meta {
public class Meta { public string Index { get; }
public string Index { get; } = ""; public string Autopsic { get; }
public string Autopsic { get; } = ""; public string Date { get; }
public string Date { get; } = ""; public DateTime Sort { get; }
public DateTime Sort { get; } = new DateTime(1700, 1, 1); public int? Order { get; }
public int Order { get; } = -1; public string Location { get; }
public string Location { get; } = ""; public List<string> Senders { get; }
public List<string> Senders { get; } = null; public List<string> Receivers { get; }
public List<string> Receivers { get; } = null; public bool? hasOriginal { get; }
public OptionalBool hasOriginal { get; } = OptionalBool.None; public bool? isProofread { get; }
public OptionalBool isProofread { get; } = OptionalBool.None; public bool? isDraft { get; }
public OptionalBool isDraft { get; } = OptionalBool.None; public ZHInfo? ZH { get; }
public ZHInfo ZH { get; } = null;
public Meta(
string index,
string autopsic,
string date,
DateTime sort,
int order,
OptionalBool hasOriginal,
OptionalBool isProofread,
OptionalBool isDraft,
string location,
List<string> senders,
List<string> receivers,
ZHInfo ZH
) {
Index = index;
Autopsic = autopsic;
Date = date;
Sort = sort;
Order = order;
Location = location;
Senders = senders;
Receivers = receivers;
this.hasOriginal = hasOriginal;
this.isProofread = isProofread;
this.isDraft = isDraft;
this.ZH = ZH;
}
public Meta(
string index,
string autopsic,
string date,
DateTime sort,
int? order,
string location,
List<string> senders,
List<string> receivers,
bool? hasOriginal,
bool? isProofread,
bool? isDraft,
ZHInfo? ZH
) {
Index = index;
Autopsic = autopsic;
Date = date;
Sort = sort;
Order = order;
Location = location;
Senders = senders;
Receivers = receivers;
this.hasOriginal = hasOriginal;
this.isProofread = isProofread;
this.isDraft = isDraft;
this.ZH = ZH;
} }
} }

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace HaDocument.Models
{
public enum OptionalBool
{
True,
False,
None
}
}

View File

@@ -1,20 +1,20 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Person {
public string Index { get; } = "";
public string Name { get; } = "";
public string Prename { get; } = "";
public string Surname { get; } = "";
public Person( public class Person {
string index, public string Index { get; }
string name, public string Name { get; }
string prename, public string? Prename { get; }
string surname public string? Surname { get; }
) {
Index = index; public Person(
Name = name; string index,
Prename = prename; string name,
Surname = surname; string? prename,
} string? surname
) {
Index = index;
Name = name;
Prename = prename;
Surname = surname;
} }
} }

View File

@@ -1,14 +1,18 @@
namespace HaDocument.Models { namespace HaDocument.Models;
public class Tradition { using System.Xml.Linq;
public string Index { get; } = "";
public string Element { get; } = "";
public Tradition( public class Tradition {
string index, public string Index { get; }
string element public XElement Element { get; }
) { public string Value;
Index = index;
Element = element; public Tradition(
} string index,
XElement element,
string value
) {
Index = index;
Element = element;
Value = value;
} }
} }

View File

@@ -1,22 +1,19 @@
using System; namespace HaDocument.Models;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace HaDocument.Models public class ZHInfo {
{ public bool? alternativeLineNumbering { get; }
public bool? dateChanged { get; }
public string Volume { get; }
public string Page { get; }
public class ZHInfo public ZHInfo(string Volume, string Page, bool? alternativeLineNumbering, bool? dateChanged) {
{ this.alternativeLineNumbering = alternativeLineNumbering;
public bool alternativeLineNumbering { get; } = false; this.dateChanged = dateChanged;
public bool dateChanged { get; } = false; this.Volume = Volume;
public string Volume { get; } = ""; this.Page = Page;
public string Page { get; } = "";
public ZHInfo(bool alternativeLineNumbering, bool dateChanged, string Volume, string Page) {
this.alternativeLineNumbering = alternativeLineNumbering;
this.dateChanged = dateChanged;
this.Volume = Volume;
this.Page = Page;
}
} }
} }

View File

@@ -1,7 +1,7 @@
namespace HaDocument.Settings.XMLRoots; namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class CommentRoot : HaWeb.XMLParser.IXMLRoot { public class CommentRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Register"; public string Type { get; } = "Register";
public string Prefix { get; } = "register"; public string Prefix { get; } = "register";
public string[] XPathContainer { get; } = { ".//data//kommentare/kommcat", ".//kommentare/kommcat" }; public string[] XPathContainer { get; } = { ".//data//kommentare/kommcat", ".//kommentare/kommcat" };
@@ -18,9 +18,9 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
else return null; else return null;
}; };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
var kat = element.Attribute("value"); var kat = element.Attribute("value");
@@ -29,9 +29,9 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -41,10 +41,10 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("kommentare") == null) // if (file.Element("kommentare") == null)
file.AddFirst(new XElement("kommentare")); // file.AddFirst(new XElement("kommentare"));
file.Element("kommentare")!.AddFirst(document.Root); // file.Element("kommentare")!.AddFirst(document.Root);
} // }
} }

View File

@@ -1,7 +1,7 @@
namespace HaDocument.Settings.XMLRoots; namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot { public class DescriptionsRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Metadaten"; public string Type { get; } = "Metadaten";
public string Prefix { get; } = "metadaten"; public string Prefix { get; } = "metadaten";
public string[] XPathContainer { get; } = { ".//data/descriptions", ".//descriptions" }; public string[] XPathContainer { get; } = { ".//data/descriptions", ".//descriptions" };
@@ -18,17 +18,17 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
// else return null; // else return null;
// }; // };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -36,14 +36,14 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("descriptions") == null) // if (file.Element("descriptions") == null)
file.AddFirst(new XElement("descriptions")); // file.AddFirst(new XElement("descriptions"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); // var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
var root = file.Element("descriptions"); // var root = file.Element("descriptions");
foreach (var element in elements) { // foreach (var element in elements) {
root!.Add(element); // root!.Add(element);
} // }
} // }
} }

View File

@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class DocumentRoot : HaWeb.XMLParser.IXMLRoot { public class DocumentRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Brieftext"; public string Type { get; } = "Brieftext";
public string Prefix { get; } = "brieftext"; public string Prefix { get; } = "brieftext";
public string[] XPathContainer { get; } = { ".//data/document", ".//document" }; public string[] XPathContainer { get; } = { ".//data/document", ".//document" };
@@ -19,17 +19,17 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
else return null; else return null;
}; };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -37,14 +37,14 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("document") == null) // if (file.Element("document") == null)
file.AddFirst(new XElement("document")); // file.AddFirst(new XElement("document"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); // var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
var root = file.Element("document"); // var root = file.Element("document");
foreach (var element in elements) { // foreach (var element in elements) {
root!.Add(element); // root!.Add(element);
} // }
} // }
} }

View File

@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class EditsRoot : HaWeb.XMLParser.IXMLRoot { public class EditsRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Texteingriffe"; public string Type { get; } = "Texteingriffe";
public string Prefix { get; } = "texteingriffe"; public string Prefix { get; } = "texteingriffe";
public string[] XPathContainer { get; } = { ".//data/edits", ".//edits" }; public string[] XPathContainer { get; } = { ".//data/edits", ".//edits" };
@@ -19,17 +19,17 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
else return null; else return null;
}; };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -37,14 +37,14 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("edits") == null) // if (file.Element("edits") == null)
file.AddFirst(new XElement("edits")); // file.AddFirst(new XElement("edits"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); // var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
var root = file.Element("edits"); // var root = file.Element("edits");
foreach (var element in elements) { // foreach (var element in elements) {
root!.Add(element); // root!.Add(element);
} // }
} // }
} }

View File

@@ -1,7 +1,7 @@
namespace HaDocument.Settings.XMLRoots; namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot { public class MarginalsRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Stellenkommentar"; public string Type { get; } = "Stellenkommentar";
public string Prefix { get; } = "stellenkommentar"; public string Prefix { get; } = "stellenkommentar";
public string[] XPathContainer { get; } = { ".//data/marginalien", ".//marginalien" }; public string[] XPathContainer { get; } = { ".//data/marginalien", ".//marginalien" };
@@ -18,17 +18,17 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
else return null; else return null;
}; };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -36,14 +36,14 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("marginalien") == null) // if (file.Element("marginalien") == null)
file.AddFirst(new XElement("marginalien")); // file.AddFirst(new XElement("marginalien"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); // var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
var root = file.Element("marginalien"); // var root = file.Element("marginalien");
foreach (var element in elements) { // foreach (var element in elements) {
root!.Add(element); // root!.Add(element);
} // }
} // }
} }

View File

@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot { public class ReferencesRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Personen / Orte"; public string Type { get; } = "Personen / Orte";
public string Prefix { get; } = "personenorte"; public string Prefix { get; } = "personenorte";
public string[] XPathContainer { get; } = { ".//data/definitions", ".//definitions" }; public string[] XPathContainer { get; } = { ".//data/definitions", ".//definitions" };
@@ -17,17 +17,17 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
return elem.Name.ToString(); return elem.Name.ToString();
}; };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -35,14 +35,14 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("definitions") == null) // if (file.Element("definitions") == null)
file.AddFirst(new XElement("definitions")); // file.AddFirst(new XElement("definitions"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); // var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
var root = file.Element("definitions"); // var root = file.Element("definitions");
foreach (var element in elements) { // foreach (var element in elements) {
root!.Add(element); // root!.Add(element);
} // }
} // }
} }

View File

@@ -2,7 +2,7 @@ namespace HaDocument.Settings.XMLRoots;
using System.Xml.Linq; using System.Xml.Linq;
public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot { public class TraditionsRoot : HaDocument.Interfaces.IXMLRoot {
public string Type { get; } = "Überlieferung"; public string Type { get; } = "Überlieferung";
public string Prefix { get; } = "ueberlieferung"; public string Prefix { get; } = "ueberlieferung";
public string[] XPathContainer { get; } = { ".//data/traditions", ".//traditions" }; public string[] XPathContainer { get; } = { ".//data/traditions", ".//traditions" };
@@ -19,17 +19,17 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
else return null; else return null;
}; };
public List<(string, string?)>? GenerateFields(XMLRootDocument document) { // public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
return null; // return null;
} // }
public (string?, string?) GenerateIdentificationString(XElement element) { public (string?, string?) GenerateIdentificationString(XElement element) {
return (null, null); return (null, null);
} }
public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) { // public bool Replaces(XMLRootDocument doc1, XMLRootDocument doc2) {
return true; // return true;
} // }
public XElement CreateHamannDocument(XElement element) { public XElement CreateHamannDocument(XElement element) {
var opus = new XElement("opus"); var opus = new XElement("opus");
@@ -37,13 +37,13 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
return opus; return opus;
} }
public void MergeIntoFile(XElement file, XMLRootDocument document) { // public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("traditions") == null) // if (file.Element("traditions") == null)
file.AddFirst(new XElement("traditions")); // file.AddFirst(new XElement("traditions"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); // var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
var root = file.Element("traditions"); // var root = file.Element("traditions");
foreach (var element in elements) { // foreach (var element in elements) {
root!.Add(element); // root!.Add(element);
} // }
} // }
} }

View File

@@ -0,0 +1,16 @@
{
"FormattingOptions": {
"NewLinesForBracesInLambdaExpressionBody": false,
"NewLinesForBracesInAnonymousMethods": false,
"NewLinesForBracesInAnonymousTypes": false,
"NewLinesForBracesInControlBlocks": false,
"NewLinesForBracesInTypes": false,
"NewLinesForBracesInMethods": false,
"NewLinesForBracesInProperties": false,
"NewLinesForBracesInObjectCollectionArrayInitializers": false,
"NewLinesForBracesInAccessors": false,
"NewLineForElse": false,
"NewLineForCatch": false,
"NewLineForFinally": false
}
}

View File

@@ -28,6 +28,7 @@ namespace HaDocument
_createReactors(); _createReactors();
_reader.Read(); _reader.Read();
_library = _createLibrary(); _library = _createLibrary();
_reader.Dispose();
return GetLibrary(); return GetLibrary();
} }

View File

@@ -132,6 +132,9 @@ public class APIController : Controller {
if (docs == null) docs = new List<XMLRootDocument>(); if (docs == null) docs = new List<XMLRootDocument>();
docs.Add(doc); docs.Add(doc);
} }
xdocument = null;
retdocs = null;
streamedFileContent = null;
} }
try { try {

View File

@@ -87,7 +87,7 @@ public class Briefecontroller : Controller {
var senders = meta.Senders.Select(x => lib.Persons[x].Name) ?? new List<string>(); var senders = meta.Senders.Select(x => lib.Persons[x].Name) ?? new List<string>();
var recivers = meta.Receivers.Select(x => lib.Persons[x].Name) ?? new List<string>(); var recivers = meta.Receivers.Select(x => lib.Persons[x].Name) ?? new List<string>();
var zhstring = meta.ZH != null ? HaWeb.HTMLHelpers.LetterHelpers.CreateZHString(meta) : null; var zhstring = meta.ZH != null ? HaWeb.HTMLHelpers.LetterHelpers.CreateZHString(meta) : null;
return new BriefeMetaViewModel(meta, hasMarginals, false) { return new BriefeMetaViewModel(meta, hasMarginals) {
ParsedZHString = zhstring, ParsedZHString = zhstring,
ParsedSenders = HTMLHelpers.StringHelpers.GetEnumerationString(senders), ParsedSenders = HTMLHelpers.StringHelpers.GetEnumerationString(senders),
ParsedReceivers = HTMLHelpers.StringHelpers.GetEnumerationString(recivers) ParsedReceivers = HTMLHelpers.StringHelpers.GetEnumerationString(recivers)

View File

@@ -17,42 +17,116 @@ public class SucheController : Controller {
_lettersForPage = config.GetValue<int>("LettersOnPage"); _lettersForPage = config.GetValue<int>("LettersOnPage");
} }
[Route("Suche")] [Route("Suche/{letterno}")]
// Filter, Order By Year, Paginate, Order By Date and by Order, Parse public IActionResult GoTo(string letterno) {
public IActionResult Index() {
var lib = _lib.GetLibrary(); var lib = _lib.GetLibrary();
return View(); var letter = lib.Metas.Where(x => x.Value.Autopsic == letterno);
if (letter != null)
return RedirectToAction("Index", "Briefe", new { id = letterno });
return _error404();
} }
private BriefeMetaViewModel generateMetaViewModel(ILibrary lib, Meta meta) { [Route("Suche/{zhvolume}/{zhpage}")]
public IActionResult GoToZH(string zhvolume, string zhpage) {
// TODO: Bug in letter parsing: dictionary is WRONG!
var lib = _lib.GetLibrary();
var pages = lib.Structure.ContainsKey(zhvolume) ? lib.Structure[zhvolume] : null;
if (pages == null) return _error404();
var lines = pages.ContainsKey(zhpage) ? pages[zhpage] : null;
if (lines == null) return _error404();
var letters = lines.Aggregate(new HashSet<string>(), (x, y) => { x.Add(y.Value); return x; });
if (letters != null && letters.Any() && letters.Count == 1) return RedirectToAction("Index", "Briefe", new { id = letters.First() });
if (letters != null && letters.Any()) {
var metas = lib.Metas.Where(x => letters.Contains(x.Key)).Select(x => x.Value);
if (metas == null) return _error404();
var metasbyyear = metas.ToLookup(x => x.Sort.Year).OrderBy(x => x.Key).ToList();
return _paginateSend(lib, 0, metasbyyear);
}
return _error404();
}
[Route("Suche")]
// Order of actions:
// Filter, sort by year, paginate, sort by Meta.Sort & .Order, parse
public IActionResult Index(string? person, int page = 0) {
var lib = _lib.GetLibrary();
List<IGrouping<int, Meta>>? metasbyyear = null;
if (person != null) {
var letters = lib.Metas
.Where(x => x.Value.Senders.Contains(person) || x.Value.Receivers.Contains(person))
.Select(x => x.Value);
if (letters == null) return _error404();
metasbyyear = letters.ToLookup(x => x.Sort.Year).OrderBy(x => x.Key).ToList();
} else {
metasbyyear = lib.MetasByYear.OrderBy(x => x.Key).ToList();
}
return _paginateSend(lib, page, metasbyyear, person);
}
private List<(string Key, string Person)> _getAvailablePersons(ILibrary lib) {
return lib.Persons
.OrderBy(x => x.Value.Surname)
.ThenBy(x => x.Value.Prename)
.Select(x => (x.Key, x.Value.Name))
.ToList();
}
private BriefeMetaViewModel _generateMetaViewModel(ILibrary lib, Meta meta) {
var hasMarginals = lib.MarginalsByLetter.Contains(meta.Index) ? true : false; var hasMarginals = lib.MarginalsByLetter.Contains(meta.Index) ? true : false;
var senders = meta.Senders.Select(x => lib.Persons[x].Name) ?? new List<string>(); var senders = meta.Senders.Select(x => lib.Persons[x].Name) ?? new List<string>();
var recivers = meta.Receivers.Select(x => lib.Persons[x].Name) ?? new List<string>(); var recivers = meta.Receivers.Select(x => lib.Persons[x].Name) ?? new List<string>();
var zhstring = meta.ZH != null ? HaWeb.HTMLHelpers.LetterHelpers.CreateZHString(meta) : null; var zhstring = meta.ZH != null ? HaWeb.HTMLHelpers.LetterHelpers.CreateZHString(meta) : null;
return new BriefeMetaViewModel(meta, hasMarginals, false) { return new BriefeMetaViewModel(meta, hasMarginals) {
ParsedZHString = zhstring, ParsedZHString = zhstring,
ParsedSenders = HTMLHelpers.StringHelpers.GetEnumerationString(senders), ParsedSenders = HTMLHelpers.StringHelpers.GetEnumerationString(senders),
ParsedReceivers = HTMLHelpers.StringHelpers.GetEnumerationString(recivers) ParsedReceivers = HTMLHelpers.StringHelpers.GetEnumerationString(recivers)
}; };
} }
private List<(int StartYear, int EndYear)>? Paginate(ILookup<int, List<Meta>>? letters) { private List<(int StartYear, int EndYear)>? _paginate(List<IGrouping<int, Meta>>? letters) {
if (letters == null || !letters.Any()) return null; if (letters == null || !letters.Any()) return null;
var orderedl = letters.OrderBy(x => x.Key);
List<(int StartYear, int EndYear)>? res = null; List<(int StartYear, int EndYear)>? res = null;
int startyear = 0; int startyear = 0;
int count = 0; int count = 0;
foreach (var letterlist in orderedl) { foreach (var letterlist in letters) {
count += letterlist.Count();
if (count == 0) { if (count == 0) {
startyear = letterlist.Key; startyear = letterlist.Key;
} }
count += letterlist.Count();
if (count >= _lettersForPage) { if (count >= _lettersForPage) {
if (res == null) res = new List<(int StartYear, int EndYear)>(); if (res == null) res = new List<(int StartYear, int EndYear)>();
res.Add((startyear, letterlist.Key)); res.Add((startyear, letterlist.Key));
count = 0; count = 0;
} }
if (letterlist == letters.Last()) {
if (res == null) res = new List<(int StartYear, int EndYear)>();
res.Add((startyear, letterlist.Key));
}
} }
return res; return res;
} }
private IActionResult _paginateSend(ILibrary lib, int page, List<IGrouping<int, Meta>>? metasbyyear, string? person = null) {
var pages = _paginate(metasbyyear);
if (pages != null && page >= pages.Count) return _error404();
if (pages == null && page > 0) return _error404();
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters = null;
if (pages != null)
letters = metasbyyear
.Where(x => x.Key >= pages[page].StartYear && x.Key <= pages[page].EndYear)
.Select(x => (x.Key, x
.Select(y => _generateMetaViewModel(lib, y))
.OrderBy(x => x.Meta.Sort)
.ThenBy(x => x.Meta.Order)
.ToList()))
.ToList();
var model = new SucheViewModel(letters, page, pages, _getAvailablePersons(lib));
if (person != null) model.ActivePerson = person;
return View("Index", model);
}
private IActionResult _error404() {
Response.StatusCode = 404;
return Redirect("/Error404");
}
} }

View File

@@ -42,6 +42,7 @@ public class HaDocumentWrapper : IHaDocumentWrappper {
if (ModelState != null) ModelState.AddModelError("Error", "Das Dokument konnte nicht geparst werden: " + ex.Message); if (ModelState != null) ModelState.AddModelError("Error", "Das Dokument konnte nicht geparst werden: " + ex.Message);
return null; return null;
} }
return Library; return Library;
} }

211648
HaWeb/Hammannoindet.xml Normal file

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,6 @@ using System.Web;
public class BriefeMetaViewModel { public class BriefeMetaViewModel {
public Meta Meta { get; private set; } public Meta Meta { get; private set; }
public bool HasMarginals { get; private set; } public bool HasMarginals { get; private set; }
public bool ShowZHData { get; private set; }
public bool HasText { get; set; } = true; public bool HasText { get; set; } = true;
private string? _ParsedSenders; private string? _ParsedSenders;
@@ -47,9 +46,8 @@ public class BriefeMetaViewModel {
public (BriefeMetaViewModel, string)? Prev { get; set; } public (BriefeMetaViewModel, string)? Prev { get; set; }
public BriefeMetaViewModel(Meta meta, bool hasMarginals, bool showZHData) { public BriefeMetaViewModel(Meta meta, bool hasMarginals) {
Meta = meta; Meta = meta;
HasMarginals = hasMarginals; HasMarginals = hasMarginals;
ShowZHData = showZHData;
} }
} }

View File

@@ -1,15 +1,21 @@
namespace HaWeb.Models; namespace HaWeb.Models;
public class SucheViewModel { public class SucheViewModel {
public List<(int Year, List<BriefeMetaViewModel> LetterList)> Letters { get; private set; } public List<(int Year, List<BriefeMetaViewModel> LetterList)>? Letters { get; private set; }
public int Count { get; private set; } public int Count { get; private set; }
public int ActiveYears { get; private set; } public int ActiveYear { get; private set; }
public List<(int StartYear, int EndYear)> AvailableYears { get; private set; } public List<(int StartYear, int EndYear)>? AvailableYears { get; private set; }
public string? ActivePerson {get; set; }
public List<(string Key, string Name)>? AvailablePersons { get; private set; }
public SucheViewModel(List<(int Year, List<BriefeMetaViewModel> LetterList)> letters, int count, int activeYears, List<(int StartYear, int EndYear)> availableYears) { public SucheViewModel(List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters, int activeYear, List<(int StartYear, int EndYear)>? availableYears, List<(string Key, string Name)>? availablePersons) {
Letters = letters; Letters = letters;
Count = count; if (letters != null)
ActiveYears = activeYears; Count = letters.Select(x => x.LetterList.Count).Aggregate(0, (x, y) => { x += y; return x; });
else
Count = 0;
ActiveYear = activeYear;
AvailableYears = availableYears; AvailableYears = availableYears;
AvailablePersons = availablePersons;
} }
} }

View File

@@ -8,20 +8,11 @@ using HaWeb.XMLParser;
public class XMLRootDocument { public class XMLRootDocument {
private XElement? _Element; private XElement? _Element;
private string? _filename; private string? _filename;
private IFileInfo? _file;
[JsonIgnore] [JsonIgnore]
public IXMLRoot XMLRoot { get; private set; } public IXMLRoot XMLRoot { get; private set; }
[JsonIgnore]
public XElement Root {
get {
if (_Element == null) {
_Element = _GetElement();
}
return _Element;
}
}
public string FileName { public string FileName {
get { get {
if (_filename == null) if (_filename == null)
@@ -31,7 +22,17 @@ public class XMLRootDocument {
} }
[JsonIgnore] [JsonIgnore]
public IFileInfo? File { get; set; } public IFileInfo? File {
get {
return _file;
}
set {
_file = value;
// After saving, we don't need to save the ELement anymore, it can get read in if it's used.
// We do this to prevent memory hogging. TODO: MAKE IT MORE EFFICIENT, EG ALL USED FILES HAVE SET ELEMENTS OR SO
// TODO Also make the file directory more efficient by reading in the directories as they are requested.
if (value != null) _Element = null;
} }
public string Prefix { get; private set; } public string Prefix { get; private set; }
public DateTime Date { get; private set; } public DateTime Date { get; private set; }
@@ -89,7 +90,7 @@ public class XMLRootDocument {
} }
} }
private XElement _GetElement() { public XElement GetElement() {
if (File == null || String.IsNullOrWhiteSpace(File.PhysicalPath) || !File.Exists) if (File == null || String.IsNullOrWhiteSpace(File.PhysicalPath) || !File.Exists)
throw new Exception("Es ist kein Pfad für die XML-Datei vorhanden."); throw new Exception("Es ist kein Pfad für die XML-Datei vorhanden.");
@@ -120,6 +121,15 @@ public class XMLRootDocument {
state.AddModelError("Error", "No corresponding Root Element found."); state.AddModelError("Error", "No corresponding Root Element found.");
return; return;
} }
await root.CreateHamannDocument(Root).SaveAsync(stream, SaveOptions.DisableFormatting, new CancellationToken());
if (_Element == null) {
if (File == null) {
state.AddModelError("Error", "There is neither a file nor a saved element for this Document aborting the save.");
return;
}
_Element = GetElement();
}
await root.CreateHamannDocument(_Element).SaveAsync(stream, SaveOptions.DisableFormatting, new CancellationToken());
} }
} }

View File

@@ -5,7 +5,7 @@ To build the project install nodejs > 16.5 LTS. Install npm > 8.10.0. After that
Dotnet 6.0.300 is currently used. To build the project, do a `dotnet restore` and collect the `Microsoft.FeatureManagement.AspNetCore` nuget-package which is used to enable feauture-flags in `appsettings.json`. Some routes, such as the admin area of the project will only be mapped if certain flags are present and set to true. Dotnet 6.0.300 is currently used. To build the project, do a `dotnet restore` and collect the `Microsoft.FeatureManagement.AspNetCore` nuget-package which is used to enable feauture-flags in `appsettings.json`. Some routes, such as the admin area of the project will only be mapped if certain flags are present and set to true.
Also, this project requires two other projects `HaDocumentV6` (for reading in the file into convenient to use models) and `HaXMLReader` (for forward parsing elements such as letters, comments, traditions and marginals in an HTML transform). They have no dependencies (apart from each other and `.NET 6`) and are build at build time automatically. Also, this project requires two other projects `HaDocumentV6` (for reading in the file into convenient to use models) and `HaXMLReader` (for forward parsing elements such as letters, comments, traditions and marginals in an HTML transform). They have no dependencies (apart from each other and `.NET 6`) and are build and linked at build time automatically.
## Building the project ## Building the project
@@ -15,7 +15,7 @@ to build the necessary `output.css`-File.
`dotnet build HaWeb.csproj` `dotnet build HaWeb.csproj`
to build the App. Please do consider the order of these commands. to build the Website. Please do consider the order of these commands.
Don't forget to place a valid `Hamann.xml`-File in the root of the build to provide a starting and fallback XML-file. Don't forget to place a valid `Hamann.xml`-File in the root of the build to provide a starting and fallback XML-file.
@@ -73,3 +73,4 @@ TODO Abhärten des Konstruktors von XMLRootDokument für von außerhalb platzier
TODO XML-Check im Client TODO XML-Check im Client
TODO Lock für die Liste, Bzw ConcurretBag TODO Lock für die Liste, Bzw ConcurretBag
TODO 516A david friedlaender in den traditions TODO 516A david friedlaender in den traditions
TODO 3 Zeilen marginal schließt perfekt an 2 zeilen text an

View File

@@ -46,7 +46,7 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("kommentare") == null) if (file.Element("kommentare") == null)
file.AddFirst(new XElement("kommentare")); file.AddFirst(new XElement("kommentare"));
file.Element("kommentare")!.AddFirst(document.Root); file.Element("kommentare")!.AddFirst(document.GetElement());
} }
} }

View File

@@ -41,7 +41,7 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("descriptions") == null) if (file.Element("descriptions") == null)
file.AddFirst(new XElement("descriptions")); file.AddFirst(new XElement("descriptions"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); var elements = document.GetElement().Elements().Where(x => IsCollectedObject(x));
var root = file.Element("descriptions"); var root = file.Element("descriptions");
foreach (var element in elements) { foreach (var element in elements) {
root!.Add(element); root!.Add(element);

View File

@@ -42,7 +42,7 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("document") == null) if (file.Element("document") == null)
file.AddFirst(new XElement("document")); file.AddFirst(new XElement("document"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); var elements = document.GetElement().Elements().Where(x => IsCollectedObject(x));
var root = file.Element("document"); var root = file.Element("document");
foreach (var element in elements) { foreach (var element in elements) {
root!.Add(element); root!.Add(element);

View File

@@ -41,7 +41,7 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("edits") == null) if (file.Element("edits") == null)
file.AddFirst(new XElement("edits")); file.AddFirst(new XElement("edits"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); var elements = document.GetElement().Elements().Where(x => IsCollectedObject(x));
var root = file.Element("edits"); var root = file.Element("edits");
foreach (var element in elements) { foreach (var element in elements) {
root!.Add(element); root!.Add(element);

View File

@@ -41,7 +41,7 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("marginalien") == null) if (file.Element("marginalien") == null)
file.AddFirst(new XElement("marginalien")); file.AddFirst(new XElement("marginalien"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); var elements = document.GetElement().Elements().Where(x => IsCollectedObject(x));
var root = file.Element("marginalien"); var root = file.Element("marginalien");
foreach (var element in elements) { foreach (var element in elements) {
root!.Add(element); root!.Add(element);

View File

@@ -39,7 +39,7 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("definitions") == null) if (file.Element("definitions") == null)
file.AddFirst(new XElement("definitions")); file.AddFirst(new XElement("definitions"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); var elements = document.GetElement().Elements().Where(x => IsCollectedObject(x));
var root = file.Element("definitions"); var root = file.Element("definitions");
foreach (var element in elements) { foreach (var element in elements) {
root!.Add(element); root!.Add(element);

View File

@@ -41,7 +41,7 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
public void MergeIntoFile(XElement file, XMLRootDocument document) { public void MergeIntoFile(XElement file, XMLRootDocument document) {
if (file.Element("traditions") == null) if (file.Element("traditions") == null)
file.AddFirst(new XElement("traditions")); file.AddFirst(new XElement("traditions"));
var elements = document.Root.Elements().Where(x => IsCollectedObject(x)); var elements = document.GetElement().Elements().Where(x => IsCollectedObject(x));
var root = file.Element("traditions"); var root = file.Element("traditions");
foreach (var element in elements) { foreach (var element in elements) {
root!.Add(element); root!.Add(element);

View File

@@ -13,7 +13,7 @@
</noscript> </noscript>
<div class="ha-letterheader"> <div class="ha-letterheader">
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", Model.MetaData) @await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (Model.MetaData, false))
<div class="ha-letterheadernav"> <div class="ha-letterheadernav">
<div class="ha-lettertabs"> <div class="ha-lettertabs">
@if (Model.ParsedText != null && !String.IsNullOrWhiteSpace(Model.ParsedText)) @if (Model.ParsedText != null && !String.IsNullOrWhiteSpace(Model.ParsedText))

View File

@@ -1,26 +1,26 @@
@model BriefeMetaViewModel @model (BriefeMetaViewModel Letter, bool ShowZHData)
<div class="ha-letterhead"> <div class="ha-letterhead">
<div class="ha-letternumber"> <div class="ha-letternumber">
<div class="ha-letternumberinline"> <div class="ha-letternumberinline">
@Model.Meta.Autopsic @Model.Letter.Meta.Autopsic
</div> </div>
</div> </div>
<div class="ha-metadata"> <div class="ha-metadata">
<div class="ha-metadatarows"> <div class="ha-metadatarows">
<div class="ha-metadataupperrow"> <div class="ha-metadataupperrow">
<div class="ha-metadatadate"> <div class="ha-metadatadate">
@Model.Meta.Date @Model.Letter.Meta.Date
</div> </div>
@if (Model.HasText) { @if (Model.Letter.HasText) {
@if (Model.ParsedZHString != null && Model.ShowZHData) { @if (Model.Letter.ParsedZHString != null && Model.ShowZHData) {
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-pill"> <div class="ha-pill">
<span>@Html.Raw(Model.ParsedZHString)</span> <span>@Html.Raw(Model.Letter.ParsedZHString)</span>
</div> </div>
</div> </div>
} }
else if (Model.ParsedZHString == null) { else if (Model.Letter.ParsedZHString == null) {
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-pill ha-newpill"> <div class="ha-pill ha-newpill">
<span>Neu</span> <span>Neu</span>
@@ -28,7 +28,7 @@
</div> </div>
} }
@if (Model.Meta.hasOriginal != HaDocument.Models.OptionalBool.True) { @if (Model.Letter.Meta.hasOriginal != HaDocument.Models.OptionalBool.True) {
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-pill"> <div class="ha-pill">
<span class="ha-cross">Orig</span> <span class="ha-cross">Orig</span>
@@ -49,7 +49,7 @@
</div> </div>
} }
@if (Model.Meta.isProofread != HaDocument.Models.OptionalBool.True) { @if (Model.Letter.Meta.isProofread != HaDocument.Models.OptionalBool.True) {
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-pill"> <div class="ha-pill">
<span class="ha-cross">geprüft</span> <span class="ha-cross">geprüft</span>
@@ -70,7 +70,7 @@
</div> </div>
} }
@if (Model.Meta.ZH != null && Model.Meta.ZH.dateChanged) { @if (Model.Letter.Meta.ZH != null && Model.Letter.Meta.ZH.dateChanged) {
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-pill"> <div class="ha-pill">
neu datiert neu datiert
@@ -81,7 +81,7 @@
</div> </div>
} }
@if (Model.HasMarginals) { @if (Model.Letter.HasMarginals) {
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-pill"> <div class="ha-pill">
Komm Komm
@@ -94,19 +94,19 @@
} }
</div> </div>
<div class="ha-metadatapersons"> <div class="ha-metadatapersons">
@if (!String.IsNullOrWhiteSpace(Model.ParsedReceivers)) { @if (!String.IsNullOrWhiteSpace(Model.Letter.ParsedReceivers)) {
@if (Model.Meta.isDraft == HaDocument.Models.OptionalBool.True) { @if (Model.Letter.Meta.isDraft == HaDocument.Models.OptionalBool.True) {
<span>@Html.Raw(Model.ParsedSenders)</span> <span>@Html.Raw(Model.Letter.ParsedSenders)</span>
<div class="ha-tooltip"> <div class="ha-tooltip">
<div class="ha-tooltiptext" style="bottom: 100%;"> <div class="ha-tooltiptext" style="bottom: 100%;">
Entwurf Entwurf
</div> </div>
</div> </div>
<span>@Html.Raw(Model.ParsedReceivers)</span> <span>@Html.Raw(Model.Letter.ParsedReceivers)</span>
} }
else { else {
<span>@Html.Raw(Model.ParsedSenders) → @Html.Raw(Model.ParsedReceivers)</span> <span>@Html.Raw(Model.Letter.ParsedSenders) → @Html.Raw(Model.Letter.ParsedReceivers)</span>
} }
} }
</div> </div>

View File

@@ -6,5 +6,45 @@
} }
<div class="ha-search"> <div class="ha-search">
@if (Model.Letters != null) {
<div class="ha-letterlisthead">
<h1>Briefauswahl</h1>
<div class="ha-letterlistnav">
@if (Model.AvailableYears != null && Model.AvailableYears.Any()) {
@for(var i = 0; i < Model.AvailableYears.Count; i++) {
<a class="@(Model.ActiveYear == i ? "active" : "")" asp-route-person="@Model.ActivePerson" asp-controller="Suche" asp-action="Index" asp-route-page="@i">
@if (Model.AvailableYears[i].StartYear != Model.AvailableYears[i].EndYear) {
<span>
@Model.AvailableYears[i].StartYear-@Model.AvailableYears[i].EndYear
</span>
}
else {
<span>
@Model.AvailableYears[i].StartYear
</span>
}
</a>
}
}
</div>
</div>
<div class="ha-personlist">
@if(Model.AvailablePersons != null) {
@foreach (var person in Model.AvailablePersons) {
<a class="@(Model.ActivePerson == person.Key ? "active" : "")" asp-controller="Suche" asp-action="Index" asp-route-person="@person.Key" asp-route-page="@null">
@person.Name
</a>
}
}
</div>
<div class="ha-letterlist">
@foreach (var year in Model.Letters) {
foreach (var letter in year.LetterList) {
<a asp-controller="Briefe" asp-action="Index" asp-route-id="@letter.Meta.Autopsic">
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true))
</a>
}
}
</div>
}
</div> </div>

View File

@@ -47,7 +47,7 @@ public interface IXMLRoot {
// public Dictionary<string, XElement>? GetCollectedObjects(XMLRootDocument document) { // public Dictionary<string, XElement>? GetCollectedObjects(XMLRootDocument document) {
// Dictionary<string, XElement>? ret = null; // Dictionary<string, XElement>? ret = null;
// var root = document.Root; // var root = document.GetElement();
// root.Elements().Where(x => this.IsCollectedObject(x)).ToList().ForEach(x => { // root.Elements().Where(x => this.IsCollectedObject(x)).ToList().ForEach(x => {
// var id = this.GetKey(x); // var id = this.GetKey(x);
// if (id != null) { // if (id != null) {

281525
HaWeb/attributes.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,357 @@
opus
opus/data
opus/data/definitions
opus/data/definitions/handDefs
opus/data/definitions/locationDefs
opus/data/definitions/personDefs
opus/data/definitions/structureDefs
opus/data/descriptions
opus/document
opus/document/letterText/added/anchor
opus/document/letterText/added/anchor/@ref
opus/document/letterText/address/aq/del/ul
opus/document/letterText/address/aq/line/@type
opus/document/letterText/address/aq/ul/aq
opus/document/letterText/address/aq/ul/line
opus/document/letterText/address/aq/ul/line/@autopsic
opus/document/letterText/address/aq/ul/line/@index
opus/document/letterText/address/del/aq/line
opus/document/letterText/address/del/aq/line/@autopsic
opus/document/letterText/address/del/aq/line/@index
opus/document/letterText/address/del/ul
opus/document/letterText/address/edit/aq/dul
opus/document/letterText/address/edit/aq/hand
opus/document/letterText/address/edit/aq/hand/@ref
opus/document/letterText/address/edit/aq/ul/super
opus/document/letterText/address/edit/hand
opus/document/letterText/address/edit/hand/aq
opus/document/letterText/address/edit/hand/aq/super
opus/document/letterText/address/edit/hand/@ref
opus/document/letterText/address/hand/aq
opus/document/letterText/address/hand/aq/ul
opus/document/letterText/address/hand/super/ul
opus/document/letterText/address/line/@type
opus/document/letterText/address/note
opus/document/letterText/address/nr
opus/document/letterText/address/page
opus/document/letterText/address/page/@autopsic
opus/document/letterText/address/page/@index
opus/document/letterText/align/address/aq
opus/document/letterText/align/aq/del
opus/document/letterText/align/aq/edit
opus/document/letterText/align/aq/edit/@ref
opus/document/letterText/align/aq/super
opus/document/letterText/align/datum/del/aq
opus/document/letterText/align/datum/edit/gr
opus/document/letterText/align/datum/nr
opus/document/letterText/align/datum/sub/aq
opus/document/letterText/align/del/gr
opus/document/letterText/align/edit/aq/super
opus/document/letterText/align/edit/datum/del
opus/document/letterText/align/edit/datum/del/nr
opus/document/letterText/align/edit/datum/super
opus/document/letterText/align/edit/gr
opus/document/letterText/align/edit/gr/del
opus/document/letterText/align/edit/sig/aq
opus/document/letterText/align/edit/super
opus/document/letterText/align/hand/datum/super
opus/document/letterText/align/hand/datum/ul
opus/document/letterText/align/hand/del
opus/document/letterText/align/hand/sig
opus/document/letterText/align/hand/sig/aq
opus/document/letterText/align/sig/datum
opus/document/letterText/align/sig/nr/aq
opus/document/letterText/align/up/aq
opus/document/letterText/anchor/added
opus/document/letterText/anchor/note
opus/document/letterText/aq/address/del
opus/document/letterText/aq/address/edit
opus/document/letterText/aq/address/edit/@ref
opus/document/letterText/aq/address/edit/ul
opus/document/letterText/aq/align/ul
opus/document/letterText/aq/del/edit
opus/document/letterText/aq/del/edit/@ref
opus/document/letterText/aq/dul/line
opus/document/letterText/aq/dul/line/@autopsic
opus/document/letterText/aq/dul/line/@index
opus/document/letterText/aq/edit/del
opus/document/letterText/aq/edit/del/nr
opus/document/letterText/aq/super/ul
opus/document/letterText/aq/ul/added
opus/document/letterText/aq/ul/del
opus/document/letterText/aq/ul/super
opus/document/letterText/datum/align/added
opus/document/letterText/datum/align/datum
opus/document/letterText/datum/align/del
opus/document/letterText/datum/aq/line
opus/document/letterText/datum/aq/line/@autopsic
opus/document/letterText/datum/aq/line/@index
opus/document/letterText/datum/edit/super
opus/document/letterText/datum/edit/ul
opus/document/letterText/datum/gr
opus/document/letterText/datum/hand
opus/document/letterText/datum/hand/@ref
opus/document/letterText/datum/super/aq
opus/document/letterText/del/added
opus/document/letterText/del/aq/del
opus/document/letterText/del/del/nr
opus/document/letterText/del/edit/nr
opus/document/letterText/del/gr
opus/document/letterText/del/gr/edit
opus/document/letterText/del/gr/edit/@ref
opus/document/letterText/del/gr/line
opus/document/letterText/del/gr/line/@autopsic
opus/document/letterText/del/gr/line/@index
opus/document/letterText/del/super
opus/document/letterText/del/super/aq
opus/document/letterText/del/ul/line
opus/document/letterText/del/ul/line/@autopsic
opus/document/letterText/del/ul/line/@index
opus/document/letterText/dul/super
opus/document/letterText/edit/added/nr
opus/document/letterText/edit/added/ul
opus/document/letterText/edit/address/hand
opus/document/letterText/edit/address/hand/@ref
opus/document/letterText/edit/address/hand/ul
opus/document/letterText/edit/address/line
opus/document/letterText/edit/address/line/@autopsic
opus/document/letterText/edit/address/line/@index
opus/document/letterText/edit/address/ul/aq
opus/document/letterText/edit/align/aq/ul
opus/document/letterText/edit/align/datum/aq
opus/document/letterText/edit/align/edit
opus/document/letterText/edit/align/edit/aq
opus/document/letterText/edit/align/edit/@ref
opus/document/letterText/edit/anchor
opus/document/letterText/edit/anchor/@ref
opus/document/letterText/edit/aq/dul
opus/document/letterText/edit/aq/edit
opus/document/letterText/edit/aq/edit/@ref
opus/document/letterText/edit/aq/line/@tab
opus/document/letterText/edit/aq/ul/del
opus/document/letterText/edit/aq/ul/line
opus/document/letterText/edit/aq/ul/line/@autopsic
opus/document/letterText/edit/aq/ul/line/@index
opus/document/letterText/edit/del/aq/del
opus/document/letterText/edit/del/del/line
opus/document/letterText/edit/del/del/line/@autopsic
opus/document/letterText/edit/del/del/line/@index
opus/document/letterText/edit/del/page
opus/document/letterText/edit/del/page/@autopsic
opus/document/letterText/edit/del/page/@index
opus/document/letterText/edit/edit/aq/del
opus/document/letterText/edit/edit/del/aq
opus/document/letterText/edit/edit/edit/aq
opus/document/letterText/edit/edit/page
opus/document/letterText/edit/edit/page/@autopsic
opus/document/letterText/edit/edit/page/@index
opus/document/letterText/edit/edit/super
opus/document/letterText/edit/gr/del/nr
opus/document/letterText/edit/hand/align/aq
opus/document/letterText/edit/hand/aq/del
opus/document/letterText/edit/hand/aq/del/ul
opus/document/letterText/edit/hand/aq/nr
opus/document/letterText/edit/hand/del/aq
opus/document/letterText/edit/hand/super
opus/document/letterText/edit/hand/ul
opus/document/letterText/edit/nr/aq/del
opus/document/letterText/edit/sig/aq
opus/document/letterText/edit/sig/aq/ul
opus/document/letterText/edit/sig/line
opus/document/letterText/edit/sig/line/@autopsic
opus/document/letterText/edit/sig/line/@index
opus/document/letterText/edit/ul/del/nr
opus/document/letterText/edit/ul/edit
opus/document/letterText/edit/ul/edit/@ref
opus/document/letterText/edit/ul/nr
opus/document/letterText/edit/ul/ul
opus/document/letterText/fn/added/aq
opus/document/letterText/fn/del
opus/document/letterText/fn/hand/aq
opus/document/letterText/fn/line/@type
opus/document/letterText/fn/note/ul
opus/document/letterText/ful/aq
opus/document/letterText/gr/del
opus/document/letterText/gr/edit/del
opus/document/letterText/gr/line/@tab
opus/document/letterText/hand/address/aq/del
opus/document/letterText/hand/address/aq/del/nr
opus/document/letterText/hand/address/aq/del/nr/ul
opus/document/letterText/hand/address/aq/line
opus/document/letterText/hand/address/aq/line/@autopsic
opus/document/letterText/hand/address/aq/line/@index
opus/document/letterText/hand/address/aq/line/@tab
opus/document/letterText/hand/address/edit
opus/document/letterText/hand/address/edit/@ref
opus/document/letterText/hand/address/edit/ul
opus/document/letterText/hand/address/edit/ul/aq
opus/document/letterText/hand/align/datum/edit
opus/document/letterText/hand/align/datum/edit/@ref
opus/document/letterText/hand/align/datum/edit/super
opus/document/letterText/hand/aq/address
opus/document/letterText/hand/aq/address/line
opus/document/letterText/hand/aq/address/line/@autopsic
opus/document/letterText/hand/aq/address/line/@index
opus/document/letterText/hand/aq/address/ul
opus/document/letterText/hand/datum/align
opus/document/letterText/hand/datum/align/@pos
opus/document/letterText/hand/datum/edit
opus/document/letterText/hand/datum/edit/aq
opus/document/letterText/hand/datum/edit/@ref
opus/document/letterText/hand/del/aq
opus/document/letterText/hand/del/line
opus/document/letterText/hand/del/line/@autopsic
opus/document/letterText/hand/del/line/@index
opus/document/letterText/hand/del/line/@tab
opus/document/letterText/hand/del/nr
opus/document/letterText/hand/edit/added
opus/document/letterText/hand/edit/aq/ul
opus/document/letterText/hand/edit/del/nr
opus/document/letterText/hand/edit/line
opus/document/letterText/hand/edit/line/@autopsic
opus/document/letterText/hand/edit/line/@index
opus/document/letterText/hand/edit/nr
opus/document/letterText/hand/edit/ul/aq
opus/document/letterText/hand/gr/del
opus/document/letterText/hand/gr/line
opus/document/letterText/hand/gr/line/@autopsic
opus/document/letterText/hand/gr/line/@index
opus/document/letterText/hand/ps
opus/document/letterText/hand/ps/aq
opus/document/letterText/hand/ps/datum
opus/document/letterText/hand/ps/datum/aq
opus/document/letterText/hand/ul/aq
opus/document/letterText/hand/ul/nr
opus/document/letterText/note/aq/ul
opus/document/letterText/note/line/@tab
opus/document/letterText/note/ul
opus/document/letterText/nr/del
opus/document/letterText/ps/added
opus/document/letterText/ps/align
opus/document/letterText/ps/align/aq
opus/document/letterText/ps/align/@pos
opus/document/letterText/ps/aq/line
opus/document/letterText/ps/aq/line/@autopsic
opus/document/letterText/ps/aq/line/@index
opus/document/letterText/ps/aq/super
opus/document/letterText/ps/del/line
opus/document/letterText/ps/del/line/@autopsic
opus/document/letterText/ps/del/line/@index
opus/document/letterText/ps/edit/dul
opus/document/letterText/ps/edit/dul/aq
opus/document/letterText/ps/ps
opus/document/letterText/ps/ps/del
opus/document/letterText/ps/ul/aq
opus/document/letterText/sig/align/ul
opus/document/letterText/sig/datum
opus/document/letterText/super/del
opus/document/letterText/tab/ful
opus/document/letterText/tabs/align/aq
opus/document/letterText/tabs/align/edit
opus/document/letterText/tabs/align/edit/aq
opus/document/letterText/tabs/align/edit/@ref
opus/document/letterText/tabs/aq/ul
opus/document/letterText/tabs/edit
opus/document/letterText/tabs/edit/page
opus/document/letterText/tabs/edit/page/@autopsic
opus/document/letterText/tabs/edit/page/@index
opus/document/letterText/tabs/edit/@ref
opus/document/letterText/tabs/edit/tab/del
opus/document/letterText/tabs/edit/tab/dul
opus/document/letterText/tabs/edit/tab/edit/tul
opus/document/letterText/tabs/edit/tab/ul
opus/document/letterText/tabs/line/@type
opus/document/letterText/tabs/tab/aq/added
opus/document/letterText/tabs/tab/aq/super
opus/document/letterText/tabs/tab/aq/ul
opus/document/letterText/tabs/tab/datum/aq
opus/document/letterText/tabs/tab/edit/aq
opus/document/letterText/tabs/tab/ful/aq
opus/document/letterText/tabs/tab/ful/del
opus/document/letterText/tabs/tab/ful/del/nr
opus/document/letterText/tabs/tab/nr
opus/document/letterText/tabs/tab/nr/aq
opus/document/letterText/tabs/tab/tab
opus/document/letterText/tabs/tab/tab/@value
opus/document/letterText/tabs/tab/up/edit
opus/document/letterText/tabs/tab/up/edit/aq
opus/document/letterText/tabs/tab/up/edit/@ref
opus/document/letterText/tab/ul
opus/document/letterText/ul/aq/added
opus/document/letterText/ul/edit/added
opus/document/letterText/ul/edit/del
opus/document/letterText/ul/edit/ul
opus/document/letterText/ul/super
opus/document/letterText/up
opus/edits
opus/edits/editreason/aq/del
opus/edits/editreason/aq/nr
opus/edits/editreason/aq/ul
opus/edits/editreason/del/added
opus/edits/editreason/nr
opus/edits/editreason/zh/added/aq
opus/edits/editreason/zh/address/hand
opus/edits/editreason/zh/address/hand/@ref
opus/edits/editreason/zh/address/ul
opus/edits/editreason/zh/aq/del
opus/edits/editreason/zh/aq/dul
opus/edits/editreason/zh/aq/nr
opus/edits/editreason/zh/del/note
opus/edits/editreason/zh/dul/aq
opus/edits/editreason/zh/note
opus/edits/editreason/zh/sig/ul
opus/edits/editreason/zh/ul/added
opus/edits/editreason/zh/ul/del
opus/kommentare
opus/kommentare/kommcat/kommentar/eintrag/titel/link
opus/kommentare/kommcat/kommentar/eintrag/titel/link/@linktext
opus/kommentare/kommcat/kommentar/eintrag/titel/link/@ref
opus/kommentare/kommcat/kommentar/lemma/titel
opus/kommentare/kommcat/kommentar/lemma/wwwlink
opus/kommentare/kommcat/kommentar/lemma/wwwlink/@address
opus/kommentare/kommcat/kommentar/subsection/wwwlink
opus/kommentare/kommcat/kommentar/subsection/wwwlink/@address
opus/marginalien
opus/marginalien/marginal/eintrag
opus/traditions
opus/traditions/letterTradition/align/note
opus/traditions/letterTradition/del
opus/traditions/letterTradition/del/aq
opus/traditions/letterTradition/note/ul
opus/traditions/letterTradition/nr
opus/traditions/letterTradition/ZHText/align/aq/del
opus/traditions/letterTradition/ZHText/align/aq/ul
opus/traditions/letterTradition/ZHText/align/datum
opus/traditions/letterTradition/ZHText/align/del/aq
opus/traditions/letterTradition/ZHText/aq/line/@type
opus/traditions/letterTradition/ZHText/aq/nr
opus/traditions/letterTradition/ZHText/aq/ul/line
opus/traditions/letterTradition/ZHText/aq/ul/line/@autopsic
opus/traditions/letterTradition/ZHText/aq/ul/line/@index
opus/traditions/letterTradition/ZHText/edit/align/aq
opus/traditions/letterTradition/ZHText/edit/aq/line
opus/traditions/letterTradition/ZHText/edit/aq/line/@autopsic
opus/traditions/letterTradition/ZHText/edit/aq/line/@index
opus/traditions/letterTradition/ZHText/edit/dul
opus/traditions/letterTradition/ZHText/edit/edit/ul
opus/traditions/letterTradition/ZHText/edit/nr
opus/traditions/letterTradition/ZHText/edit/super
opus/traditions/letterTradition/ZHText/hand/align/super
opus/traditions/letterTradition/ZHText/hand/aq/line
opus/traditions/letterTradition/ZHText/hand/aq/line/@autopsic
opus/traditions/letterTradition/ZHText/hand/aq/line/@index
opus/traditions/letterTradition/ZHText/hand/aq/ul
opus/traditions/letterTradition/ZHText/hand/edit/aq
opus/traditions/letterTradition/ZHText/hand/edit/dul
opus/traditions/letterTradition/ZHText/hand/ul/aq
opus/traditions/letterTradition/ZHText/hb
opus/traditions/letterTradition/ZHText/note/align
opus/traditions/letterTradition/ZHText/note/align/@pos
opus/traditions/letterTradition/ZHText/nr/aq
opus/traditions/letterTradition/ZHText/tabs
opus/traditions/letterTradition/ZHText/tabs/tab/aq
opus/traditions/letterTradition/ZHText/tabs/tab/del
opus/traditions/letterTradition/ZHText/tabs/tab/ful
opus/traditions/letterTradition/ZHText/tabs/tab/ful/del
opus/traditions/letterTradition/ZHText/tabs/tab/ful/del/nr
opus/traditions/letterTradition/ZHText/ul/super/aq

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,9 @@
@layer components { @layer components {
.ha-search {
@apply pt-9 md:pt-12 px-9 md:px-16 bg-slate-50
}
.ha-search .ha-letterlist {
}
} }

View File

@@ -148,7 +148,7 @@
} }
.up { .up {
@apply relative -top[0.5em] @apply relative -top-[0.5em]
} }
.ha-alignright { .ha-alignright {

View File

@@ -140,10 +140,17 @@ const overlappingcollapsebox = function (selector, hoverfunction) {
let nextrect = boxes[i + 1].getBoundingClientRect(); let nextrect = boxes[i + 1].getBoundingClientRect();
let overlap = thisrect.bottom - nextrect.top; let overlap = thisrect.bottom - nextrect.top;
if ( if (
overlap >= 0 && // -1 for caching lines that perfectly close up on each other
overlap >= -1 &&
!(window.getComputedStyle(element).display === "none") !(window.getComputedStyle(element).display === "none")
) { ) {
let newlength = thisrect.height - overlap; let newlength = 0;
if (overlap >= 0)
newlength = thisrect.height - overlap;
else
newlength = thisrect.height - lineheight;
if (newlength % (lineheight * 3) <= 2)
newlength -= lineheight;
let remainder = newlength % lineheight; let remainder = newlength % lineheight;
newlength = newlength - remainder - 1; newlength = newlength - remainder - 1;