aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-03-24 12:38:41 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2022-04-03 18:13:50 -0400
commite2424c06d3bfa552f35fb288429c3ef4e5357cc7 (patch)
treec1d8aefd2ce9acc7760a4eb9dbef1eea3afa3c66
parentlatex, pagebreaks, make headers, consider (diff)
latex output (try tidy); linebreaks more generally
-rw-r--r--org/default_misc.org4
-rw-r--r--org/default_regex.org8
-rw-r--r--org/meta_conf_make_meta.org2
-rw-r--r--org/metaverse.org16
-rw-r--r--org/out_latex.org199
-rw-r--r--org/out_odt.org8
-rw-r--r--org/out_sqlite.org6
-rw-r--r--org/out_xmls.org11
-rw-r--r--org/spine.org2
-rw-r--r--src/doc_reform/io_out/defaults.d4
-rw-r--r--src/doc_reform/io_out/epub3.d5
-rw-r--r--src/doc_reform/io_out/latex.d176
-rw-r--r--src/doc_reform/io_out/odt.d8
-rw-r--r--src/doc_reform/io_out/rgx.d8
-rw-r--r--src/doc_reform/io_out/sqlite.d6
-rw-r--r--src/doc_reform/io_out/xmls.d9
-rw-r--r--src/doc_reform/meta/conf_make_meta_yaml.d2
-rw-r--r--src/doc_reform/meta/defaults.d4
-rw-r--r--src/doc_reform/meta/metadoc.d2
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d16
-rw-r--r--src/doc_reform/meta/rgx.d8
21 files changed, 323 insertions, 181 deletions
diff --git a/org/default_misc.org b/org/default_misc.org
index 429e13a..60419d8 100644
--- a/org/default_misc.org
+++ b/org/default_misc.org
@@ -237,8 +237,8 @@ template InternalMarkup() {
string mark_internal_site_lnk = "¤";
string nbsp = "░";
string br_line = "┘";
- string br_newline_inline = "┙";
- string br_paragraph = "┚";
+ string br_line_inline = "┙";
+ string br_line_spaced = "┚";
string br_obj = "break_obj";
string br_page_line = "┼";
string br_page = "┿";
diff --git a/org/default_regex.org b/org/default_regex.org
index 86f6d2d..8d7a26f 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -506,6 +506,7 @@ static space = ctRegex!(`[ ]`, "mg");
static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block
static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
static nbsp_char = ctRegex!(`░`, "mg");
+static nbsp_chars = ctRegex!(`[░]+`, "mg");
#+END_SRC
** filename (& path) (including insert file) :insert:file:path:filename:
@@ -535,9 +536,12 @@ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a
#+BEGIN_SRC d
/+ line breaks +/
static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
-static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg");
+static br_linebreaks_newlines = ctRegex!(`[\n┘┙]`, "mg");
+static br_linebreaks = ctRegex!(`[┘┙]`, "mg");
static br_line = ctRegex!(`┘`, "mg");
-static br_newline_inline = ctRegex!(`┙`, "mg");
+static br_line_inline = ctRegex!(`┙`, "mg");
+static br_line_spaced = ctRegex!(`┚`, "mg");
+static brln = ctRegex!(`(?:\\\\)+`, "mg");
#+END_SRC
*** inline (internal program) markup footnotes endnotes :inline:footnote:
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 983cc75..389bc0d 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -22,7 +22,7 @@ string check_input_markup()(
string _txt,
) {
_txt = _txt
- .replaceAll(regex(r"\\"), mkup.br_newline_inline)
+ .replaceAll(regex(r"\\"), mkup.br_line_inline)
.strip;
return _txt;
}
diff --git a/org/metaverse.org b/org/metaverse.org
index a7a1c9e..1ae0be4 100644
--- a/org/metaverse.org
+++ b/org/metaverse.org
@@ -1256,7 +1256,7 @@ if (pith["block_is"] == eN.blk_is.quote) {
line = line
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta)
- .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
+ .replaceAll(rgx.para_delimiter, mkup.br_line_spaced ~ "$1");
an_object = line.flow_txt_block_group(an_object, pith);
continue;
#+END_SRC
@@ -5170,11 +5170,11 @@ if (pith["block_is"] == eN.blk_is.quote) {
an_object[an_object_key] = an_object[an_object_key]
.replaceFirst(rgx.variable_doc_title_author_date,
(conf_make_meta.meta.title_full
- ~ mkup.br_newline_inline
+ ~ mkup.br_line_inline
~ conf_make_meta.meta.creator_author
~ " (" ~ (conf_make_meta.meta.date_published.replaceFirst(regex(r"(?:-00)+"),"")) ~ ")"))
.replaceFirst(rgx.variable_doc_title,
- (conf_make_meta.meta.title_full ~ mkup.br_newline_inline))
+ (conf_make_meta.meta.title_full ~ mkup.br_line_inline))
.replaceFirst(rgx.variable_doc_author,
conf_make_meta.meta.creator_author)
.replaceFirst(rgx.variable_doc_date,
@@ -5185,10 +5185,10 @@ if (pith["block_is"] == eN.blk_is.quote) {
an_object[an_object_key] = an_object[an_object_key]
.replaceFirst(rgx.variable_doc_title_author_date,
(conf_make_meta.meta.title_full
- ~ mkup.br_newline_inline
+ ~ mkup.br_line_inline
~ conf_make_meta.meta.creator_author))
.replaceFirst(rgx.variable_doc_title,
- (conf_make_meta.meta.title_full ~ mkup.br_newline_inline))
+ (conf_make_meta.meta.title_full ~ mkup.br_line_inline))
.replaceFirst(rgx.variable_doc_author,
conf_make_meta.meta.creator_author);
} else if (an_object[an_object_key].match(rgx.variable_doc_title)) {
@@ -5893,7 +5893,7 @@ invariant() {
obj_txt["munge"] = obj_txt_in
.replaceFirst(rgx.headings, "")
.replaceFirst(rgx.object_number_off_all, "")
- .replaceFirst(rgx.markup_inline_linebreak, mkup.br_newline_inline)
+ .replaceFirst(rgx.markup_inline_linebreak, mkup.br_line_inline)
.strip;
TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers);
debug(munge) {
@@ -5925,7 +5925,7 @@ invariant() {
obj_txt["munge"] = (obj_txt_in)
.replaceFirst(rgx.para_attribs, "")
.replaceFirst(rgx.object_number_off_all, "")
- .replaceFirst(rgx.markup_inline_linebreak, mkup.br_newline_inline);
+ .replaceFirst(rgx.markup_inline_linebreak, mkup.br_line_inline);
TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]);
debug(munge) {
writeln(__LINE__);
@@ -5976,7 +5976,7 @@ invariant() {
#+NAME: meta_emitters_obj_inline_markup_munge_function_group
#+BEGIN_SRC d
@safe auto munge_group(string obj_txt_in) {
- TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n"));
+ TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join("\n" ~ mkup.br_line_spaced ~ "\n")); // br_line br_line_inline br_line_spaced
return t;
}
invariant() {
diff --git a/org/out_latex.org b/org/out_latex.org
index af17d60..bac3158 100644
--- a/org/out_latex.org
+++ b/org/out_latex.org
@@ -39,6 +39,7 @@ template outputLaTeX() {
<<output_latex_shared_fontface>>
<<output_latex_shared_leading_hardspaces>>
<<output_latex_shared_character_nbsp_to_hardspace>>
+ <<output_latex_shared_character_spaces_to_hardspace>>
<<output_latex_shared_character_nbsp_to_space>>
<<output_latex_shared_links_and_images>>
<<output_latex_shared_footnotes>>
@@ -547,7 +548,7 @@ _txt = _txt
#+END_SRC
**** spaces
-***** leading hardspace
+***** leading hardspace UNUSED
#+NAME: output_latex_shared_leading_hardspaces
#+BEGIN_SRC d
@@ -556,7 +557,7 @@ _txt = _txt
) {
string hardspaces(string _spaces) {
_spaces = _spaces
- .replaceAll(rgx.space, "\\hardspace ");
+ .replaceAll(rgx.space, "{\\s}");
return _spaces;
}
_txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start);
@@ -564,13 +565,49 @@ _txt = _txt
}
#+END_SRC
+***** nbsp character UNUSED
+
+#+NAME: output_latex_shared_character_nbsp_to_hardspace_
+#+BEGIN_SRC d
+@safe string nbsp_char_replace()(string _txt) {
+ if (_txt.match(rgx.nbsp_char)) {
+ _txt = _txt.replaceAll(rgx.nbsp_char, "{\\s}");
+ }
+ return _txt;
+}
+#+END_SRC
+
***** nbsp character
#+NAME: output_latex_shared_character_nbsp_to_hardspace
#+BEGIN_SRC d
@safe string nbsp_char()(string _txt) {
if (_txt.match(rgx.nbsp_char)) {
- _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace ");
+ foreach (m; _txt.matchAll(rgx.nbsp_chars)) {
+ int spaces_ = 0;
+ foreach (n; m[0].matchAll(rgx.nbsp_char)) {
+ spaces_ ++;
+ }
+ _txt = _txt.replaceFirst(rgx.nbsp_chars, "\\spaces{" ~ spaces_.to!string ~ "}");
+ }
+ }
+ return _txt;
+}
+#+END_SRC
+
+***** keep spaces
+
+#+NAME: output_latex_shared_character_spaces_to_hardspace
+#+BEGIN_SRC d
+@safe string spaces_to_nbsp()(string _txt) {
+ if (_txt.match(rgx.spaces_keep)) {
+ foreach (m; _txt.matchAll(rgx.spaces_keep)) {
+ int spaces_ = 0;
+ foreach (n; m[0].matchAll(rgx.space)) {
+ spaces_ ++;
+ }
+ _txt = _txt.replaceFirst(rgx.spaces_keep, "\\spaces{" ~ spaces_.to!string ~ "}");
+ }
}
return _txt;
}
@@ -631,9 +668,9 @@ _txt = _txt
((m[1] == m[2]) && (m[2].match(rgx.uri))) // url link (regular link with url)
? format(q"┃\linkurl{%s}{%s}┃", _check_link(m[1]), (_check_link(m[1])).sp_char_esc_txt)
: ((m[2].match(rgx.uri)) && (m[1].match(rgx.inline_image_info))) // linked image
- ? format(q"┃%s\href{%s}%s{%s}┃", "\\br\n", _check_link(m[2]), "\n", _if_images(m[1])) // markup for images
+ ? format(q"┃%s\href{%s}%s{%s}┃", "\\br ", _check_link(m[2]), "\n", _if_images(m[1])) // markup for images
: (m[2].match(rgx.uri)) // not linked image
- ? format(q"┃%s\linktext{%s}{%s}┃", "\\br\n", _check_link(m[2]), m[1]) // regular link with text
+ ? format(q"┃%s\linktext{%s}{%s}┃", "\\br ", _check_link(m[2]), m[1]) // regular link with text
: format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1])) // internal links, like book index
)(_txt, rgx.inline_link);
}
@@ -653,7 +690,7 @@ _txt = _txt
if (_txt.match(rgx.inline_notes_al_gen)) {
string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%%
\label{note_%s}%s}┃";
- _txt = _txt.replaceAll(rgx.inline_notes_al_regular_number_note,
+ _txt = _txt.split(rgx.br_linebreaks).join("\\br ").replaceAll(rgx.inline_notes_al_regular_number_note,
format(_tex_note,
"$1", "$1", "$1",
"$2".strip
@@ -713,7 +750,7 @@ _txt = _txt
string _tex_para;
_tex_para = q"┃%s┃";
_txt = format(_tex_para,
- _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\br\n"
+ _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n"
);
}
return _txt;
@@ -735,7 +772,7 @@ _txt = _txt
if (obj.attrib.bullet) {
int _bullet_space = 5;
_indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin + _bullet_space).to!string;
- _txt = format(q"┃\begin{Bullet}{%smm}$\txtbullet$\hspace{\enspace}%s\end{Bullet}┃",
+ _txt = format(q"┃\begin{Bullet}{%smm}%s\end{Bullet}┃",
_indent,
_txt.footnotes
).strip;
@@ -758,7 +795,7 @@ _txt = _txt
_tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃";
_txt = format(_tex_para,
_indent, _hang,
- _txt.footnotes
+ _txt.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n")
).strip;
}
return _txt;
@@ -973,7 +1010,6 @@ _txt = _txt
\pagenumbering{arabic}
\setcounter{page}{1}
\markboth{ }{ }
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
\part*{\ocn{1}%s \newline %s}
\clearpage
@@ -1053,14 +1089,14 @@ string group(O,M)(
) {
if (obj.metainfo.is_a == "group") {
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
-\begin{footnotesize}
+ _tex_para = q"┃\ocn{%s}\objGroupOpen
%s
-\end{footnotesize}
+\objGroupClose
┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
- _txt.footnotes.strip
+ _txt.footnotes.split(rgx.br_line_spaced).join("\\brl{1}").strip // provides more control (more noise, not as tidy)
+ // _txt.footnotes.split(rgx.br_line_spaced).join("") // this works using a line-space, looks tidy, keep ref.
).strip;
}
return _txt;
@@ -1079,26 +1115,21 @@ string block(O,M)(
M doc_matters,
) {
if (obj.metainfo.is_a == "block") {
- // _txt = _txt.nbsp_char;
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
-\begin{footnotesize}
+ _tex_para = q"┃\ocn{%s}\objBlockOpen
%s
-\end{footnotesize}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-┃"; // \hardspace
- /+ try both: +/
- _txt = _txt.split(rgx.br_newlines_linebreaks).join("\n\n"); // _txt = _txt.split(rgx.br_newlines_linebreaks).join(" \\\n");
- _txt = format(_tex_para,
+\objBlockClose
+┃";
+ _txt = format(_tex_para,
obj.metainfo.object_number,
- _txt.nbsp_char.footnotes.strip
+ _txt.nbsp_char.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip
).strip;
}
return _txt;
}
#+END_SRC
-**** verse
+**** (poem) verse
- (hardspace honored) \hardspace
@@ -1111,18 +1142,13 @@ string verse(O,M)(
) {
if (obj.metainfo.is_a == "verse") {
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
-\begin{footnotesize}
-
+ _tex_para = q"┃\ocn{%s}\objPoemVerseOpen
%s
-
-\end{footnotesize}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-\linebreak
-┃"; // \hardspace
+\objPoemVerseClose
+┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
- _txt.nbsp_char.footnotes.split("\n").join("\n\n").strip
+ _txt.spaces_to_nbsp.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip
).strip;
}
return _txt;
@@ -1142,12 +1168,9 @@ string codeblock(O,M)(
) {
if (obj.metainfo.is_a == "code") {
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock}
-\begin{lstlisting}
+ _tex_para = q"┃\ocn{%s}\begin{objCodeBlock}\begin{lstlisting}
%s
-\end{lstlisting}
-\end{Codeblock}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+\end{lstlisting}\end{objCodeBlock}
┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
@@ -1239,14 +1262,9 @@ string table(O,M)(
);
}
string _tex_para;
- _tex_para = q"┃\ocn{%s}
-\setlength{\LTleft}{0pt}
-\setlength{\LTright}{\fill}
-\begin{tiny}
-\begin{longtable}{%s}
+ _tex_para = q"┃\ocn{%s}\objTableOpen{%s}
%s
-\end{longtable}
-\end{tiny}
+\objTableClose
┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
@@ -1700,7 +1718,7 @@ string _latex_head = format(q"┃%%%% spine LaTeX output
\usepackage[tc]{titlepic}
\usepackage{graphicx}
\makeatletter
-\parindent0pt
+\parindent{0pt}
\usepackage{amssymb}
\usepackage{listings}
\usepackage{color}
@@ -1748,6 +1766,7 @@ string _latex_head = format(q"┃%%%% spine LaTeX output
\setlength\parsep{0pt plus 1pt}%%
}
\item[]
+$\txtbullet$\hspace{\enspace}
}
{\end{list}}
#+END_SRC
@@ -1781,16 +1800,52 @@ string _latex_head = format(q"┃%%%% spine LaTeX output
\chardef\tilde="7E
\def\asterisk{{\rm \char42} }
\definecolor{Light}{gray}{.92}
-\newcommand{\Codeblock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
\newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1}
+\newcommand{\br}{\hfill\break}
+\newcommand{\brl}[1]{%%
+ \ifx&#1&%%
+ \hfill\break
+ \else
+ \vspace{#1ex}
+ \fi
+}
+\newcommand{\brln}{\hspace*{\fill}\linebreak}
+\newcomand{\objBlockOpen}{
+ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\raggedright
+ \begin{footnotesize}
+}
+\newcomand{\objBlockClose}{%%
+ \end{footnotesize}
+ \setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+}
+\newcomand{\objGroupOpen}{%%
+ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
+ \begin{footnotesize}
+}
+\newcomand{\objGroupClose}{%%
+ \end{footnotesize}
+}
+\newcommand{\objPoemVerseOpen}{%%
+ \setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
+ \begin{footnotesize}
+
+}
+\newcommand{\objPoemVerseClose}{%%
+
+ \end{footnotesize}
+ \setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+ \linebreak
+}
\newcommand{\parasep}{\smallskip \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \br}
-\newcommand{\br}{\hspace*{\fill}}
-\newcommand{\brln}{\smallskip}
-\newcommand{\hardspace}{{~}}
+\newcommand{\spaces}[1]{{\hspace*{#1ex}}}
+\newcommand{\s}{\hspace*{1ex}}
+\newcommand{\hardspace}{\hspace*{1ex}}
+\newcommand{\-}{\hspace*{1ex}}
+\newcommand{\..}{\hspace*{1ex}} %% dots trailing
\newcommand{\caret}{{\^{~}}}
\newcommand{\pipe}{{\textbar}}
-\newcommand{\curlyopen}{{}
-\newcommand{\curlyclose}{}}
+\newcommand{\curlyOpen}{{}
+\newcommand{\curlyClose}{}}
\newcommand{\lt}{{UseTextSymbol{OML}{<}}}
\newcommand{\gt}{{UseTextSymbol{OML}{>}}}
\newcommand{\slash}{{/}}
@@ -1802,18 +1857,27 @@ string _latex_head = format(q"┃%%%% spine LaTeX output
{\scriptsize\ttfamily\ulcorner\textup{{#2}}\lrcorner}}}
\newcommand{\link}[2]{{\begin{scriptsize}\color{black}\urlstyle{tt}\href{#1}
{\ulcorner{#2}\lrcorner}\end{scriptsize}}}
+\newcommand{\objCodeBlock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
+\newcommand{\objCodeOpen}{\normaltext\raggedright\small\ttfamily\texbackslash
+\begin{lstlisting}
+}
+\newcommand{\objCodeClose}{
+\end{lstlisting}
+}
\newcommand{\ocn}[1]{%%
+ \setlength{\parindent}{0em}
\ifx&#1&%%
%% #1 is empty
- \begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\end{tiny}}}
+ \hspace{-0.5ex}{\marginpar{\begin{tiny}\end{tiny}}}
\else
%% #1 is nonempty
- \begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}}
+ \hspace{-0.5ex}{\marginpar{\begin{tiny}\hspace{0em}\hypertarget{#1}{#1}\end{tiny}}}
\fi
}
\newcommand{\ocnhold}[1]{
\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}}
}
+\newcommand{\objCodeBlockHold}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
@@ -1821,9 +1885,8 @@ string _latex_head = format(q"┃%%%% spine LaTeX output
tabsize=4,
rulecolor=,
language=,
- basicstyle=\scriptsize,
+ basicstyle={\ttfamily\scriptsize},
upquote=true,
- aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=true,
@@ -1838,6 +1901,16 @@ string _latex_head = format(q"┃%%%% spine LaTeX output
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\color[rgb]{0.627,0.126,0.941},
}
+\newcommand{\objTableOpen}[1]{
+\setlength{\LTleft}{0pt}
+\setlength{\LTright}{\fill}
+\begin{tiny}
+\begin{longtable}{#1}
+}
+\newcommand{\objTableClose}{
+\end{longtable}
+\end{tiny}
+}
#+END_SRC
%%\chardef\asterisk="2A
@@ -1956,23 +2029,19 @@ case "body": assert(part == "body" || "head"); // surprise
switch (obj.metainfo.is_a) {
case "quote":
goto default; // TODO
- case "group":
- /+ (hardspaces not honored) [remove any hardspace marker] +/
+ case "group": /+ (hardspaces not honored) [remove any hardspace marker] +/
_txt = _txt.group(obj, doc_matters)
.links_and_images(obj, doc_matters);
goto default;
- case "block":
- /+ (hardspace honored) \hardspace +/
+ case "block": /+ (hardspace honored) \hardspace +/
_txt = _txt.block(obj, doc_matters)
.links_and_images(obj, doc_matters);
goto default;
- case "verse":
- /+ (hardspace honored) \hardspace +/
+ case "verse": /+ (hardspace honored) \hardspace +/
_txt = _txt.verse(obj, doc_matters)
.links_and_images(obj, doc_matters);
goto default;
- case "code":
- /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
+ case "code": /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
_txt = _txt.codeblock(obj, doc_matters);
goto default;
case "table":
diff --git a/org/out_odt.org b/org/out_odt.org
index a7f490a..3b23e23 100644
--- a/org/out_odt.org
+++ b/org/out_odt.org
@@ -699,7 +699,7 @@ string _font_face(string _txt){
- only double newlines (paragraph delimiter), (not line breaks, single new lines)
- no hard space indentation
+/
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
_o_txt_odt = _block_type_delimiters(_block_lines, obj);
return _o_txt_odt;
}
@@ -729,7 +729,7 @@ string _font_face(string _txt){
assert(obj.metainfo.is_of_type == "block");
assert(obj.metainfo.is_a == "block");
string _o_txt_odt = markup(obj);
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
_o_txt_odt = _block_type_delimiters(_block_lines, obj);
return _o_txt_odt;
}
@@ -752,7 +752,7 @@ string _font_face(string _txt){
assert(obj.metainfo.is_of_type == "block");
assert(obj.metainfo.is_a == "verse");
string _o_txt_odt = markup(obj);
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
_o_txt_odt = _block_type_delimiters(_block_lines, obj);
return _o_txt_odt;
}
@@ -778,7 +778,7 @@ string _font_face(string _txt){
- "^[ ]" &#160;
- count number only at beginning of line and replace each
+/
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
string _block = "";
foreach (i, _line; _block_lines) {
if (i == 1) {
diff --git a/org/out_sqlite.org b/org/out_sqlite.org
index cfe7892..a628cc6 100644
--- a/org/out_sqlite.org
+++ b/org/out_sqlite.org
@@ -551,8 +551,9 @@ string munge_html(M,O)(
.replaceAll(rgx.xhtml_less_than, "&#60;")
.replaceAll(rgx.xhtml_greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br /><br />")
.replaceAll(rgx.xhtml_line_break, "<br />");
return _txt;
}
@@ -593,8 +594,9 @@ string html_special_characters(string _txt){
.replaceAll(rgx.xhtml_less_than, "&#60;")
.replaceAll(rgx.xhtml_greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br /><br />")
.replaceAll(rgx.xhtml_line_break, "<br />");
return _txt;
}
diff --git a/org/out_xmls.org b/org/out_xmls.org
index c082a76..54a2174 100644
--- a/org/out_xmls.org
+++ b/org/out_xmls.org
@@ -165,7 +165,8 @@ import
.replaceAll(rgx.xhtml_less_than, "&lt;") // "&#60;"
.replaceAll(rgx.xhtml_greater_than, "&gt;") // "&#62;"
.replaceAll(rgx.br_line, "<br />")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
@@ -179,6 +180,8 @@ import
_txt = _txt
.replaceAll(regex(r"(?:-00)+"), "")
.replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
@@ -338,7 +341,7 @@ import
.replaceAll(
rgx.br_line, "")
.replaceAll(
- rgx.br_newline_inline, "");
+ rgx.br_line_inline, "");
} else {
_locations = "<p class=\"tiny_left\"><a href=\"https://www.doc-reform.org\">spine</a></p>\n<p class=\"tiny_left\"><a href=\"https://git.sisudoc.org/software/spine/\">sources / git</a></p>\n<p class=\"tiny_left\"><a href=\"https://www.sisudoc.org\">www.sisudoc.org</a></p>";
}
@@ -1558,7 +1561,7 @@ import
string codelines(string _txt) {
string _codelines;
if (obj.code_block.linenumbers) {
- string[] _block_lines = (_txt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_txt).split(rgx.br_linebreaks_newlines);
_codelines = " <pre class=\"codeline\">\n";
foreach (k, _line; _block_lines) {
if (k == 1) {
@@ -2599,7 +2602,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
</li>┃",
obj.text
.replaceAll(rgx.inline_notes_al_gen, "")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
.strip,
);
toc ~= "\n";
diff --git a/org/spine.org b/org/spine.org
index 59e178c..ea133cc 100644
--- a/org/spine.org
+++ b/org/spine.org
@@ -1647,7 +1647,7 @@ struct DocumentMatters {
return "https://sisudoc.org";
}
@safe string url_git() {
- return "https://git.sisudoc.org/software/sisu";
+ return "https://git.sisudoc.org/projects/";
}
@safe auto compiler() {
return program_info.compiler;
diff --git a/src/doc_reform/io_out/defaults.d b/src/doc_reform/io_out/defaults.d
index 6839c92..94a85dd 100644
--- a/src/doc_reform/io_out/defaults.d
+++ b/src/doc_reform/io_out/defaults.d
@@ -73,8 +73,8 @@ template InternalMarkup() {
string mark_internal_site_lnk = "¤";
string nbsp = "░";
string br_line = "┘";
- string br_newline_inline = "┙";
- string br_paragraph = "┚";
+ string br_line_inline = "┙";
+ string br_line_spaced = "┚";
string br_obj = "break_obj";
string br_page_line = "┼";
string br_page = "┿";
diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d
index 0444aed..44607f7 100644
--- a/src/doc_reform/io_out/epub3.d
+++ b/src/doc_reform/io_out/epub3.d
@@ -71,7 +71,8 @@ template outputEPub3() {
.replaceAll(rgx.xhtml_less_than, "&lt;") // "&#60;"
.replaceAll(rgx.xhtml_greater_than, "&gt;") // "&#62;"
.replaceAll(rgx.br_line, "<br />")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
@@ -236,7 +237,7 @@ template outputEPub3() {
</li>┃",
obj.text
.replaceAll(rgx.inline_notes_al_gen, "")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
.strip,
);
toc ~= "\n";
diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d
index e70c315..ca809d5 100644
--- a/src/doc_reform/io_out/latex.d
+++ b/src/doc_reform/io_out/latex.d
@@ -384,7 +384,7 @@ template outputLaTeX() {
) {
string hardspaces(string _spaces) {
_spaces = _spaces
- .replaceAll(rgx.space, "\\hardspace ");
+ .replaceAll(rgx.space, "{\\s}");
return _spaces;
}
_txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start);
@@ -392,7 +392,25 @@ template outputLaTeX() {
}
@safe string nbsp_char()(string _txt) {
if (_txt.match(rgx.nbsp_char)) {
- _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace ");
+ foreach (m; _txt.matchAll(rgx.nbsp_chars)) {
+ int spaces_ = 0;
+ foreach (n; m[0].matchAll(rgx.nbsp_char)) {
+ spaces_ ++;
+ }
+ _txt = _txt.replaceFirst(rgx.nbsp_chars, "\\spaces{" ~ spaces_.to!string ~ "}");
+ }
+ }
+ return _txt;
+ }
+ @safe string spaces_to_nbsp()(string _txt) {
+ if (_txt.match(rgx.spaces_keep)) {
+ foreach (m; _txt.matchAll(rgx.spaces_keep)) {
+ int spaces_ = 0;
+ foreach (n; m[0].matchAll(rgx.space)) {
+ spaces_ ++;
+ }
+ _txt = _txt.replaceFirst(rgx.spaces_keep, "\\spaces{" ~ spaces_.to!string ~ "}");
+ }
}
return _txt;
}
@@ -440,9 +458,9 @@ template outputLaTeX() {
((m[1] == m[2]) && (m[2].match(rgx.uri))) // url link (regular link with url)
? format(q"┃\linkurl{%s}{%s}┃", _check_link(m[1]), (_check_link(m[1])).sp_char_esc_txt)
: ((m[2].match(rgx.uri)) && (m[1].match(rgx.inline_image_info))) // linked image
- ? format(q"┃%s\href{%s}%s{%s}┃", "\\br\n", _check_link(m[2]), "\n", _if_images(m[1])) // markup for images
+ ? format(q"┃%s\href{%s}%s{%s}┃", "\\br ", _check_link(m[2]), "\n", _if_images(m[1])) // markup for images
: (m[2].match(rgx.uri)) // not linked image
- ? format(q"┃%s\linktext{%s}{%s}┃", "\\br\n", _check_link(m[2]), m[1]) // regular link with text
+ ? format(q"┃%s\linktext{%s}{%s}┃", "\\br ", _check_link(m[2]), m[1]) // regular link with text
: format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1])) // internal links, like book index
)(_txt, rgx.inline_link);
}
@@ -455,7 +473,7 @@ template outputLaTeX() {
if (_txt.match(rgx.inline_notes_al_gen)) {
string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%%
\label{note_%s}%s}┃";
- _txt = _txt.replaceAll(rgx.inline_notes_al_regular_number_note,
+ _txt = _txt.split(rgx.br_linebreaks).join("\\br ").replaceAll(rgx.inline_notes_al_regular_number_note,
format(_tex_note,
"$1", "$1", "$1",
"$2".strip
@@ -496,7 +514,7 @@ template outputLaTeX() {
string _tex_para;
_tex_para = q"┃%s┃";
_txt = format(_tex_para,
- _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\br\n"
+ _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n"
);
}
return _txt;
@@ -705,7 +723,6 @@ template outputLaTeX() {
\pagenumbering{arabic}
\setcounter{page}{1}
\markboth{ }{ }
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
\part*{\ocn{1}%s \newline %s}
\clearpage
@@ -776,14 +793,14 @@ string group(O,M)(
) {
if (obj.metainfo.is_a == "group") {
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
-\begin{footnotesize}
+ _tex_para = q"┃\ocn{%s}\objGroupOpen
%s
-\end{footnotesize}
+\objGroupClose
┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
- _txt.footnotes.strip
+ _txt.footnotes.split(rgx.br_line_spaced).join("\\brl{1}").strip // provides more control (more noise, not as tidy)
+ // _txt.footnotes.split(rgx.br_line_spaced).join("") // this works using a line-space, looks tidy, keep ref.
).strip;
}
return _txt;
@@ -794,19 +811,14 @@ string block(O,M)(
M doc_matters,
) {
if (obj.metainfo.is_a == "block") {
- // _txt = _txt.nbsp_char;
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
-\begin{footnotesize}
+ _tex_para = q"┃\ocn{%s}\objBlockOpen
%s
-\end{footnotesize}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-┃"; // \hardspace
- /+ try both: +/
- _txt = _txt.split(rgx.br_newlines_linebreaks).join("\n\n"); // _txt = _txt.split(rgx.br_newlines_linebreaks).join(" \\\n");
- _txt = format(_tex_para,
+\objBlockClose
+┃";
+ _txt = format(_tex_para,
obj.metainfo.object_number,
- _txt.nbsp_char.footnotes.strip
+ _txt.nbsp_char.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip
).strip;
}
return _txt;
@@ -818,18 +830,13 @@ string verse(O,M)(
) {
if (obj.metainfo.is_a == "verse") {
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
-\begin{footnotesize}
-
+ _tex_para = q"┃\ocn{%s}\objPoemVerseOpen
%s
-
-\end{footnotesize}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-\linebreak
-┃"; // \hardspace
+\objPoemVerseClose
+┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
- _txt.nbsp_char.footnotes.split("\n").join("\n\n").strip
+ _txt.spaces_to_nbsp.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip
).strip;
}
return _txt;
@@ -841,12 +848,9 @@ string codeblock(O,M)(
) {
if (obj.metainfo.is_a == "code") {
string _tex_para;
- _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock}
-\begin{lstlisting}
+ _tex_para = q"┃\ocn{%s}\begin{objCodeBlock}\begin{lstlisting}
%s
-\end{lstlisting}
-\end{Codeblock}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+\end{lstlisting}\end{objCodeBlock}
┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
@@ -922,14 +926,9 @@ string table(O,M)(
);
}
string _tex_para;
- _tex_para = q"┃\ocn{%s}
-\setlength{\LTleft}{0pt}
-\setlength{\LTright}{\fill}
-\begin{tiny}
-\begin{longtable}{%s}
+ _tex_para = q"┃\ocn{%s}\objTableOpen{%s}
%s
-\end{longtable}
-\end{tiny}
+\objTableClose
┃";
_txt = format(_tex_para,
obj.metainfo.object_number,
@@ -950,7 +949,7 @@ string table(O,M)(
if (obj.attrib.bullet) {
int _bullet_space = 5;
_indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin + _bullet_space).to!string;
- _txt = format(q"┃\begin{Bullet}{%smm}$\txtbullet$\hspace{\enspace}%s\end{Bullet}┃",
+ _txt = format(q"┃\begin{Bullet}{%smm}%s\end{Bullet}┃",
_indent,
_txt.footnotes
).strip;
@@ -973,7 +972,7 @@ string table(O,M)(
_tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃";
_txt = format(_tex_para,
_indent, _hang,
- _txt.footnotes
+ _txt.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n")
).strip;
}
return _txt;
@@ -1188,7 +1187,7 @@ string table(O,M)(
\usepackage[tc]{titlepic}
\usepackage{graphicx}
\makeatletter
-\parindent0pt
+\parindent{0pt}
\usepackage{amssymb}
\usepackage{listings}
\usepackage{color}
@@ -1230,6 +1229,7 @@ string table(O,M)(
\setlength\parsep{0pt plus 1pt}%%
}
\item[]
+$\txtbullet$\hspace{\enspace}
}
{\end{list}}
\usepackage{fancyhdr}
@@ -1249,16 +1249,52 @@ string table(O,M)(
\chardef\tilde="7E
\def\asterisk{{\rm \char42} }
\definecolor{Light}{gray}{.92}
-\newcommand{\Codeblock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
\newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1}
+\newcommand{\br}{\hfill\break}
+\newcommand{\brl}[1]{%%
+ \ifx&#1&%%
+ \hfill\break
+ \else
+ \vspace{#1ex}
+ \fi
+}
+\newcommand{\brln}{\hspace*{\fill}\linebreak}
+\newcomand{\objBlockOpen}{
+ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\raggedright
+ \begin{footnotesize}
+}
+\newcomand{\objBlockClose}{%%
+ \end{footnotesize}
+ \setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+}
+\newcomand{\objGroupOpen}{%%
+ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
+ \begin{footnotesize}
+}
+\newcomand{\objGroupClose}{%%
+ \end{footnotesize}
+}
+\newcommand{\objPoemVerseOpen}{%%
+ \setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
+ \begin{footnotesize}
+
+}
+\newcommand{\objPoemVerseClose}{%%
+
+ \end{footnotesize}
+ \setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+ \linebreak
+}
\newcommand{\parasep}{\smallskip \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \br}
-\newcommand{\br}{\hspace*{\fill}}
-\newcommand{\brln}{\smallskip}
-\newcommand{\hardspace}{{~}}
+\newcommand{\spaces}[1]{{\hspace*{#1ex}}}
+\newcommand{\s}{\hspace*{1ex}}
+\newcommand{\hardspace}{\hspace*{1ex}}
+\newcommand{\-}{\hspace*{1ex}}
+\newcommand{\..}{\hspace*{1ex}} %% dots trailing
\newcommand{\caret}{{\^{~}}}
\newcommand{\pipe}{{\textbar}}
-\newcommand{\curlyopen}{{}
-\newcommand{\curlyclose}{}}
+\newcommand{\curlyOpen}{{}
+\newcommand{\curlyClose}{}}
\newcommand{\lt}{{UseTextSymbol{OML}{<}}}
\newcommand{\gt}{{UseTextSymbol{OML}{>}}}
\newcommand{\slash}{{/}}
@@ -1270,18 +1306,27 @@ string table(O,M)(
{\scriptsize\ttfamily\ulcorner\textup{{#2}}\lrcorner}}}
\newcommand{\link}[2]{{\begin{scriptsize}\color{black}\urlstyle{tt}\href{#1}
{\ulcorner{#2}\lrcorner}\end{scriptsize}}}
+\newcommand{\objCodeBlock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
+\newcommand{\objCodeOpen}{\normaltext\raggedright\small\ttfamily\texbackslash
+\begin{lstlisting}
+}
+\newcommand{\objCodeClose}{
+\end{lstlisting}
+}
\newcommand{\ocn}[1]{%%
+ \setlength{\parindent}{0em}
\ifx&#1&%%
%% #1 is empty
- \begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\end{tiny}}}
+ \hspace{-0.5ex}{\marginpar{\begin{tiny}\end{tiny}}}
\else
%% #1 is nonempty
- \begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}}
+ \hspace{-0.5ex}{\marginpar{\begin{tiny}\hspace{0em}\hypertarget{#1}{#1}\end{tiny}}}
\fi
}
\newcommand{\ocnhold}[1]{
\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}}
}
+\newcommand{\objCodeBlockHold}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
@@ -1289,9 +1334,8 @@ string table(O,M)(
tabsize=4,
rulecolor=,
language=,
- basicstyle=\scriptsize,
+ basicstyle={\ttfamily\scriptsize},
upquote=true,
- aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=true,
@@ -1306,6 +1350,16 @@ string table(O,M)(
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\color[rgb]{0.627,0.126,0.941},
}
+\newcommand{\objTableOpen}[1]{
+\setlength{\LTleft}{0pt}
+\setlength{\LTright}{\fill}
+\begin{tiny}
+\begin{longtable}{#1}
+}
+\newcommand{\objTableClose}{
+\end{longtable}
+\end{tiny}
+}
┃",
doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.name_and_version.strip,
doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.compiler.strip,
@@ -1383,23 +1437,19 @@ string table(O,M)(
switch (obj.metainfo.is_a) {
case "quote":
goto default; // TODO
- case "group":
- /+ (hardspaces not honored) [remove any hardspace marker] +/
+ case "group": /+ (hardspaces not honored) [remove any hardspace marker] +/
_txt = _txt.group(obj, doc_matters)
.links_and_images(obj, doc_matters);
goto default;
- case "block":
- /+ (hardspace honored) \hardspace +/
+ case "block": /+ (hardspace honored) \hardspace +/
_txt = _txt.block(obj, doc_matters)
.links_and_images(obj, doc_matters);
goto default;
- case "verse":
- /+ (hardspace honored) \hardspace +/
+ case "verse": /+ (hardspace honored) \hardspace +/
_txt = _txt.verse(obj, doc_matters)
.links_and_images(obj, doc_matters);
goto default;
- case "code":
- /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
+ case "code": /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
_txt = _txt.codeblock(obj, doc_matters);
goto default;
case "table":
diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d
index b80b9f0..68be605 100644
--- a/src/doc_reform/io_out/odt.d
+++ b/src/doc_reform/io_out/odt.d
@@ -492,7 +492,7 @@ template formatODT() {
- only double newlines (paragraph delimiter), (not line breaks, single new lines)
- no hard space indentation
+/
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
_o_txt_odt = _block_type_delimiters(_block_lines, obj);
return _o_txt_odt;
}
@@ -505,7 +505,7 @@ template formatODT() {
assert(obj.metainfo.is_of_type == "block");
assert(obj.metainfo.is_a == "block");
string _o_txt_odt = markup(obj);
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
_o_txt_odt = _block_type_delimiters(_block_lines, obj);
return _o_txt_odt;
}
@@ -518,7 +518,7 @@ template formatODT() {
assert(obj.metainfo.is_of_type == "block");
assert(obj.metainfo.is_a == "verse");
string _o_txt_odt = markup(obj);
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
_o_txt_odt = _block_type_delimiters(_block_lines, obj);
return _o_txt_odt;
}
@@ -538,7 +538,7 @@ template formatODT() {
- "^[ ]" &#160;
- count number only at beginning of line and replace each
+/
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_linebreaks_newlines);
string _block = "";
foreach (i, _line; _block_lines) {
if (i == 1) {
diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d
index 37ad39c..07133e7 100644
--- a/src/doc_reform/io_out/rgx.d
+++ b/src/doc_reform/io_out/rgx.d
@@ -61,6 +61,7 @@ static template spineRgxOut() {
static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block
static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
static nbsp_char = ctRegex!(`░`, "mg");
+ static nbsp_chars = ctRegex!(`[░]+`, "mg");
static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`);
static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`);
static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`);
@@ -76,9 +77,12 @@ static template spineRgxOut() {
static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ line breaks +/
static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
- static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg");
+ static br_linebreaks_newlines = ctRegex!(`[\n┘┙]`, "mg");
+ static br_linebreaks = ctRegex!(`[┘┙]`, "mg");
static br_line = ctRegex!(`┘`, "mg");
- static br_newline_inline = ctRegex!(`┙`, "mg");
+ static br_line_inline = ctRegex!(`┙`, "mg");
+ static br_line_spaced = ctRegex!(`┚`, "mg");
+ static brln = ctRegex!(`(?:\\\\)+`, "mg");
/+ inline markup footnotes endnotes +/
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented
diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d
index 06a764f..a546998 100644
--- a/src/doc_reform/io_out/sqlite.d
+++ b/src/doc_reform/io_out/sqlite.d
@@ -240,8 +240,9 @@ template SQLiteFormatAndLoadObject() {
.replaceAll(rgx.xhtml_less_than, "&#60;")
.replaceAll(rgx.xhtml_greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br /><br />")
.replaceAll(rgx.xhtml_line_break, "<br />");
return _txt;
}
@@ -276,8 +277,9 @@ template SQLiteFormatAndLoadObject() {
.replaceAll(rgx.xhtml_less_than, "&#60;")
.replaceAll(rgx.xhtml_greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br /><br />")
.replaceAll(rgx.xhtml_line_break, "<br />");
return _txt;
}
diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d
index b9d5a1b..534ab94 100644
--- a/src/doc_reform/io_out/xmls.d
+++ b/src/doc_reform/io_out/xmls.d
@@ -100,7 +100,8 @@ template outputXHTMLs() {
.replaceAll(rgx.xhtml_less_than, "&lt;") // "&#60;"
.replaceAll(rgx.xhtml_greater_than, "&gt;") // "&#62;"
.replaceAll(rgx.br_line, "<br />")
- .replaceAll(rgx.br_newline_inline, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
@@ -108,6 +109,8 @@ template outputXHTMLs() {
_txt = _txt
.replaceAll(regex(r"(?:-00)+"), "")
.replaceAll(rgx.br_line, "<br />")
+ .replaceAll(rgx.br_line_inline, "<br />")
+ .replaceAll(rgx.br_line_spaced, "<br />\n<br />")
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
@@ -236,7 +239,7 @@ template outputXHTMLs() {
.replaceAll(
rgx.br_line, "")
.replaceAll(
- rgx.br_newline_inline, "");
+ rgx.br_line_inline, "");
} else {
_locations = "<p class=\"tiny_left\"><a href=\"https://www.doc-reform.org\">spine</a></p>\n<p class=\"tiny_left\"><a href=\"https://git.sisudoc.org/software/spine/\">sources / git</a></p>\n<p class=\"tiny_left\"><a href=\"https://www.sisudoc.org\">www.sisudoc.org</a></p>";
}
@@ -1320,7 +1323,7 @@ template outputXHTMLs() {
string codelines(string _txt) {
string _codelines;
if (obj.code_block.linenumbers) {
- string[] _block_lines = (_txt).split(rgx.br_newlines_linebreaks);
+ string[] _block_lines = (_txt).split(rgx.br_linebreaks_newlines);
_codelines = " <pre class=\"codeline\">\n";
foreach (k, _line; _block_lines) {
if (k == 1) {
diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d
index cb4a661..caf560f 100644
--- a/src/doc_reform/meta/conf_make_meta_yaml.d
+++ b/src/doc_reform/meta/conf_make_meta_yaml.d
@@ -84,7 +84,7 @@ template contentYAMLtoSpineStruct() {
string _txt,
) {
_txt = _txt
- .replaceAll(regex(r"\\"), mkup.br_newline_inline)
+ .replaceAll(regex(r"\\"), mkup.br_line_inline)
.strip;
return _txt;
}
diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d
index ea969d5..33794b7 100644
--- a/src/doc_reform/meta/defaults.d
+++ b/src/doc_reform/meta/defaults.d
@@ -184,8 +184,8 @@ template InternalMarkup() {
string mark_internal_site_lnk = "¤";
string nbsp = "░";
string br_line = "┘";
- string br_newline_inline = "┙";
- string br_paragraph = "┚";
+ string br_line_inline = "┙";
+ string br_line_spaced = "┚";
string br_obj = "break_obj";
string br_page_line = "┼";
string br_page = "┿";
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
index b912c24..194890f 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -121,7 +121,7 @@ template spineAbstraction() {
return "https://sisudoc.org";
}
@safe string url_git() {
- return "https://git.sisudoc.org/software/sisu";
+ return "https://git.sisudoc.org/projects/";
}
@safe auto compiler() {
return program_info.compiler;
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index a9005cd..5befb23 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -913,7 +913,7 @@ template docAbstraction() {
line = line
._doc_header_and_make_substitutions_(conf_make_meta)
._doc_header_and_make_substitutions_fontface_(conf_make_meta)
- .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
+ .replaceAll(rgx.para_delimiter, mkup.br_line_spaced ~ "$1");
an_object = line.flow_txt_block_group(an_object, pith);
continue;
} else if (pith["block_is"] == eN.blk_is.block) {
@@ -4060,11 +4060,11 @@ template docAbstraction() {
an_object[an_object_key] = an_object[an_object_key]
.replaceFirst(rgx.variable_doc_title_author_date,
(conf_make_meta.meta.title_full
- ~ mkup.br_newline_inline
+ ~ mkup.br_line_inline
~ conf_make_meta.meta.creator_author
~ " (" ~ (conf_make_meta.meta.date_published.replaceFirst(regex(r"(?:-00)+"),"")) ~ ")"))
.replaceFirst(rgx.variable_doc_title,
- (conf_make_meta.meta.title_full ~ mkup.br_newline_inline))
+ (conf_make_meta.meta.title_full ~ mkup.br_line_inline))
.replaceFirst(rgx.variable_doc_author,
conf_make_meta.meta.creator_author)
.replaceFirst(rgx.variable_doc_date,
@@ -4075,10 +4075,10 @@ template docAbstraction() {
an_object[an_object_key] = an_object[an_object_key]
.replaceFirst(rgx.variable_doc_title_author_date,
(conf_make_meta.meta.title_full
- ~ mkup.br_newline_inline
+ ~ mkup.br_line_inline
~ conf_make_meta.meta.creator_author))
.replaceFirst(rgx.variable_doc_title,
- (conf_make_meta.meta.title_full ~ mkup.br_newline_inline))
+ (conf_make_meta.meta.title_full ~ mkup.br_line_inline))
.replaceFirst(rgx.variable_doc_author,
conf_make_meta.meta.creator_author);
} else if (an_object[an_object_key].match(rgx.variable_doc_title)) {
@@ -4694,7 +4694,7 @@ template docAbstraction() {
obj_txt["munge"] = obj_txt_in
.replaceFirst(rgx.headings, "")
.replaceFirst(rgx.object_number_off_all, "")
- .replaceFirst(rgx.markup_inline_linebreak, mkup.br_newline_inline)
+ .replaceFirst(rgx.markup_inline_linebreak, mkup.br_line_inline)
.strip;
TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers);
debug(munge) {
@@ -4711,7 +4711,7 @@ template docAbstraction() {
obj_txt["munge"] = (obj_txt_in)
.replaceFirst(rgx.para_attribs, "")
.replaceFirst(rgx.object_number_off_all, "")
- .replaceFirst(rgx.markup_inline_linebreak, mkup.br_newline_inline);
+ .replaceFirst(rgx.markup_inline_linebreak, mkup.br_line_inline);
TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]);
debug(munge) {
writeln(__LINE__);
@@ -4729,7 +4729,7 @@ template docAbstraction() {
invariant() {
}
@safe auto munge_group(string obj_txt_in) {
- TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n"));
+ TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join("\n" ~ mkup.br_line_spaced ~ "\n")); // br_line br_line_inline br_line_spaced
return t;
}
invariant() {
diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d
index 8c48eac..7f4815d 100644
--- a/src/doc_reform/meta/rgx.d
+++ b/src/doc_reform/meta/rgx.d
@@ -229,6 +229,7 @@ static template spineRgxIn() {
static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block
static spaces_line_start = ctRegex!(`^(?P<opening_spaces>[ ]+)`, "mg");
static nbsp_char = ctRegex!(`░`, "mg");
+ static nbsp_chars = ctRegex!(`[░]+`, "mg");
static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`);
static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`);
static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`);
@@ -244,9 +245,12 @@ static template spineRgxIn() {
static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ line breaks +/
static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg");
- static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg");
+ static br_linebreaks_newlines = ctRegex!(`[\n┘┙]`, "mg");
+ static br_linebreaks = ctRegex!(`[┘┙]`, "mg");
static br_line = ctRegex!(`┘`, "mg");
- static br_newline_inline = ctRegex!(`┙`, "mg");
+ static br_line_inline = ctRegex!(`┙`, "mg");
+ static br_line_spaced = ctRegex!(`┚`, "mg");
+ static brln = ctRegex!(`(?:\\\\)+`, "mg");
/+ inline markup footnotes endnotes +/
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented