From faa46ac307d3af366858726d6e4357eb7d0e67af Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Tue, 22 Oct 2019 19:26:05 +0200
Subject: started working on separating rules

---
 ekdosis.dtx | 94 ++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 68 insertions(+), 26 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 95db667..5ee1169 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -487,25 +487,25 @@ idno={}, msName={}, origDate={}][3]{%
   {\luadirect{ekdosis.appin(\luastringO{#2})}}
   {\luadirect{ekdosis.appin(\luastringO{#2}, \luastringO{#1})}}%
 }
- \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
-% \def\blfootnote{\gdef\@thefnmark{}\@blfootnotetext}
-% \long\def\@blfootnotetext#1{\insert\footins{%
-%     \reset@font\footnotesize
-%     \interlinepenalty\interfootnotelinepenalty
-%     \splittopskip\footnotesep
-%     \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
-%     \hsize\columnwidth \@parboxrestore
-%     \protected@edef\@currentlabel{%
-%        \csname p@footnote\endcsname\@thefnmark
-%     }%
-%     \color@begingroup
-%       \@makeblfntext{%
-%         \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
-%     \color@endgroup}}%
-% \newcommand\@makeblfntext[1]{%
-%     \parindent 1em%
-%     \noindent
-%     \hb@xt@0em{\hss\@makefnmark}#1}
+% \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
+\def\blfootnote{\gdef\@thefnmark{}\@blfootnotetext}
+\long\def\@blfootnotetext#1{\insert\footins{%
+    \reset@font\footnotesize
+    \interlinepenalty\interfootnotelinepenalty
+    \splittopskip\footnotesep
+    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+    \hsize\columnwidth \@parboxrestore
+    \protected@edef\@currentlabel{%
+       \csname p@footnote\endcsname\@thefnmark
+    }%
+    \color@begingroup
+      \@makeblfntext{%
+        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+    \color@endgroup}}%
+\newcommand\@makeblfntext[1]{%
+    \parindent 1em%
+    \noindent
+    \hb@xt@0em{\hss\@makefnmark}#1}
 \newif\ifrtl@app
 \NewDocumentCommand{\SetRTLapp}{}{\rtl@apptrue}
 \NewDocumentCommand{\SetLTRapp}{}{\rtl@appfalse}
@@ -518,8 +518,33 @@ idno={}, msName={}, origDate={}][3]{%
 \def\ekd@default@rule{\rule{2truein}{0.5pt}}
  % \def\ekd@default@rule{\vskip-\baselineskip\mbox{}\newline%
  %    \rule{2truein}{0.5pt}}
-\def\footnoterule{}
-\def\pcol@footnoterule{}
+% \def\footnoterule{\vskip-\baselineskip}
+% \def\pcol@footnoterule{}
+\newif\iffootnoterule
+\let\dflt@footnoterule\footnoterule
+\let\dflt@pcol@footnoterule\pcol@footnoterule
+\renewcommand\footnoterule{%
+  \iffootnoterule
+  \dflt@footnoterule%
+  \else
+  % \noindent\ekd@default@rule%
+  % \advance\skip\footins 4\p@\@plus2\p@\relax%
+  \fi
+}
+\renewcommand\pcol@footnoterule{%
+  \iffootnoterule
+  \dflt@pcol@footnoterule%
+  \else
+  % \noindent\ekd@default@rule%
+  % \advance\skip\footins 4\p@\@plus2\p@\relax%
+  \fi
+}
+\newcommand*{\NLS}{%
+  \par%
+  \nobreak%
+  \vspace{-\parskip}%
+  \noindent%
+  \ignorespaces }
 \NewDocumentCommand{\SetDefaultRule}{m}{%
   \def\@tempa{#1}
   \ifx\@tempa\empty\def\ekd@default@rule{\mbox{}}%
@@ -1828,7 +1853,8 @@ function ekdosis.appout()
       local output = {}
       if next(apparatuses) == nil then
 	 -- table.insert(output, "BEGIN")
-	 table.insert(output, "\\par\\noindent\\csname ekd@default@rule\\endcsname\\newline{}")
+	 table.insert(output, "\\noindent\\csname ekd@default@rule\\endcsname\\NLS\\noindent ")
+--	 table.insert(output, "\\noindent ")
 	 for i in string.gmatch(t,
 				"<"..cur_abs_pg.."%-0>.-</"..cur_abs_pg.."%-0>")
 	 do
@@ -1836,7 +1862,6 @@ function ekdosis.appout()
 	 end
 	 -- table.insert(output, "END")
       else
-	 table.insert(output, "\\vskip -\\baselineskip")
 	 local n = 1
 	 while apparatuses[n]
 	 do
@@ -1853,12 +1878,29 @@ function ekdosis.appout()
 	       end
 	       if apparatuses[n].rule == "none"
 	       then
-		  table.insert(output, "\\par\\noindent\\mbox{}\\newline{}")
+		  if n > 1
+		  then
+		     table.insert(output, "\\NLS\\noindent ")
+		  else
+		     table.insert(output, "\\noindent ")
+		  end
 	       elseif apparatuses[n].rule ~= ""
 	       then
-		  table.insert(output, "\\par\\noindent\\mbox{}" .. apparatuses[n].rule .. "\\mbox{}\\newline{}")
+		  if n > 1
+		  then
+		     table.insert(output, "\\NLS{}" .. apparatuses[n].rule .. "\\NLS\\noindent ")
+		  else
+--		     table.insert(output, "\\noindent ")
+		     table.insert(output, apparatuses[n].rule .. "\\NLS\\noindent ")
+		  end
 	       else
-		  table.insert(output, "\\par\\noindent\\csname ekd@default@rule\\endcsname\\newline{}")
+		  if n > 1
+		  then
+		     table.insert(output, "\\NLS\\csname ekd@default@rule\\endcsname\\NLS\\noindent ")
+		  else
+--		     table.insert(output, "\\noindent ")
+		     table.insert(output, "\\csname ekd@default@rule\\endcsname\\NLS\\noindent ")
+		  end
 	       end
 	       if apparatuses[n].bhook ~= ""
 	       then
-- 
cgit v1.2.3

