Line Numbers on <page>

This commit is contained in:
Simon Martens
2022-11-22 12:34:55 +01:00
parent 5e90e917f1
commit 3523dfb92c
16 changed files with 457 additions and 60 deletions

View File

@@ -161,7 +161,8 @@ public class LetterRules {
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.ZHLINECOUNTCLASS, reader.State.currpage + "-" + reader.State.currline));
// Fall 1: Neue Seite
if (reader.State.currline == "1") {
if (reader.State.pagebreak == true) {
reader.State.pagebreak = false;
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.ZHPAGECLASS, ""));
sb.Append("S.&nbsp;" + reader.State.currpage);
}
@@ -184,6 +185,7 @@ public class LetterRules {
} else if (reader.State.currline == "-1" && !String.IsNullOrWhiteSpace(tag["index"])) {
reader.State.Startline = tag["index"];
reader.State.currline = tag["index"];
reader.State.pagebreak = false;
}
// Marginalien, only for lines with a linenumber

View File

@@ -26,14 +26,25 @@ public class LetterState : HaWeb.HTMLParser.IState {
// What's the current line?
internal string currline;
// What's the current page?
internal string currpage;
// Does the container need a min-widt, so percentages are useful (tables)
private string? _currpage;
internal string? currpage {
get => _currpage;
set {
if (Startpage == null)
Startpage = value;
_currpage = value;
pagebreak = true;
}}
// Does the container need a min-width, so percentages are useful (tables)
internal bool minwidth;
// Did a pagebreak just occur?
internal bool pagebreak = false;
// Results
internal StringBuilder sb_lettertext;
internal List<(string, string, string)>? ParsedMarginals;
internal string Startline;
internal string? Startline;
internal string? Startpage = null;
public LetterState(ILibrary lib, IReaderService readerService, Meta meta, IEnumerable<Marginal>? marginals, IEnumerable<Hand>? hands, IEnumerable<Editreason>? edits) {
Lib = lib;
@@ -50,12 +61,11 @@ public class LetterState : HaWeb.HTMLParser.IState {
sb_lettertext = new StringBuilder();
active_skipwhitespace = true;
currline = "-1";
currpage = string.Empty;
mustwrap = (false, false);
minwidth = false;
// Initialize State
if (Meta.ZH != null) {
if (Meta.ZH != null && !String.IsNullOrWhiteSpace(Meta.ZH.Page)) {
currpage = Meta.ZH.Page;
}
}