Formatted everything; completed upload capabilities

This commit is contained in:
schnulller
2022-06-04 02:42:01 +02:00
parent 743c88a4e5
commit 37b794ea05
61 changed files with 677 additions and 558 deletions

View File

@@ -63,7 +63,7 @@ public static class CSSClasses {
// Zeilen:
public const string ZHLINECLASS = "ha-zhline";
public const string FIRSTLINECLASS ="ha-firstline";
public const string FIRSTLINECLASS = "ha-firstline";
public const string ZHBREAKCLASS = "ha-zhbreak";
public const string LINELINECLASS = "ha-hr";
public const string LINEINDENTCLASS = "ha-indent-"; // TODO: GEN

View File

@@ -1,7 +1,6 @@
namespace HaWeb;
public static class Features
{
public static class Features {
public const string AdminService = "AdminService";
public const string UploadService = "UploadService";
public const string UpdateService = "UpdateService";

View File

@@ -37,16 +37,16 @@ public static class CommentRules {
reader.OpenTags.Any() && reader.OpenTags.Last().Name == "lemma" &&
!txt.Value.Contains("Stücke zu") && !txt.Value.Contains("ZusDan")) {
var lnkstring = Regex.Replace(txt.Value, @"\s+", "");
sb.Append(HTMLHelpers.TagHelpers.CreateCustomElement("a",
sb.Append(HTMLHelpers.TagHelpers.CreateCustomElement("a",
new HaWeb.HTMLHelpers.TagHelpers.Attribute() { Name = "href", Value = "https://www.bibleserver.com/LUT/" + lnkstring},
new HaWeb.HTMLHelpers.TagHelpers.Attribute() { Name = "target", Value = "_blank"},
new HaWeb.HTMLHelpers.TagHelpers.Attribute() { Name = "rel", Value = "noopener noreferrer"}));
sb.Append("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-external-link\"><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"></path><polyline points=\"15 3 21 3 21 9\"></polyline><line x1=\"10\" y1=\"14\" x2=\"21\" y2=\"3\"></line></svg>");
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement("a"));
}
}
})};
public static readonly WhitespaceFuncList WhitespaceRules = new WhitespaceFuncList() {
( (x, _) => true, ( sb, txt, _) => sb.Append(txt.Value) )
};
}
}

View File

@@ -149,7 +149,7 @@ public static class EditRules {
sb.Append(HttpUtility.HtmlEncode(txt.Value));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
})};
public static readonly TagFuncList STagRules = new TagFuncList() {
( ( x, _) => x.Name == "line", (sb, tag, _) => sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement("br")) )
};

View File

@@ -7,8 +7,7 @@ using TextFuncList = List<(Func<HaXMLReader.EvArgs.Text, HaWeb.HTMLParser.XMLHel
using WhitespaceFuncList = List<(Func<HaXMLReader.EvArgs.Whitespace, HaWeb.HTMLParser.XMLHelper<HaWeb.Settings.ParsingState.LetterState>, bool>, Action<System.Text.StringBuilder, HaXMLReader.EvArgs.Whitespace, HaWeb.HTMLParser.XMLHelper<HaWeb.Settings.ParsingState.LetterState>>)>;
// TODO: stringbuilder als Rückgabeparameter des XMHelpers ist eigentlich auch Part vom State
public class LetterRules
{
public class LetterRules {
private static readonly string DEFAULTELEMENT = HaWeb.Settings.HTML.DEFAULTELEMENT;
private static readonly string LEMMACLASS = HaWeb.Settings.CSSClasses.LEMMACLASS;
@@ -101,7 +100,7 @@ public class LetterRules
( ( x, _) => x.Name == "sub", (sb, tag, _) => sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, SUBCLASS)) ),
( ( x, _) => x.Name == "tul", (sb, tag, _) => sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, TULCLASS)) ),
( ( x, _) => x.Name == "header", (sb, tag, reader) => {
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, HEADERCLASS));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, HEADERCLASS));
reader.State.mustwrap = (true, true);
}),
( ( x, _) => x.Name == "lemma", (sb, tag, _) => sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, LEMMACLASS)) ),
@@ -214,7 +213,7 @@ public class LetterRules
reader.State.mustwrap = (false, false);
// Linecount
if(!String.IsNullOrWhiteSpace(tag["index"])) {
if(!String.IsNullOrWhiteSpace(tag["index"])) {
reader.State.currline = tag["index"];
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, ZHLINECOUNTCLASS, reader.State.currpage + "-" + reader.State.currline));
@@ -274,7 +273,7 @@ public class LetterRules
}
// Line type=line
if(tag["type"] == "line") {
if(tag["type"] == "line") {
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, LINELINECLASS));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
reader.State.mustwrap = (false, true);
@@ -288,7 +287,7 @@ public class LetterRules
}
}
)};
public static readonly WhitespaceFuncList WhitespaceRules = new WhitespaceFuncList() {
( ( _, _) => true, ( sb, txt, reader) => {

View File

@@ -16,7 +16,7 @@ public static class LinkRules {
( (x, _) => x.Name == "titel", (strbd, _, _) => strbd.Append(HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, TITLECLASS)) ),
( (x, _) => x.Name == "title", (strbd, _, _) => strbd.Append(HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, TITLECLASS)) )
};
public static readonly TagFuncList CTagRules = new TagFuncList() {
( (x, _) => x.Name == "lemma", (strbd, _, _) => strbd.Append(HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT)) ),
( (x, _) => x.Name == "titel", (strbd, _, _) => strbd.Append(HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT)) ),

View File

@@ -6,8 +6,7 @@ using TagFuncList = List<(Func<HaXMLReader.EvArgs.Tag, HaWeb.HTMLParser.XMLHelpe
using TextFuncList = List<(Func<HaXMLReader.EvArgs.Text, HaWeb.HTMLParser.XMLHelper<HaWeb.Settings.ParsingState.TraditionState>, bool>, Action<System.Text.StringBuilder, HaXMLReader.EvArgs.Text, HaWeb.HTMLParser.XMLHelper<HaWeb.Settings.ParsingState.TraditionState>>)>;
using WhitespaceFuncList = List<(Func<HaXMLReader.EvArgs.Whitespace, HaWeb.HTMLParser.XMLHelper<HaWeb.Settings.ParsingState.TraditionState>, bool>, Action<System.Text.StringBuilder, HaXMLReader.EvArgs.Whitespace, HaWeb.HTMLParser.XMLHelper<HaWeb.Settings.ParsingState.TraditionState>>)>;
public static class TraditionRules
{
public static class TraditionRules {
private static readonly string DEFAULTELEMENT = HaWeb.Settings.HTML.DEFAULTELEMENT;
private static readonly string LEMMACLASS = HaWeb.Settings.CSSClasses.LEMMACLASS;

View File

@@ -10,7 +10,7 @@ using System.Linq;
using System.Xml.Linq;
public class LetterState : HaWeb.HTMLParser.IState {
// Input
// Input
internal ILibrary Lib;
internal IReaderService ReaderService;
internal Meta Meta;

View File

@@ -34,8 +34,7 @@ public class TraditionState : HaWeb.HTMLParser.IState {
internal IReader rd_tradition;
public TraditionState(ILibrary lib, IReader reader, IReaderService readerService, IEnumerable<Marginal>? marginals, IEnumerable<Hand>? hands, IEnumerable<Editreason>? edits)
{
public TraditionState(ILibrary lib, IReader reader, IReaderService readerService, IEnumerable<Marginal>? marginals, IEnumerable<Hand>? hands, IEnumerable<Editreason>? edits) {
Lib = lib;
rd_tradition = reader;
Marginals = marginals;
@@ -47,7 +46,7 @@ public class TraditionState : HaWeb.HTMLParser.IState {
public void SetupState() {
sb_tradition = new StringBuilder();
active_trad = false;
active_skipwhitespace = true;
currline = "-1";

View File

@@ -12,7 +12,7 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
else return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("id");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;
@@ -25,7 +25,7 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
public (string?, string?) GenerateIdentificationString(XElement element) {
var kat = element.Attribute("value");
if (kat != null && !String.IsNullOrWhiteSpace(kat.Value))
if (kat != null && !String.IsNullOrWhiteSpace(kat.Value))
return (null, kat.Value);
return (null, null);
}

View File

@@ -5,14 +5,14 @@ using HaWeb.XMLParser;
public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
public string Type { get; } = "Metadaten";
public string Prefix { get; } = "metadaten";
public string[] XPathContainer { get; } = {".//data/descriptions", ".//descriptions" };
public string[] XPathContainer { get; } = { ".//data/descriptions", ".//descriptions" };
public Predicate<XElement> IsCollectedObject { get; } = (elem) => {
if (elem.Name == "letterDesc") return true;
return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("ref");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;

View File

@@ -12,7 +12,7 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
else return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("index");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;

View File

@@ -12,7 +12,7 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
else return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("index");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;

View File

@@ -12,7 +12,7 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
else return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("index");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;

View File

@@ -13,7 +13,7 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
return elem.Name.ToString();
};

View File

@@ -12,7 +12,7 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
else return false;
};
public Func<XElement, string?> GetKey { get; } = (elem) => {
public Func<XElement, string?> GetKey { get; } = (elem) => {
var index = elem.Attribute("ref");
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
return index.Value;