texlive[73276] Master/texmf-dist: scripture (2jan25)
commits+karl at tug.org
commits+karl at tug.org
Thu Jan 2 21:33:56 CET 2025
Revision: 73276
https://tug.org/svn/texlive?view=revision&revision=73276
Author: karl
Date: 2025-01-02 21:33:56 +0100 (Thu, 02 Jan 2025)
Log Message:
-----------
scripture (2jan25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/scripture/README.md
trunk/Master/texmf-dist/doc/latex/scripture/scripture.pdf
trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx
trunk/Master/texmf-dist/source/latex/scripture/scripture.ins
trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty
Modified: trunk/Master/texmf-dist/doc/latex/scripture/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scripture/README.md 2025-01-02 20:33:47 UTC (rev 73275)
+++ trunk/Master/texmf-dist/doc/latex/scripture/README.md 2025-01-02 20:33:56 UTC (rev 73276)
@@ -54,10 +54,14 @@
l3build install --full
```
+**Note:** The documentation uses one font not found in a standard TeXLive
+installation. You can download `KawkabMono-Regular.ttf` from
+https://makkuk.com/kawkab-mono/.
+
## Licence
```
-Copyright (c) 2022-2023 David Purton <dcpurton at marshwiggle.net>
+Copyright (c) 2022-2025 David Purton <dcpurton at marshwiggle.net>
This work may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.3c of this license
Modified: trunk/Master/texmf-dist/doc/latex/scripture/scripture.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx 2025-01-02 20:33:47 UTC (rev 73275)
+++ trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx 2025-01-02 20:33:56 UTC (rev 73276)
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (c) 2022-2023 David Purton <dcpurton at marshwiggle.net>
+% Copyright (c) 2022-2025 David Purton <dcpurton at marshwiggle.net>
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3c of this license
@@ -11,8 +11,24 @@
% version 2005/12/01 or later.
%
%<*driver>
-\DocumentMetadata{}
+\DocumentMetadata{lang=en}
\documentclass[a4paper]{l3doc}
+\usepackage[bidi=basic, layout=lists]{babel}
+\babelprovide[import, main]{australian}
+\babelprovide[import, onchar=ids fonts]{ancientgreek}
+\babelprovide[import, onchar=ids fonts]{japanese}
+\babelprovide[import, mapdigits, onchar=ids fonts]{persian}
+\babelfont[ancientgreek]{rm}[BoldFont=NewCM10-Bold]{NewCM10-Regular}
+\babelfont[ancientgreek]{tt}{NewCMMono10-Regular}
+\babelfont[japanese]{tt}[Scale=.9]{IPAMincho}
+\babelfont[persian]{rm}[Renderer = Harfbuzz]{Amiri}
+\babelfont[persian]{tt}[Renderer = Harfbuzz, Scale=.75]{Kawkab Mono Regular}
+\usepackage{luatexja-fontspec}
+\newcommand{\disablecjk}{%
+ \ltjsetparameter{jacharrange={-1, -2, -3, -4, -5, -6, -7, -8, -9}}}
+\newcommand{\enablecjk}{%
+ \ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, -8, +9}}}
+\disablecjk
\usepackage[parindent=1em]{scripture}
\usepackage[skins]{tcolorbox}
\newtcolorbox{scriptureexample}[1][]{%
@@ -31,6 +47,12 @@
}
\ExplSyntaxOn
\makeatletter
+\hook_gput_code:nnn
+ { env / scripture / begin }
+ { scripturedoc }
+ {
+ \cs_set_eq:NN \list \__codedoc_oldlist:nn
+ }
\cs_new_protected:Npn \__dcp_codedoc_environment_index:n #1
{
\@bsphack
@@ -129,6 +151,10 @@
}
\DeclareDocumentEnvironment { environment } { O{} +v }
{
+ \clist_map_inline:nn { #2 }
+ {
+ \MakeLinkTarget*{environment##1}
+ }
\cs_set_eq:NN \__codedoc_function_index:n \__dcp_codedoc_environment_index:n
\__codedoc_function:nnw {#1} {#2}
}
@@ -135,6 +161,10 @@
{ \__codedoc_function_end: }
\DeclareDocumentEnvironment { hooks } { O{} +v }
{
+ \clist_map_inline:nn { #2 }
+ {
+ \MakeLinkTarget*{hook##1}
+ }
\bool_if:NTF \l__codedoc_in_implementation_bool
{
\cs_set_eq:NN \__codedoc_macro_index:nN \__dcp_codedoc_hookmacro_index:nN
@@ -153,6 +183,10 @@
\DeclareDocumentEnvironment { option } { O{} +v }
{
\cs_set_eq:NN \__codedoc_function_index:n \SpecialOptionIndex
+ \clist_map_inline:nn { #2 }
+ {
+ \MakeLinkTarget*{option##1}
+ }
\__codedoc_function:nnw {#1} {#2}
}
{ \__codedoc_function_end: }
@@ -162,17 +196,35 @@
\__codedoc_macro:nnw {#1} {#2}
}
{ \__codedoc_macro_end: }
+\DeclareDocumentEnvironment { function } { O{} +v }
+ {
+ \clist_map_inline:nn { #2 }
+ {
+ \MakeLinkTarget*{function##1}
+ }
+ \__codedoc_function:nnw {#1} {#2}
+ }
+ { \__codedoc_function_end: }
+\DeclareDocumentCommand \env { m }
+ {
+ \hyperlink{environment#1}{\texttt{#1}}
+ }
\DeclareDocumentCommand \opt { m }
{
- \SpecialOptionIndex {#1}
- \texttt{#1}
+ \hyperlink{option#1}{\texttt{#1}}
}
\DeclareDocumentCommand \hook { m }
{
- \__dcp_codedoc_hook_index:n {#1}
- \texttt {#1}
+ \hyperlink{hook#1}{\texttt{#1}}
}
\DeclareRobustCommand \val {\texttt}
+\DeclareDocumentCommand \fn { O{} m }
+ {
+ \hyperlink{function \c_backslash_str #2}{
+ \__codedoc_cmd:no
+ { module = scripture , replace = false , #1 }
+ { \c_backslash_str #2} }
+ }
\makeatother
\ExplSyntaxOff
\begin{document}
@@ -185,13 +237,14 @@
% \changes{v1.1}{2022/08/27}{Bug fixes}
% \changes{v1.2}{2022/11/02}{Bug fixes}
% \changes{v1.3}{2023/01/08}{Bug fixes}
-% \changes{v2.0}{2023/12/26}{Switch \env{scripture} to a \LaTeX{} \env{list}
+% \changes{v2.0}{2023/12/26}{Switch \env{scripture} to a \LaTeX{} \val{list}
% based environment}
% \changes{v2.0}{2023/12/27}{Bug fixes}
+% \changes{v2.1}{2025/01/02}{Bug fixes}
%
% \title{The \pkg{scripture} package}
% \author{David Purton\thanks{Email: \url{dcpurton at marshwiggle.net}}}
-% \date{2023/12/27 v2.0}
+% \date{2025/01/02 v2.1}
%
% \maketitle
%
@@ -231,7 +284,7 @@
%
% \subsection{Limitations}
%
-% The \pkg{scripture} package makes extensive use of \LaTeX{} \env{list}
+% The \pkg{scripture} package makes extensive use of \LaTeX{} \val{list}
% environments and the \cs{parshape} command. This means there are some
% limitations. In particular, you should not:
% \begin{itemize}
@@ -238,12 +291,17 @@
% \item Nest the \env{scripture} environment or any of its internal
% environments.
% \item Modify the \cs{parshape} within a \env{scripture} environment.
-% \item Include any other \env{list} based environment within a
+% \item Include any other \val{list} based environment within a
% \env{scripture} environment.
+% \item Include any \cs{section} (or similar) functions within the
+% \env{scripture} environment. A simple \fn{heading} function is provided
+% instead.
% \end{itemize}
%
% The \env{poetry} environment uses \cs{obeylines}. This means that it can not
-% be placed in the argument of a macro.
+% be placed in the argument of a macro. If you want to use the \env{poetry}
+% environment in a \pkg{beamer} slide, you must use the \texttt{fragile} option
+% for the \pkg{beamer} \val{frame} environment.
%
% Some attempt is made to encourage appropriate page breaks, especially just
% before a reference is added to a quotation, but this can still sometimes
@@ -271,7 +329,7 @@
% for my salvation is close at hand
% and my righteousness will soon be revealed.
%
-% \vs{2}Blessed is the one who does this---
+% \vs{2}Blessed is the one who does this~--
% the person who holds it fast,
%
% who keeps the Sabbath without desecrating it,
@@ -291,7 +349,7 @@
% for my salvation is close at hand
% and my righteousness will soon be revealed.
%
-% \vs{2}Blessed is the one who does this---
+% \vs{2}Blessed is the one who does this~--
% the person who holds it fast,
%
% who keeps the Sabbath without desecrating it,
@@ -310,7 +368,7 @@
% |\added|\marg{words}
% \end{syntax}
% Some Bible translations mark out words added for clarity not found in the
-% original language (e.g., in italics). This can be done using the \cs{added}
+% original language (e.g., in italics). This can be done using the \fn{added}
% function. The font and format can be set using the \opt{added/font} and
% \opt{added/format} options.
% \end{function}
@@ -337,14 +395,16 @@
%
% \begin{function}{\ch, \ch*}
% \begin{syntax}
-% |\ch|\marg{chapter number}
-% |\ch*|\marg{chapter number}
+% |\ch|\oarg{letter}\marg{chapter number}
+% |\ch*|\oarg{letter}\marg{chapter number}
% \end{syntax}
% Format a chapter number. By default these are formatted using drop text
% taking up two lines and the text is separated from the chapter number by a
-% horizontal space of 0.5\,em.
+% horizontal space of 0.5\,em. The drop text is aligned to the top of
+% \meta{letter} which defaults to the value of \opt{chapter/xchar}, which in
+% turn defaults to a capital \val{X} in the default font.
%
-% If the \opt{dropchap} option is \val{true} (default), then this function
+% If the \opt{chapter/drop} option is \val{true} (default), then this function
% attempts to add sufficient space for the dropped chapter when its
% paragraph contains only one line. The starred version suppresses this
% behaviour.
@@ -443,6 +503,69 @@
% \end{scripture}
% \end{scriptureexample}
%
+% \changes{v2.1}{2024/11/19}{Add feature to insert simple headings}
+% \changes{v2.1}{2024/11/19}{Add \fn{heading} function}
+% \begin{function}[added=2024-11-19]{\heading}
+% \begin{syntax}
+% |\heading|\marg{section heading}
+% \end{syntax}
+% The \fn{heading} function provides a simple section heading command for
+% use within the \env{scripture} environment. Only one level is heading is
+% provided. Further levels should be placed outside of the \env{scripture}
+% environment. Additionally, the \fn{heading} function may not be used
+% within a \env{scripture} inner environment.
+%
+% The settings of headings can be controlled using the following options:
+% \begin{itemize}
+% \item \opt{heading/aboveskip}
+% \item \opt{heading/afterindent}
+% \item \opt{heading/align}
+% \item \opt{heading/belowskip}
+% \item \opt{heading/font}
+% \item \opt{heading/format}
+% \item \opt{heading/hide}
+% \item \opt{heading/show}
+% \end{itemize}
+%
+% \noindent\textbf{Notes:}
+% \begin{itemize}
+% \item \cs{section} and related functions are not supported within the
+% \env{scripture} environment.
+% \item The \fn{heading} function is ignored when the \opt{inline} option
+% is \val{true}.
+% \end{itemize}
+% \end{function}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[Luke 21:5–6]
+% \heading{Signs of the End of the Age}
+%
+% \vs{5}Some of his disciples were remarking
+% about how the temple was adorned with beautiful
+% stones and with gifts dedicated to God. But
+% Jesus said, \vs{6}``As for what you see here,
+% the time will come when not one stone will be
+% left on another; every one of them will be
+% thrown down.''
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Luke 21:5–6]
+% \heading{Signs of the End of the Age}
+%
+% \vs{5}Some of his disciples were remarking
+% about how the temple was adorned with beautiful
+% stones and with gifts dedicated to God. But
+% Jesus said, \vs{6}``As for what you see here,
+% the time will come when not one stone will be
+% left on another; every one of them will be
+% thrown down.''
+% \end{scripture}
+% \end{scriptureexample}
+%
% \changes{v1.2}{2022/09/01}{Add divine name feature}
% \begin{function}[added=2022-09-01]{\name, \LORD, \GOD}
% \begin{syntax}
@@ -451,13 +574,13 @@
% |\GOD|
% \end{syntax}
% Modern Bible translations frequently represent God's personal divine name
-% using a small capitals typeface. This can be done using the \cs{name}
+% using a small capitals typeface. This can be done using the \fn{name}
% function. The font and format can be set using the \opt{name/font} and
-% \opt{name/format} options. The \cs{LORD} and \cs{GOD} macros equivalent to
-% \cs{name}|{Lord}| and \cs{name}|{God}| respectively.
+% \opt{name/format} options. The \fn{LORD} and \fn{GOD} macros equivalent to
+% \fn{name}|{Lord}| and \fn{name}|{God}| respectively.
%
-% \textbf{Note:} Watch out that trailing spaces are not eaten by \cs{LORD}
-% and \cs{GOD}. Using \cs{name} is safer and semantically better.
+% \textbf{Note:} Watch out that trailing spaces are not eaten by \fn{LORD}
+% and \fn{GOD}. Using \fn{name} is safer and semantically better.
% \end{function}
%
% \begin{scriptureexample}
@@ -486,12 +609,12 @@
% \end{scripture}
% \end{scriptureexample}
%
-% \changes{v1.3}{2022/11/13}{Add \cs{nofirstverse} function}
+% \changes{v1.3}{2022/11/13}{Add \fn{nofirstverse} function}
% \begin{function}[added=2022-11-13]{\nofirstverse}
% \begin{syntax}
% |\nofirstverse|
% \end{syntax}
-% When \opt{verse/first} is |true|, this causes the next \cs{vs} to print
+% When \opt{verse/first} is |true|, this causes the next \fn{vs} to print
% normally, rather than using the format specified by
% \opt{verse/firstformat}. You might do this if your quote begins half way
% through a paragraph and the first verse should be printed normally.
@@ -540,6 +663,17 @@
% \end{scripture}
% \end{scriptureexample}
%
+% \changes{v2.1}{2024/01/18}{Add \fn{nopilcrow} function}
+% \begin{function}[added=2024-01-18]{\nopilcrow}
+% \begin{syntax}
+% |\nopilcrow|
+% \end{syntax}
+% When \opt{pilcrow} is |true|, this causes the next pilcrow that would
+% normally by printed to be suppressed. You might do this if your quote
+% begins half way through a paragraph and so should not be marked with a
+% pilcrow.
+% \end{function}
+%
% \changes{v1.2}{2022/08/31}{Add red letter feature}
% \begin{function}[added=2022-08-31]{\redletteron, \redletteroff}
% \begin{syntax}
@@ -546,12 +680,12 @@
% |\redletteron|
% |\redletteroff|
% \end{syntax}
-% Use \cs{redletteron} and \cs{redletteroff} to mark the beginning and end
+% Use \fn{redletteron} and \fn{redletteroff} to mark the beginning and end
% of sections of text that should be attributed to Jesus speaking. Some
% attempt is made to ensure that the correct colour continues after an inner
-% environment if \cs{redletteron} or \cs{redletteroff} occurs inside the
+% environment if \fn{redletteron} or \fn{redletteroff} occurs inside the
% inner environment. If you experience problems with unexpected colour, try
-% to ensure that matching \cs{redletteron} and \cs{redletteroff} marks occur
+% to ensure that matching \fn{redletteron} and \fn{redletteroff} marks occur
% at the same group level. The colour of the text can be set using the
% \opt{redletter/colour} option. These commands only have an effect when the
% \opt{redletter} option is \val{true}.
@@ -595,16 +729,15 @@
% \end{scripture}
% \end{scriptureexample}
%
-% \changes{v1.1}{2022/08/07}{Add \cs{scripturecurrentchapter} and
-% \cs{scripturecurrentverse} variables}
-% \begin{function}[added=2022-08-07]{\scripturecurrentchapter,
-% \scripturecurrentverse}
+% \changes{v1.1}{2022/08/07}{Add \fn{scripturecurrentchapter} and
+% \fn{scripturecurrentverse} variables}
+% \begin{function}[added=2022-08-07]{\scripturecurrentchapter, \scripturecurrentverse}
% \begin{syntax}
% |\scripturecurrentchapter|
% |\scripturecurrentverse|
% \end{syntax}
-% \cs{scripturecurrentcapter} and \cs{scripturecurrentverse} globally hold
-% the most recent values parsed to \cs{ch} and \cs{vs}. They can initialised
+% \fn{scripturecurrentchapter} and \fn{scripturecurrentverse} globally hold
+% the most recent values parsed to \fn{ch} and \fn{vs}. They can initialised
% with \cs{renewcommand*} if required and could be used in hooks, for
% example.
% \end{function}
@@ -617,7 +750,7 @@
% supported formatting \meta{|options|}.
% \end{function}
%
-% \changes{v2.0}{2023/12/27}{Add \cs{scripturestyle} function}
+% \changes{v2.0}{2023/12/27}{Add \fn{scripturestyle} function}
% \begin{function}[added=2023/12/27]{\scripturestyle, \scripturestyle*}
% \begin{syntax}
% |\scripturestyle|\marg{name}\marg{options}
@@ -628,7 +761,7 @@
% \meta{|options|} to an existing style rather than overwriting all options.
% \end{function}
%
-% \changes{v1.1}{2022/07/29}{Add \cs{selah} function}
+% \changes{v1.1}{2022/07/29}{Add \fn{selah} function}
% \begin{function}[added=2022-07-29]{\selah}
% \begin{syntax}
% |\selah|
@@ -659,7 +792,7 @@
% \end{scripture}
% \end{scriptureexample}
%
-% \changes{v1.2}{2022/08/30}{Add \cs{textright} function}
+% \changes{v1.2}{2022/08/30}{Add \fn{textright} function}
% \begin{function}[added=2022-08-30]{\textright}
% \begin{syntax}
% |\textright|\marg{text}
@@ -692,16 +825,16 @@
% \end{scripture}
% \end{scriptureexample}
%
-% \changes{v1.3}{2023/01/07}{Add \cs{textscripture} function}
+% \changes{v1.3}{2023/01/07}{Add \fn{textscripture} function}
% \begin{function}[added=2023-01-07]{\textscripture}
% \begin{syntax}
% |\textscripture|\oarg{reference}\oarg{options}\marg{quotation}
% \end{syntax}
-% \cs{textscripture} sets an inline scripture quotation. The quotation is
+% \fn{textscripture} sets an inline scripture quotation. The quotation is
% surrounded be the values of \opt{inline/begin} and \opt{inline/end} which
-% default to |``\,| and |\,''|, respectively. This function also sets the
-% \opt{compact} option and places the \val{reference} inline. The reference
-% format can be controlled using the following options:
+% default to |``| and |''|, respectively. This function also sets the
+% \opt{compact} option and places the \meta{\val{reference}} inline. The
+% reference format can be controlled using the following options:
% \begin{itemize}
% \item \opt{inline/reference/format}
% \item \opt{inline/reference/sep}
@@ -708,14 +841,15 @@
% \item \opt{inline/version/delim}
% \item \opt{inline/version/format}
% \end{itemize}
-% Other \val{reference} and \val{version} options are inherited.
+% Other \meta{\val{reference}} and \meta{\opt{version}} options are
+% inherited.
%
% This function is equivalent to using the \env{scripture} environment with
% the \opt{inline} option.
%
% \textbf{Warning:} \cs{par} is redefined to \cs{relax} inside the
-% \cs{textscripture} function. If you have anything other than expected
-% macros and environments inside your \cs{textscripture} function \TeX{}
+% \fn{textscripture} function. If you have anything other than expected
+% macros and environments inside your \fn{textscripture} function \TeX{}
% will likely get stuck in an infinite loop.
% \end{function}
%
@@ -1058,18 +1192,17 @@
%
% \changes{v1.1}{2022/08/07}{Add before and after hooks for verses and
% chapters}
-% \begin{hooks}[added=2022-08-07]{scripture/chap/before, scripture/chap/after,
-% scripture/verse/before, scripture/verse/after}
+% \begin{hooks}[added=2022-08-07]{scripture/chap/before, scripture/chap/after, scripture/verse/before, scripture/verse/after}
% The following public hooks are available:
%
% \begin{description}
% \item[\hook{scripture/chap/before}] This hook is executed immediately
-% before the \opt{chap/font} is set for the chapter.
+% before the \opt{chapter/font} is set for the chapter.
% \item[\hook{scripture/chap/after}] This hook is executed immediately after
-% the \opt{chap/sep} space is inserted.
+% the \opt{chapter/sep} space is inserted.
% \item[\hook{scripture/verse/before}] This hook is executed immediately
% before the \opt{verse/font} is set for the verse.
-% \item[\hook{scripture/chap/after}] This hook is executed immediately after
+% \item[\hook{scripture/verse/after}] This hook is executed immediately after
% the \opt{verse/sep} space is inserted.
% \end{description}
% \end{hooks}
@@ -1140,11 +1273,11 @@
% \subsection{Options}
% \label{options}
%
-% \changes{v1.3}{2023/01/08}{Remove \opt{reference/delim} option}
+% \changes{v1.3}{2023/01/08}{Remove \texttt{reference/delim} option}
%
% Default formatting \meta{|options|} can be set using
% \cs{usepackage}|[|\meta{|options|}|]{scripture}| or
-% \cs{scripturesetup}|{|\meta{|options|}|}|. Local formatting \meta{|options|}
+% \fn{scripturesetup}|{|\meta{|options|}|}|. Local formatting \meta{|options|}
% can be set by passing them to the various environments described above.
%
% \begin{option}{aboveskip}
@@ -1159,7 +1292,7 @@
% \begin{syntax}
% added/font = \meta{font} \hfill Default: \emph{Empty}
% \end{syntax}
-% \meta{|font|} used for the \cs{added} function.
+% \meta{|font|} used for the \fn{added} function.
% \end{option}
%
% \changes{v1.3}{2022/11/15}{Add \opt{added/format} option}
@@ -1168,10 +1301,27 @@
% added/format = \meta{macro} \hfill Default: \cs{emph}\{\#1\}
% \end{syntax}
% \meta{|macro|} used to format the words that should be highlighted as
-% added by the translators using the \cs{added} function. |#1| contains the
-% text of the argument to \cs{added}.
+% added by the translators using the \fn{added} function. |#1| contains the
+% text of the argument to \fn{added}.
% \end{option}
%
+% \changes{v2.1}{2024/06/01}{Add \opt{after} option}
+% \begin{option}[added=2024-06-01]{after}
+% \begin{syntax}
+% after = \meta{token list} \hfill Default: \emph{Empty}
+% \end{syntax}
+% Execute \meta{|token list|} at the end of the \env{scripture} environment.
+% \end{option}
+%
+% \changes{v2.1}{2024/06/01}{Add \opt{before} option}
+% \begin{option}[added=2024-06-01]{before}
+% \begin{syntax}
+% before = \meta{token list} \hfill Default: \emph{Empty}
+% \end{syntax}
+% Execute \meta{|token list|} at the beginning of the \env{scripture}
+% environment.
+% \end{option}
+%
% \begin{option}{belowskip}
% \begin{syntax}
% belowskip = \meta{skip} \hfill Default: 0pt
@@ -1179,6 +1329,17 @@
% \meta{|skip|} inserted below the \env{scripture} environment.
% \end{option}
%
+% \changes{v2.1}{2024/12/30}{Add \opt{chapter/align} option}
+% \begin{option}[added=2024-12-30]{chapter/align}
+% \begin{syntax}
+% chapter/align = left \textbar\ right\hfill Default: left
+% \end{syntax}
+% When \opt{chapter/align} is set to \val{right} a chapter will overlap to
+% the left when \opt{chapter/nodrop} is set.
+%
+% See also \opt{chapter/valign}.
+% \end{option}
+%
% \changes{v1.2}{2022/09/07}{Add \opt{chapter/colour} option}
% \begin{option}[added=2022-09-07]{chapter/colour, chapter/color}
% \begin{syntax}
@@ -1203,7 +1364,7 @@
% \begin{syntax}
% chapter/font = \meta{font} \hfill Default: \cs{bfseries}
% \end{syntax}
-% \meta{|font|} used for the \cs{ch} function.
+% \meta{|font|} used for the \fn{ch} function.
% \end{option}
%
% \changes{v1.1}{2022/07/28}{Add \opt{chapter/format} option}
@@ -1283,11 +1444,74 @@
% \end{scripture}
% \end{scriptureexample}
%
+% \changes{v2.1}{2024/01/05}{Add feature to set chapters in a paragraph of
+% their own}
+% \changes{v2.1}{2024/01/05}{Add \opt{chapter/para} option}
+% \begin{option}[added=2024-01-05]{chapter/para}
+% \begin{syntax}
+% chapter/para = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Set chapters in their own paragraph. The spacing before and after the
+% chapter heading can be set using the \opt{chapter/para/aboveskip} and
+% \opt{chapter/para/belowskip} options. The value of \meta{|boolean|} is
+% optional and assumed to be \val{true} if not present.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[John 1:1][chapter/para,
+% chapter/format=CHAPTER~#1, version=KJV]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[John 1:1][chapter/para,
+% chapter/format=CHAPTER~#1, version=KJV]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \changes{v2.1}{2024/01/05}{Add \opt{chapter/para/aboveskip} option}
+% \begin{option}[added=2024-01-05]{chapter/para/aboveskip}
+% \begin{syntax}
+% chapter/para/aboveskip = \meta{skip} \hfill Default: \cs{bigskipamount}
+% \end{syntax}
+% \meta{|skip|} added above \fn{ch} when \opt{chapter/para} is in effect.
+% To be consistent with how the \pkg{parskip} package treats headings, no
+% additional \cs{parskip} is inserted.
+% \end{option}
+%
+% \changes{v2.1}{2024/01/05}{Add \opt{chapter/para/belowskip} option}
+% \begin{option}[added=2024-01-05]{chapter/para/belowskip}
+% \begin{syntax}
+% chapter/para/belowskip = \meta{skip} \hfill Default: \cs{medskipamount}
+% \end{syntax}
+% \meta{|skip|} added below \fn{ch} when \opt{chapter/para} is in effect.
+% To be consistent with how the \pkg{parskip} package treats headings, no
+% additional \cs{parskip} is inserted.
+% \end{option}
+%
+% \changes{v2.1}{2024/01/05}{Add \opt{chapter/para/indent} option}
+% \begin{option}[added=2024-01-05]{chapter/para/indent}
+% \begin{syntax}
+% chapter/para/indent = \meta{boolean} \hfill Default: true
+% \end{syntax}
+% Whether to indent the line following a chapter heading when the
+% \opt{chapter/para} option is set to \val{true}. This only has an effect in
+% the \env{scripture}, \env{narrow} and \env{midparachap} environments. The
+% value of \meta{|boolean|} is optional and assumed to be \val{true} if not
+% present.
+% \end{option}
+%
% \begin{option}{chapter/sep}
% \begin{syntax}
% chapter/sep = \meta{dimen} \hfill Default: 0.5em
% \end{syntax}
-% \meta{|dimen|} used to separate a \cs{ch} from the following text.
+% \meta{|dimen|} used to separate a \fn{ch} from the following text.
% \end{option}
%
% \changes{v1.1}{2022/08/15}{Add \opt{chapter/show} option}
@@ -1305,7 +1529,7 @@
% \begin{syntax}
% chapter/showverse = \meta{boolean} \hfill Default: false
% \end{syntax}
-% Whether \cs{vs}|\{1\}| should be automatically inserted after \cs{ch}. The
+% Whether \fn{vs}|{1}| should be automatically inserted after \fn{ch}. The
% value of \meta{|boolean|} is optional and assumed to be \val{true} if not
% present. See also \opt{midparachap/showverse} and
% \opt{midparachap/hideverse}. Note that \opt{chapter/showverse} take
@@ -1328,6 +1552,94 @@
% \end{scripture}
% \end{scriptureexample}
%
+% \changes{v2.1}{2024/12/30}{Add \opt{chapter/smash} option}
+% \begin{option}[added=2024-12-30]{chapter/smash}
+% \begin{syntax}
+% chapter/smash = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Whether a chapter should be wrapped in \cs{smash} when
+% \opt{chapter/nodrop} is set. This allows the chapter number to be larger
+% than the line height without affecting line spacing. The value of
+% \meta{|boolean|} is optional and assumed to be \val{true} if not present.
+% \end{option}
+%
+% \changes{v2.1}{2024/12/30}{Add \opt{chapter/valign} option}
+% \begin{option}[added=2024-12-30]{chapter/valign}
+% \begin{syntax}
+% chapter/align = bottom \textbar\ middle \textbar\ top\hfill Default: bottom
+% \end{syntax}
+% Sets how a chapter will align vertically when \opt{chapter/nodrop} is set.
+% \begin{itemize}
+% \item \val{bottom}: Chapter will align at the text base line.
+% \item \val{middle}: Chapter will align at the center of text.
+% \item \val{top}: Chapter will align at the top of text.
+% \end{itemize}
+%
+% See also \opt{chapter/align}.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage{babel}
+% \babelprovide[import, main]{english}
+% \babelprovide[import,
+% onchar=ids fonts]{ancientgreek}
+% \babelfont[ancientgreek]{rm}[
+% BoldFont=NewCM10-Bold]{NewCM10-Regular}
+% \usepackage{scripture}
+% \begin{document}
+% \begin{scripture}[Κατά Μάρκον 1:1--3][
+% chapter/font=\huge\bfseries,
+% chapter/align=right, chapter/nodrop,
+% chapter/smash, chapter/valign=top,
+% hanging/hang=1em, hanging/leftmargin=2em,
+% hanging/verse/sep=1em, language=ancientgreek,
+% verse/font=\sffamily\bfseries,
+% verse/sep=0.25em, version=THGNT]
+% \begin{hanging}
+% \ch{1}Ἀρχὴ τοῦ εὐαγγελίου Ἰησοῦ χριστοῦ υἱοῦ
+% θεοῦ· \vs{2}καθὼς γέγραπται ἐν τῷ Ἡσαΐᾳ τῷ
+% προφήτῃ· ἰδοὺ ἀποστέλλω τὸν ἄγγελόν μου πρὸ
+% προσώπου σου, ὃς κατασκευάσει τὴν ὁδόν σου.
+% \vs{3}φωνὴ βοῶντος ἐν τῇ ἐρήμῳ ἑτοιμάσατε τὴν
+% ὁδὸν κυρίου, εὐθείας ποιεῖτε τὰς τρίβους αὐτοῦ.
+% \end{hanging}
+% \end{scripture}
+% \end{document}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Κατά Μάρκον 1:1--3][
+% chapter/font=\huge\bfseries,
+% chapter/align=right, chapter/nodrop,
+% chapter/smash, chapter/valign=top,
+% hanging/hang=1em, hanging/leftmargin=2em,
+% hanging/verse/sep=1em, language=ancientgreek,
+% verse/font=\sffamily\bfseries,
+% verse/sep=0.25em, version=THGNT]
+% \begin{hanging}
+% \ch{1}Ἀρχὴ τοῦ εὐαγγελίου Ἰησοῦ χριστοῦ υἱοῦ
+% θεοῦ· \vs{2}καθὼς γέγραπται ἐν τῷ Ἡσαΐᾳ τῷ
+% προφήτῃ· ἰδοὺ ἀποστέλλω τὸν ἄγγελόν μου πρὸ
+% προσώπου σου, ὃς κατασκευάσει τὴν ὁδόν σου.
+% \vs{3}φωνὴ βοῶντος ἐν τῇ ἐρήμῳ ἑτοιμάσατε τὴν
+% ὁδὸν κυρίου, εὐθείας ποιεῖτε τὰς τρίβους αὐτοῦ.
+% \end{hanging}
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \changes{v2.1}{2025/01/01}{Add \opt{chapter/xchar} option}
+% \begin{option}[added=2025-01-01]{chapter/xchar}
+% \begin{syntax}
+% chapter/xchar = \meta{character}\hfill Default: X
+% \end{syntax}
+% Sets the character to which drop chapters and vertically aligned non-drop
+% chapters are aligned. This can also be set for individual chapters using
+% an optional argument to \fn{ch}.
+% \end{option}
+%
% \changes{v1.2}{2022/08/31}{Add \opt{colour} option}
% \begin{option}[added=2022-08-31]{colour, color}
% \begin{syntax}
@@ -1343,7 +1655,7 @@
% \begin{syntax}
% compact = \meta{boolean} \hfill Default: false
% \end{syntax}
-% This option removes all paragraph breaks along with any \cs{extraskip} in
+% This option removes all paragraph breaks along with any \fn{extraskip} in
% the quotation so the whole quotation is a single paragraph of running
% prose. This option implies \opt{chapter/nodrop} and all options relating
% to inner environments are ignored.
@@ -1369,7 +1681,7 @@
% said:
% \end{midparachap}
% \begin{poetry}
-% `In my distress I called to the Lord,
+% `In my distress I called to the \name{Lord},
% and he answered me.
% \end{poetry}
% \end{scripture}
@@ -1387,17 +1699,25 @@
% said:
% \end{midparachap}
% \begin{poetry}
-% `In my distress I called to the Lord,
+% `In my distress I called to the \name{Lord},
% and he answered me.
% \end{poetry}
% \end{scripture}
% \end{scriptureexample}
%
+% \changes{v2.1}{2025/01/01}{Add \opt{defaults} option}
+% \begin{option}[added=2025-01-01]{defaults}
+% \begin{syntax}
+% defaults
+% \end{syntax}
+% Resets options to defaults.
+% \end{option}
+%
% \begin{option}{extraskip}
% \begin{syntax}
% extraskip = \meta{skip} \hfill Default: \cs{medskipamount}
% \end{syntax}
-% \meta{|skip|} used for the \cs{extraskip} function.
+% \meta{|skip|} used for the \fn{extraskip} function.
% \end{option}
%
% \begin{option}{font}
@@ -1407,6 +1727,87 @@
% \meta{|font|} used for the \env{scripture} environment.
% \end{option}
%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/aboveskip} option}
+% \begin{option}[added=2024-11-19]{heading/aboveskip}
+% \begin{syntax}
+% heading/aboveskip = \meta{skip} \hfill Default: \cs{bigskipamount}
+% \end{syntax}
+% \meta{|skip|} inserted above a \fn{heading}.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/afterindent} option}
+% \begin{option}[added=2024-11-19]{heading/afterindent}
+% \begin{syntax}
+% heading/afterindent = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Whether to indent the first paragraph following a \fn{heading}. The value
+% of \meta{|boolean|} is optional and assumed to be \val{true} if not
+% present.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/align} option}
+% \begin{option}[added=2024-11-19]{heading/align}
+% \begin{syntax}
+% heading/align = left \textbar\ right \textbar\ center \hfill Default: left
+% \end{syntax}
+% Set the alignment of a \fn{heading}.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/belowskip} option}
+% \begin{option}[added=2024-11-19]{heading/belowskip}
+% \begin{syntax}
+% heading/belowskip = \meta{skip} \hfill Default: \cs{medskipamount}
+% \end{syntax}
+% \meta{|skip|} inserted below a \fn{heading}.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/font} option}
+% \begin{option}[added=2024-11-19]{heading/font}
+% \begin{syntax}
+% heading/font = \meta{font} \hfill Default: \cs{small}\cs{itshape}
+% \end{syntax}
+% \meta{|font|} used for a \fn{heading}.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/format} option}
+% \begin{option}[added=2024-11-19]{heading/format}
+% \begin{syntax}
+% heading/format = \meta{macro} \hfill Default: \#1
+% \end{syntax}
+% \meta{|macro|} used to format a \fn{heading}. |#1| contains the text of
+% the \val{heading}.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/hide} option}
+% \begin{option}[added=2024-11-19]{heading/hide}
+% \begin{syntax}
+% heading/hide = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Whether to hide \fn{heading} functions. The value of \meta{|boolean|} is
+% optional and assumed to be \val{true} if not present. This option is the
+% opposite of \opt{heading/show}.
+% \end{option}
+%
+% \changes{v2.1}{2024/11/19}{Add \opt{heading/show} option}
+% \begin{option}[added=2024-11-19]{heading/show}
+% \begin{syntax}
+% heading/show = \meta{boolean} \hfill Default: true
+% \end{syntax}
+% Whether to show \fn{heading} functions. The value of \meta{|boolean|} is
+% optional and assumed to be \val{true} if not present. This option is the
+% opposite of \opt{heading/hide}.
+% \end{option}
+%
+% \begin{option}{indent}
+% \begin{syntax}
+% indent = \meta{boolean} \hfill Default: true
+% \end{syntax}
+% Whether to indent the first line of a \env{scripture} environment or not
+% by \opt{parindent}. The value of \meta{|boolean|} is optional and assumed
+% to be \val{true} if not present. This option is the opposite of
+% \opt{noindent}.
+% \end{option}
+%
% \changes{v1.3}{2023/01/07}{Add \opt{inline} option}
% \begin{option}[added=2023-01-07]{inline}
% \begin{syntax}
@@ -1413,9 +1814,9 @@
% inline = \meta{boolean} \hfill Default: false
% \end{syntax}
% Set the scripture quotation inline. The quotation is surrounded be the
-% values of \opt{inline/begin} and \opt{inline/end} which default to |``\,|
-% and |\,''|, respectively. This option also sets the \opt{compact} option
-% set sets the \val{reference} inline. The reference format can be
+% values of \opt{inline/begin} and \opt{inline/end} which default to |``|
+% and |''|, respectively. This option also sets the \opt{compact} option and
+% sets the \meta{\val{reference}} inline. The reference format can be
% controlled using the following options:
% \begin{itemize}
% \item \opt{inline/reference/format}
@@ -1423,7 +1824,7 @@
% \item \opt{inline/version/delim}
% \item \opt{inline/version/format}
% \end{itemize}
-% Other \val{reference} and \val{version} options are inherited.
+% Other \meta{\val{reference}} and \meta{\opt{version}} options are inherited.
%
% \textbf{Warning:} \cs{par} is redefined to \cs{relax} when the
% \opt{inline} option is set. If you have anything other than expected
@@ -1434,9 +1835,9 @@
% \changes{v1.3}{2023/01/07}{Add \opt{inline/begin} option}
% \begin{option}[added=2023-01-07]{inline/begin}
% \begin{syntax}
-% inline/begin = \meta{text} \hfill Default: |``\,|
+% inline/begin = \meta{text} \hfill Default: |``|
% \end{syntax}
-% Text inserted at the beginning of \cs{textscripture} or a \env{scripture}
+% Text inserted at the beginning of \fn{textscripture} or a \env{scripture}
% environment with the \opt{inline} option set.
% \end{option}
%
@@ -1443,9 +1844,9 @@
% \changes{v1.3}{2023/01/07}{Add \opt{inline/end} option}
% \begin{option}[added=2023-01-07]{inline/end}
% \begin{syntax}
-% inline/end = \meta{text} \hfill Default: |\,''|
+% inline/end = \meta{text} \hfill Default: |''|
% \end{syntax}
-% Text inserted between the end of \cs{textscripture} or a \env{scripture}
+% Text inserted between the end of \fn{textscripture} or a \env{scripture}
% environment with the \opt{inline} option set and the \meta{|reference|}
% (if specified).
% \end{option}
@@ -1455,9 +1856,9 @@
% \begin{syntax}
% inline/reference/format = \meta{macro} \hfill Default: (\#1)
% \end{syntax}
-% \meta{|macro|} used to format the \val{reference} for an inline
-% \env{scripture} quotation. |#1| contains the text of the \val{reference}
-% and \val{version} (if specified).
+% \meta{|macro|} used to format the \meta{\val{reference}} for an inline
+% \env{scripture} quotation. |#1| contains the text of the
+% \meta{\val{reference}} and \meta{\opt{version}} (if specified).
% \end{option}
%
% \changes{v2.0}{2023/12/27}{Add \opt{inline/reference/sep} option}
@@ -1466,7 +1867,7 @@
% inline/reference/sep = \meta{dimen} \hfill Default: 0.5em
% \end{syntax}
% The \meta{|dimen|} between the end of an inline \env{scripture} quotation
-% and its \val{reference}.
+% and its \meta{\val{reference}}.
% \end{option}
%
% \changes{v2.0}{2023/12/27}{Add \opt{inline/version/delim} option}
@@ -1474,8 +1875,8 @@
% \begin{syntax}
% inline/version/delim = \meta{delim} \hfill Default: \{\ \}
% \end{syntax}
-% \meta{|delim|} to use between the \val{reference} and the \val{version} of
-% an inline \env{scripture} quotation.
+% \meta{|delim|} to use between the \meta{\val{reference}} and the
+% \meta{\opt{version}} of an inline \env{scripture} quotation.
% \end{option}
%
% \changes{v2.0}{2023/12/27}{Add \opt{inline/version/format} option}
@@ -1483,20 +1884,11 @@
% \begin{syntax}
% inline/version/format = \meta{macro} \hfill Default: \#1
% \end{syntax}
-% \meta{|macro|} used to format the \val{version} for an inline
-% \env{scripture} quotation. |#1| contains the text of the \val{version}.
+% \meta{|macro|} used to format the \meta{\opt{version}} for an inline
+% \env{scripture} quotation. |#1| contains the text of the
+% \meta{\opt{version}}.
% \end{option}
%
-% \begin{option}{indent}
-% \begin{syntax}
-% indent = \meta{boolean} \hfill Default: true
-% \end{syntax}
-% Whether to indent the first line of a \env{scripture} environment or not
-% by \opt{parindent}. The value of \meta{|boolean|} is optional and assumed
-% to be \val{true} if not present. This option is the opposite of
-% \opt{noindent}.
-% \end{option}
-%
% \changes{v1.2}{2022/11/02}{Add \opt{language} option}
% \begin{option}[added=2022-11-02]{language}
% \begin{syntax}
@@ -1508,8 +1900,126 @@
% environment. Make sure you have \pkg{babel} or \pkg{polyglossia} loaded
% and correctly set up for your specified language. If unset the current
% active language is used.
+%
+% Right-to-left languages are only supported with \pkg{babel} and Lua\LaTeX.
+% You will need to pass \texttt{bidi=basic, layout=lists} as options to
+% \pkg{babel} to ensure everything is laid out correctly.
% \end{option}
%
+% \begin{scriptureexample}
+% \begingroup
+% \catcode`@=13
+% \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
+% \bgroup\textdir TRT \fi}
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage[bidi=basic, layout=lists]{babel}
+% \babelprovide[import, main]{english}
+% \babelprovide[import, mapdigits]{persian}
+% \babelfont[persian]{rm}[
+% Renderer=Harfbuzz]{Amiri}
+% \usepackage{scripture}
+% \begin{document}
+% \begin{scripture}[اِشعیا 56:1--2][version=NMV,
+% language=persian]
+% @9 at 1\ch{56}@0خداوند چنین میفرماید:@0
+% \begin{poetry}
+% @9»انصاف را نگاه داشته،@0
+% @9عدالت را به عمل آورید،@0
+%
+% @9زیرا نجات من نزدیک شده،@0
+% @9و عدالت من بهزودی منکشف خواهد شد. at 0
+%
+% @9 at 1\vs{2}@0خوشا به حال آن که چنین کند،@0
+% @9و کسی که بدین متمسک گردد؛@0
+%
+% @9که شَبّات را نگاه داشته، آن را بیحرمت نسازد،@0
+% @9و دست خویش از هر عمل بد باز دارد.«@0
+% \end{poetry}
+% \end{scripture}
+% \end{document}
+% \end{verbatim}
+% \endgroup
+%
+% \tcblower
+%
+% \shapemode 2
+% \begin{scripture}[اِشعیا 56:1--2][version=NMV,
+% language=persian]
+% \ch{56}خداوند چنین میفرماید:
+% \begin{poetry}
+% «انصاف را نگاه داشته،
+% عدالت را به عمل آورید،
+%
+% زیرا نجات من نزدیک شده،
+% و عدالت من بهزودی منکشف خواهد شد.
+%
+% \vs{2}خوشا به حال آن که چنین کند،
+% و کسی که بدین متمسک گردد؛
+%
+% که شَبّات را نگاه داشته، آن را بیحرمت نسازد،
+% و دست خویش از هر عمل بد باز دارد.»
+% \end{poetry}
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \textbf{Note} that for CJK scripts the \pkg{scripture} package is compatible
+% with specialist packages like \pkg{luatexja} and \pkg{ctex}. These packages
+% can give nicer kerning and protrusion out of the box. Although with some
+% effort you can set up \pkg{babel} along with \pkg{microtype} to give
+% comparable output.
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage{luatexja}
+% \usepackage{scripture}
+% \begin{document}
+% \begin{scripture}[マルコの福音書 9:33--37][
+% version=NJB]
+% \vs{33}一行はカペナウムに着いた。イエスは家に入ってか
+% ら、弟子たちにお尋ねになった。「来る途中、何を
+% 論じ合っていたのですか。」
+% \vs{34}彼らは黙っていた。来る途中、だれが一番偉いか論
+% じ合っていたからである。
+% \vs{35}イエスは腰を下ろすと、十二人を呼んで言われた。
+% 「だれでも先頭に立ちたいと思う者は、皆の後にな
+% り、皆に仕える者になりなさい。」
+% \vs{36}それから、イエスは一人の子どもの手を取って、彼
+% らの真ん中に立たせ、腕に抱いて彼らに言われた。
+% \vs{37}「だれでも、このような子どもたちの一人を、わた
+% しの名のゆえに受け入れる人は、わたしを受け入れ
+% るのです。また、だれでもわたしを受け入れる人は
+% 、わたしではなく、わたしを遣わされた方を受け入
+% れるのです。」
+% \end{scripture}
+% \end{document}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \enablecjk
+%
+% \begin{scripture}[マルコの福音書 9:33--37][
+% version=NJB]
+% \vs{33}一行はカペナウムに着いた。イエスは家に入ってか
+% ら、弟子たちにお尋ねになった。「来る途中、何を
+% 論じ合っていたのですか。」
+% \vs{34}彼らは黙っていた。来る途中、だれが一番偉いか論
+% じ合っていたからである。
+% \vs{35}イエスは腰を下ろすと、十二人を呼んで言われた。
+% 「だれでも先頭に立ちたいと思う者は、皆の後にな
+% り、皆に仕える者になりなさい。」
+% \vs{36}それから、イエスは一人の子どもの手を取って、彼
+% らの真ん中に立たせ、腕に抱いて彼らに言われた。
+% \vs{37}「だれでも、このような子どもたちの一人を、わた
+% しの名のゆえに受け入れる人は、わたしを受け入れ
+% るのです。また、だれでもわたしを受け入れる人は
+% 、わたしではなく、わたしを遣わされた方を受け入
+% れるのです。」
+% \end{scripture}
+% \end{scriptureexample}
+%
% \changes{v1.2}{2022/11/02}{Add \opt{language/variant} option}
% \begin{option}[added=2022-11-02]{language/variant}
% \begin{syntax}
@@ -1535,7 +2045,7 @@
% \begin{syntax}
% name/font = \meta{font} \hfill Default: \cs{scshape}
% \end{syntax}
-% \meta{|font|} used for the \cs{name} function.
+% \meta{|font|} used for the \fn{name} function.
% \end{option}
%
% \changes{v1.2}{2022/09/01}{Add \opt{name/format} option}
@@ -1543,8 +2053,8 @@
% \begin{syntax}
% name/format = \meta{macro} \hfill Default: \#1
% \end{syntax}
-% \meta{|macro|} used to format the \val{divine name} using the \cs{name}
-% function. |#1| contains the text of the argument to \cs{name}.
+% \meta{|macro|} used to format the \val{divine name} using the \fn{name}
+% function. |#1| contains the text of the argument to \fn{name}.
% \end{option}
%
% \begin{option}{noindent}
@@ -1592,6 +2102,64 @@
% \meta{|skip|} to use between paragraphs in the \env{scripture} environment.
% \end{option}
%
+% \changes{v2.1}{2024/01/18}{Add feature to add pilcrows at the start of
+% paragraphs.}
+% \changes{v2.1}{2024/01/18}{Add \opt{pilcrow} option}
+% \begin{option}[added=2024-01-18]{pilcrow}
+% \begin{syntax}
+% pilcrow = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Whether to insert a pilcrow (\P) at the beginning of each paragraph. This
+% option only has an effect when using the \opt{compact} and/or
+% \opt{verse/para} options. The value of \meta{|boolean|} is optional and
+% assumed to be \val{true} if not present.
+%
+% A subsequent pilcrow can be suppressed with the \fn{nopilcrow} macro.
+% Inner environments start a new paragraph only if there is a blank line
+% before them and similarly, there is only a new paragraph after an inner
+% environment if it is followed by a blank line. New paragraphs are not
+% inserted within a poetry environment, so to obtain a paragraph break
+% within a block of poetry, use two \env{poetry} environments separated by a
+% blank line. The exception to this is the \env{midparachap} environment
+% which always starts and ends a paragraph.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[Deuteronomy 5:1][chapter/para,
+% chapter/format=CHAPTER~#1, verse/para,
+% verse/font=\bfseries, verse/format=#1,
+% verse/sep=0.5em, pilcrow]
+% \ch{5}Moses summoned all Israel and said:
+%
+% Hear, Israel, the decrees and the laws I declare
+% in your hearing today. Learn them and be sure to
+% follow them.
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Deuteronomy 5:1][chapter/para,
+% chapter/format=CHAPTER~#1, verse/para,
+% verse/font=\bfseries, verse/format=#1,
+% verse/sep=0.5em, pilcrow]
+% \ch{5}Moses summoned all Israel and said:
+%
+% Hear, Israel, the decrees and the laws I declare
+% in your hearing today. Learn them and be sure to
+% follow them.
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \changes{v2.1}{2024/01/18}{Add \opt{pilcrow/sep} option}
+% \begin{option}[added=2024-01-18]{pilcrow/sep}
+% \begin{syntax}
+% pilcrow/sep = \meta{dimen} \hfill Default: 0.25em
+% \end{syntax}
+% \meta{|dimen|} used to separate a pilcrow (\P) from the following text.
+% \end{option}
+%
% \changes{v1.2}{2022/08/31}{Add \opt{redletter} option}
% \begin{option}[added=2022-08-31]{redletter}
% \begin{syntax}
@@ -1598,8 +2166,8 @@
% redletter = \meta{boolean} \hfill Default: false
% \end{syntax}
% Whether to enable highlighting of Jesus' words in red. The value of
-% \meta{|boolean|} is option and assumed to be \val{true} if not present.
-% The text needs to be marked up with \cs{redletteron} and \cs{redletteroff}
+% \meta{|boolean|} is optional and assumed to be \val{true} if not present.
+% The text needs to be marked up with \fn{redletteron} and \fn{redletteroff}
% for this option to have any effect.
% \end{option}
%
@@ -1609,8 +2177,8 @@
% redletter/colour = \meta{colour expression} \hfill Default: red!80!black
% \end{syntax}
% The \pkg{l3color} \meta{|colour expression|} to be used for the words of
-% Jesus when the \opt{redletter} option is \val{true}. \cs{redletteron} and
-% \cs{redletteroff} must be used to mark up the text. \opt{redletter/color}
+% Jesus when the \opt{redletter} option is \val{true}. \fn{redletteron} and
+% \fn{redletteroff} must be used to mark up the text. \opt{redletter/color}
% is an alias for \opt{redletter/colour}.
% \end{option}
%
@@ -1637,8 +2205,8 @@
% \begin{syntax}
% reference/font = \meta{font} \hfill Default: \cs{bfseries}
% \end{syntax}
-% \meta{|font|} used when printing the \val{reference} for a \env{scripture}
-% quotation.
+% \meta{|font|} used when printing the \meta{\val{reference}} for a
+% \env{scripture} quotation.
% \end{option}
%
% \begin{option}{reference/format}
@@ -1645,9 +2213,10 @@
% \begin{syntax}
% reference/format = \meta{macro} \hfill Default: \#1
% \end{syntax}
-% \meta{|macro|} used to format the \val{reference} for a \env{scripture}
-% quotation. |#1| contains the text of the \val{reference} and \val{version}
-% (if specified).
+% \meta{|macro|} used to format the \meta{\val{reference}} for a
+% \env{scripture} quotation. |#1| contains the text of the
+% \meta{\val{reference}} and
+% \meta{\opt{version}} (if specified).
% \end{option}
%
% \changes{v1.3}{2023/01/08}{Add \opt{reference/newline} option}
@@ -1655,21 +2224,121 @@
% \begin{syntax}
% reference/newline
% \end{syntax}
-% Always push the \val{reference} to a newline even if there is space for it
-% to fit on the last line of the quotation. The option sets
+% Always push the \meta{\val{reference}} to a newline even if there is space
+% for it to fit on the last line of the quotation. The option sets
% \opt{reference/sep} to \cs{linewidth} so there is never room for the
% reference on the final line of the quotation.
% \end{option}
%
+% \changes{v2.1}{2024/01/10}{Add feature to place the reference at the start
+% of the quotation.}
+% \changes{v2.1}{2024/01/10}{Add \opt{reference/position} option}
+% \begin{option}[added=2024-01-10]{reference/position}
+% \begin{syntax}
+% reference/position = start \textbar\ end \hfill Default: end
+% \end{syntax}
+% Set the position of the reference at either the start or end of the
+% quotation. If \val{start} is specified, then the reference will be set
+% inline unless the quotation begins with an inner environment. Any \fn{vs}
+% or \fn{ch} is suppressed at the start of the quotation in the main
+% \env{scripture} environment.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[John 1:1][version=NIV,
+% reference/position=start]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[John 1:1][version=NIV,
+% reference/position=start]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{scriptureexample}
+%
% \begin{option}{reference/sep}
% \begin{syntax}
% reference/sep = \meta{dimen} \hfill Default: 2em
% \end{syntax}
% The minimum \meta{|dimen|} allowed between the end of a \env{scripture}
-% quotation and its \val{reference} before the \val{reference} is pushed to
-% the following line.
+% quotation and its \meta{\val{reference}} before the \meta{\val{reference}}
+% is pushed to the following line.
% \end{option}
%
+% \changes{v2.1}{2024/01/10}{Add \opt{reference/start/inline} option}
+% \begin{option}[added=2024-01-10]{reference/start/inline}
+% \begin{syntax}
+% reference/start/inline = \meta{boolean} \hfill Default: true
+% \end{syntax}
+% When \opt{reference/position} is set to \val{start}, this option controls
+% whether the reference is set inline or on a line of its own before the
+% quotation. Note that if the quotation begins with an inner environment the
+% reference will always be on a new line unless the \opt{compact} option is
+% also set. The value of \meta{|boolean|} is optional and assumed to be
+% \val{true} if not present. This option is the opposite of
+% \opt{reference/start/newline}.
+% \end{option}
+%
+% \changes{v2.1}{2024/01/10}{Add \opt{reference/start/newline} option}
+% \begin{option}[added=2024-01-10]{reference/start/newline}
+% \begin{syntax}
+% reference/start/newline = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% When \opt{reference/position} is set to \val{start}, this option controls
+% whether the reference is set inline or on a line of its own before the
+% quotation. Note that if the quotation begins with an inner environment the
+% reference will always be on a new line unless the \opt{compact} option is
+% also set. The value of \meta{|boolean|} is optional and assumed to be
+% \val{true} if not present. This option is the opposite of
+% \opt{reference/start/inline}.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[John 1:1]%
+% [reference/position=start,
+% reference/start/newline]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[John 1:1]%
+% [reference/position=start,
+% reference/start/newline]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \changes{v2.1}{2024/01/10}{Add \opt{reference/start/sep} option}
+% \begin{option}[added=2024-01-10]{reference/start/sep}
+% \begin{syntax}
+% reference/start/sep = \meta{dimen} \hfill Default: 1em
+% \end{syntax}
+% The space inserted between the reference and the quotation when
+% \opt{reference/position} is set to \val{start}. This only applies when the
+% reference is inline and not on a line of its own.
+% \end{option}
+%
+% \changes{v2.1}{2024/01/10}{Add \opt{reference/start/vsep} option}
+% \begin{option}[added=2024-01-10]{reference/start/vsep}
+% \begin{syntax}
+% reference/start/vsep = \meta{skip} \hfill Default: 0pt
+% \end{syntax}
+% The vertical skip inserted between the reference and the quotation when
+% \opt{reference/position} is set to \val{start}. This only applies when the
+% reference is on a line of its own.
+% \end{option}
+%
% \begin{option}{rightmargin}
% \begin{syntax}
% rightmargin = \meta{dimen} \hfill Default: 0pt
@@ -1682,7 +2351,7 @@
% \begin{syntax}
% selah/font = \meta{font} \hfill Default: \cs{itshape}
% \end{syntax}
-% \meta{|font|} used when printing \cs{selah} in a \env{poetry} environment.
+% \meta{|font|} used when printing \fn{selah} in a \env{poetry} environment.
% \end{option}
%
% \begin{option}{selah/format}
@@ -1689,7 +2358,7 @@
% \begin{syntax}
% selah/format = \meta{macro} \hfill Default: \#1
% \end{syntax}
-% \meta{|macro|} used to format the \cs{selah} in a \env{poetry}
+% \meta{|macro|} used to format the \fn{selah} in a \env{poetry}
% environment. |#1| contains the value of \opt{selah/text}.
% \end{option}
%
@@ -1705,7 +2374,7 @@
% \begin{syntax}
% selah/text = \meta{text} \hfill Default: Selah
% \end{syntax}
-% \meta{|text|} used to for \cs{selah} in a \env{poetry} environment.
+% \meta{|text|} used to for \fn{selah} in a \env{poetry} environment.
% \end{option}
%
% \changes{v2.0}{2023/12/27}{Add \opt{style} option}
@@ -1713,7 +2382,7 @@
% \begin{syntax}
% style = \meta{name}
% \end{syntax}
-% Set options previously saved with \cs{scripturestyle}. An error occurs if
+% Set options previously saved with \fn{scripturestyle}. An error occurs if
% the style isn't defined.
% \end{option}
%
@@ -1723,7 +2392,7 @@
% textright/sep = \meta{dimen} \hfill Default: 1em
% \end{syntax}
% The minimum \meta{|dimen|} allowed between the end of a line and text
-% aligned to the right with \cs{textright} before the right aligned text is
+% aligned to the right with \fn{textright} before the right aligned text is
% pushed to the following line.
% \end{option}
%
@@ -1745,7 +2414,7 @@
% In prose sections, print the verse number in a different format if it is
% at the start of the paragraph. The format and separation between verse and
% text are controlled with the \opt{verse/firstformat} and
-% \opt{verse/firstsep} options. Use \cs{noversefirst} to suppress this at
+% \opt{verse/firstsep} options. Use \fn{nofirstverse} to suppress this at
% the next verse (e.g., if your quote starts mid-way though a paragraph and
% a normal verse should be printed). The value of \meta{|boolean|} is optional
% and assumed to be true if not present.
@@ -1792,8 +2461,8 @@
% \begin{syntax}
% verse/firstformat = \meta{macro} \hfill Default: \#1
% \end{syntax}
-% \meta{|macro|} used to format the first \cs{vs} in a paragraph. |#1|
-% contains the argument of \cs{vs}. Only used if \opt{verse/first} is
+% \meta{|macro|} used to format the first \fn{vs} in a paragraph. |#1|
+% contains the argument of \fn{vs}. Only used if \opt{verse/first} is
% |true|.
% \end{option}
%
@@ -1802,7 +2471,7 @@
% \begin{syntax}
% verse/firstsep = \meta{dimen} \hfill Default: 0.5em
% \end{syntax}
-% \meta{|dimen|} used to separate the first \cs{vs} in a paragraph from the
+% \meta{|dimen|} used to separate the first \fn{vs} in a paragraph from the
% following text. Only used if \opt{verse/first} is |true|.
% \end{option}
%
@@ -1810,7 +2479,7 @@
% \begin{syntax}
% verse/font = \meta{font} \hfill Default: \emph{Empty}
% \end{syntax}
-% \meta{|font|} used for the \cs{vs} function.
+% \meta{|font|} used for the \fn{vs} function.
% \end{option}
%
% \begin{option}{verse/format}
@@ -1817,8 +2486,8 @@
% \begin{syntax}
% verse/format = \meta{macro} \hfill Default: \cs{textsuperscript}\{\#1\}
% \end{syntax}
-% \meta{|macro|} used to format the \cs{vs} function. |#1| contains the
-% argument of \cs{vs}.
+% \meta{|macro|} used to format the \fn{vs} function. |#1| contains the
+% argument of \fn{vs}.
% \end{option}
%
% \changes{v1.1}{2022/08/15}{Add \opt{verse/hide} option}
@@ -1859,12 +2528,110 @@
% \end{scripture}
% \end{scriptureexample}
%
+% \changes{v2.1}{2024/01/13}{Add feature to set each verse on a new line.}
+% \changes{v2.1}{2024/01/13}{Add \opt{verse/para} option}
+% \begin{option}[added=2024-01-13]{verse/para}
+% \begin{syntax}
+% verse/para = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Whether to set each verse on its own line. The value of \meta{|boolean|}
+% is optional and assumed to be \val{true} if not present. Drop chapters and
+% the shape of inner environments is preserved with this option unless the
+% \opt{compact} option is also set.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[Jonah 1:17--2:2a][verse/para,
+% verse/sep=0.5em, pilcrow, chapter/para,
+% chapter/format=CHAPTER~#1]
+% \begin{midparachap}
+% \vs{17}Now the \name{Lord} provided a huge
+% fish to swallow Jonah, and Jonah was in the
+% belly of the fish three days and three
+% nights. \ch{2}From inside the fish Jonah
+% prayed to the \name{Lord} his God. \vs{2}He
+% said:
+% \end{midparachap}
+%
+% \begin{poetry}
+% `In my distress I called to the \name{Lord},
+% and he answered me.
+% \end{poetry}
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Jonah 1:17--2:2a][verse/para,
+% verse/format=#1, verse/font=\bfseries,
+% verse/sep=0.5em, pilcrow, chapter/para,
+% chapter/format=CHAPTER~#1]
+% \begin{midparachap}
+% \vs{17}Now the \name{Lord} provided a huge
+% fish to swallow Jonah, and Jonah was in the
+% belly of the fish three days and three
+% nights. \ch{2}From inside the fish Jonah
+% prayed to the \name{Lord} his God. \vs{2}He
+% said:
+% \end{midparachap}
+%
+% \begin{poetry}
+% `In my distress I called to the \name{Lord},
+% and he answered me.
+% \end{poetry}
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[Jonah 1:17--2:2a][verse/para,
+% verse/sep=0.5em, pilcrow, chapter/para,
+% chapter/format=CHAPTER~#1, compact]
+% \begin{midparachap}
+% \vs{17}Now the \name{Lord} provided a huge
+% fish to swallow Jonah, and Jonah was in the
+% belly of the fish three days and three
+% nights. \ch{2}From inside the fish Jonah
+% prayed to the \name{Lord} his God. \vs{2}He
+% said:
+% \end{midparachap}
+%
+% \begin{poetry}
+% `In my distress I called to the \name{Lord},
+% and he answered me.
+% \end{poetry}
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Jonah 1:17--2:2a][verse/para,
+% verse/format=#1, verse/font=\bfseries,
+% verse/sep=0.5em, pilcrow, chapter/para,
+% chapter/format=CHAPTER~#1, compact]
+% \begin{midparachap}
+% \vs{17}Now the \name{Lord} provided a huge
+% fish to swallow Jonah, and Jonah was in the
+% belly of the fish three days and three
+% nights. \ch{2}From inside the fish Jonah
+% prayed to the \name{Lord} his God. \vs{2}He
+% said:
+% \end{midparachap}
+%
+% \begin{poetry}
+% `In my distress I called to the \name{Lord},
+% and he answered me.
+% \end{poetry}
+% \end{scripture}
+% \end{scriptureexample}
+%
% \changes{v1.1}{2022/07/28}{Add \opt{verse/sep} option with small default}
% \begin{option}[added=2022-07-28]{verse/sep}
% \begin{syntax}
% verse/sep = \meta{dimen} \hfill Default: 0.05em
% \end{syntax}
-% \meta{|dimen|} used to separate a \cs{vs} from the following text.
+% \meta{|dimen|} used to separate a \fn{vs} from the following text.
% \end{option}
%
% \changes{v1.1}{2022/08/15}{Add \opt{verse/show} option}
@@ -1881,8 +2648,8 @@
% \begin{syntax}
% version = \meta{version} \hfill Default: \emph{Empty}
% \end{syntax}
-% \meta{|version|} added to the \val{reference} for a \env{scripture}
-% quotation.
+% \meta{\opt{version}} added to the \meta{\val{reference}} for a
+% \env{scripture} quotation.
% \end{option}
%
% \begin{option}{version/delim}
@@ -1889,8 +2656,8 @@
% \begin{syntax}
% version/delim = \meta{delim} \hfill Default: \{\ \}
% \end{syntax}
-% \meta{|delim|} to use between the \val{reference} and the \val{version} of a
-% \env{scripture} quotation.
+% \meta{|delim|} to use between the \meta{\val{reference}} and the
+% \meta{\opt{version}} of a \env{scripture} quotation.
% \end{option}
%
% \begin{option}{version/format}
@@ -1897,15 +2664,45 @@
% \begin{syntax}
% version/format = \meta{macro} \hfill Default: (\#1)
% \end{syntax}
-% \meta{|macro|} used to format the \val{version} for a \env{scripture}
-% quotation. |#1| contains the text of the \val{version}.
+% \meta{|macro|} used to format the \meta{\opt{version}} for a
+% \env{scripture} quotation. |#1| contains the text of the
+% \meta{\opt{version}}.
% \end{option}
%
+% \changes{v2.1}{2024/01/10}{Add \opt{version/position} option}
+% \begin{option}[added=2024-01-10]{version/position}
+% \begin{syntax}
+% version/position = withref \textbar\ end \hfill Default: withref
+% \end{syntax}
+% Set the position of the version at either with the reference or at the end
+% of the quotation if \opt{reference/position} is set to \val{start}.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[John 1:1][version=NIV,
+% reference/position=start,
+% version/position=end]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[John 1:1][version=NIV,
+% reference/position=start,
+% version/position=end]
+% \ch{1}In the beginning was the Word, and the
+% Word was with God, and the Word was God.
+% \end{scripture}
+% \end{scriptureexample}
+%
% \subsubsection{Options for the \env{center} environment}
% \label{centeroptions}
%
% If these options are passed directly to the \env{center} environment rather
-% than to the package, \cs{scripturesetup} or the \env{scripture} environment,
+% than to the package, \fn{scripturesetup} or the \env{scripture} environment,
% then the |center/| prefix should be dropped.
%
% \begin{option}{center/aboveskip}
@@ -1940,7 +2737,7 @@
% \label{flushrightoptions}
%
% If these options are passed directly to the \env{flushright} environment rather
-% than to the package, \cs{scripturesetup} or the \env{scripture} environment,
+% than to the package, \fn{scripturesetup} or the \env{scripture} environment,
% then the |flushright/| prefix should be dropped.
%
% \begin{option}{flushright/aboveskip}
@@ -1975,7 +2772,7 @@
% \label{hangingoptions}
%
% If these options are passed directly to the \env{hanging} environment rather
-% than to the package, \cs{scripturesetup} or the \env{scripture} environment,
+% than to the package, \fn{scripturesetup} or the \env{scripture} environment,
% then the |hanging/| prefix should be dropped.
%
% \begin{option}{hanging/aboveskip}
@@ -1992,6 +2789,50 @@
% \meta{|skip|} inserted below the \env{hanging} environment.
% \end{option}
%
+% \changes{v2.1}{2024/12/31}{Add \opt{hanging/chapter/indent} option}
+% \begin{option}[added=2024-12-31]{hanging/chapter/indent}
+% \begin{syntax}
+% hanging/chapter/indent = \meta{boolean} \hfill Default: true
+% \end{syntax}
+% Indent the first line of chapters in \env{hanging} environments. If this
+% is set to \val{false}, then the paragraph will be set has a normal hanging
+% paragraph (if there is room).
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \begin{scripture}[Genesis 1:1--3][%
+% hanging/chapter/indent=false]
+% \begin{hanging}
+% \ch{1}In the beginning God created the heavens
+% and the earth. \vs{2}Now the earth was
+% formless and empty, darkness was over the
+% surface of the deep, and the Spirit of God was
+% hovering over the waters.
+%
+% \vs{3}And God said, ``Let there be light,''
+% and there was light.
+% \end{hanging}
+% \end{scripture}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Genesis 1:1--3][%
+% hanging/chapter/indent=false]
+% \begin{hanging}
+% \ch{1}In the beginning God created the heavens
+% and the earth. \vs{2}Now the earth was
+% formless and empty, darkness was over the
+% surface of the deep, and the Spirit of God was
+% hovering over the waters.
+%
+% \vs{3}And God said, ``Let there be light,''
+% and there was light.
+% \end{hanging}
+% \end{scripture}
+% \end{scriptureexample}
+%
% \begin{option}{hanging/hang}
% \begin{syntax}
% hanging/hang = \meta{dimen} \hfill Default: 2em
@@ -2014,11 +2855,92 @@
% \meta{|dimen|} used for the right margin of the \env{hanging} environment.
% \end{option}
%
+% \changes{v2.1}{2024/12/17}{Add \opt{hanging/verse/left} option}
+% \begin{option}[added=2024-12-17]{hanging/verse/left}
+% \begin{syntax}
+% hanging/verse/left = \meta{boolean} \hfill Default: false
+% \end{syntax}
+% Align verse numbers in \env{hanging} environments at the left margin of
+% the \env{hanging} environment. This is only used for verses at the start
+% of a paragraph. This option is the opposite of \opt{hanging/verse/right}.
+% \end{option}
+%
+% \begin{scriptureexample}
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage{babel}
+% \babelprovide[import, main]{english}
+% \babelprovide[import,
+% onchar=ids fonts]{ancientgreek}
+% \babelfont[ancientgreek]{rm}[
+% BoldFont=NewCM10-Bold]{NewCM10-Regular}
+% \usepackage{scripture}
+% \begin{document}
+% \begin{scripture}[Κατά Μάρκον 1:28--30][
+% hanging/hang=1em, hanging/leftmargin=2em,
+% hanging/verse/left, hanging/verse/sep=1em,
+% language=ancientgreek, verse/sep=0.25em,
+% verse/font=\sffamily\bfseries, version=THGNT]
+% \begin{hanging}
+% \vs{28}Καὶ ἐξῆλθεν ἡ ἀκοὴ αὐτοῦ εὐθὺς πανταχοῦ
+% εἰς ὅλην τὴν περίχωρον τῆς Γαλιλαίας.
+%
+% \vs{29}Καὶ εὐθὺς ἐκ τῆς συναγωγῆς ἐξελθόντες
+% ἦλθον εἰς τὴν οἰκίαν Σίμωνος καὶ Ἀνδρέου μετὰ
+% Ἰακώβου καὶ Ἰωάννου. \vs{30}ἡ δὲ πενθερὰ
+% Σίμωνος κατέκειτο πυρέσσουσα, καὶ εὐθὺς
+% λέγουσιν αὐτῷ περὶ αὐτῆς.
+% \end{hanging}
+% \end{scripture}
+% \end{document}
+% \end{verbatim}
+%
+% \tcblower
+%
+% \begin{scripture}[Κατά Μάρκον 1:28--30][
+% hanging/hang=1em, hanging/leftmargin=2em,
+% hanging/verse/left, hanging/verse/sep=1em,
+% language=ancientgreek, verse/sep=0.25em,
+% verse/font=\sffamily\bfseries, version=THGNT]
+% \begin{hanging}
+% \vs{28}Καὶ ἐξῆλθεν ἡ ἀκοὴ αὐτοῦ εὐθὺς πανταχοῦ
+% εἰς ὅλην τὴν περίχωρον τῆς Γαλιλαίας.
+%
+% \vs{29}Καὶ εὐθὺς ἐκ τῆς συναγωγῆς ἐξελθόντες
+% ἦλθον εἰς τὴν οἰκίαν Σίμωνος καὶ Ἀνδρέου μετὰ
+% Ἰακώβου καὶ Ἰωάννου. \vs{30}ἡ δὲ πενθερὰ
+% Σίμωνος κατέκειτο πυρέσσουσα, καὶ εὐθὺς
+% λέγουσιν αὐτῷ περὶ αὐτῆς.
+% \end{hanging}
+% \end{scripture}
+% \end{scriptureexample}
+%
+% \changes{v2.1}{2024/12/17}{Add \opt{hanging/verse/right} option}
+% \begin{option}[added=2024-12-17]{hanging/verse/right}
+% \begin{syntax}
+% hanging/verse/right = \meta{boolean} \hfill Default: true
+% \end{syntax}
+% Align verse numbers in \env{hanging} environments at the left margin of
+% the \env{hanging} environment. The verse numbers overlap to the left. This
+% is only used for verses at the start of a paragraph. This option is the
+% opposite of \opt{hanging/verse/left}.
+% \end{option}
+%
+% \changes{v2.1}{2024/12/17}{Add \opt{hanging/verse/sep} option}
+% \begin{option}[added=2024-12-17]{hanging/verse/sep}
+% \begin{syntax}
+% hanging/verse/sep = \meta{dimen} \hfill Default: 0.05em
+% \end{syntax}
+% \meta{|dimen|} used to separate a \fn{vs} from the following text in a
+% \env{hanging} environment. This is only used for verses at the start of a
+% paragraph.
+% \end{option}
+%
% \subsubsection{Options for the \env{midparachap} environment}
% \label{midparachapoptions}
%
% If these options are passed directly to the \env{midparachap} environment
-% rather than to the package, \cs{scripturesetup} or the \env{scripture}
+% rather than to the package, \fn{scripturesetup} or the \env{scripture}
% environment, then the |midparachap/| prefix should be dropped.
%
% \begin{option}{midparachap/hideverse}
@@ -2025,10 +2947,9 @@
% \begin{syntax}
% midparachap/hideverse = \meta{boolean} \hfill Default: false
% \end{syntax}
-% Whether a \cs{vs}|{1}| should automatically be inserted after a \cs{ch}
-% when the \cs{ch} occurs mid-paragraph. This also affects \cs{ch} in
-% \env{poetry} environments. \cs{extraskip} begins a new paragraph in a
-% \env{poetry} environment. The value of \meta{|boolean|} is optional and
+% Whether a \fn{vs}|{1}| should automatically be inserted after a \fn{ch}
+% when the \fn{ch} occurs mid-paragraph. This also affects \fn{ch} in
+% \env{poetry} environments. The value of \meta{|boolean|} is optional and
% assumed to be \val{true} if not present. This option is the opposite of
% \opt{midparachap/showverse}. See also \opt{chapter/showverse}.
% \end{option}
@@ -2079,10 +3000,9 @@
% \begin{syntax}
% midparachap/showverse = \meta{boolean} \hfill Default: true
% \end{syntax}
-% Whether a \cs{vs}|{1}| should automatically be inserted after a \cs{ch}
-% when the \cs{ch} occurs mid-paragraph. This also affects \cs{ch} in
-% \env{poetry} environments. \cs{extraskip} begins a new paragraph in a
-% \env{poetry} environment. The value of \meta{|boolean|} is optional and
+% Whether a \fn{vs}|{1}| should automatically be inserted after a \fn{ch}
+% when the \fn{ch} occurs mid-paragraph. This also affects \fn{ch} in
+% \env{poetry} environments. The value of \meta{|boolean|} is optional and
% assumed to be \val{true} if not present. This option is the opposite of
% \opt{midparachap/hideverse}. See also \opt{chapter/showverse}.
% \end{option}
@@ -2091,7 +3011,7 @@
% \label{narrowoptions}
%
% If these options are passed directly to the \env{narrow} environment rather
-% than to the package, \cs{scripturesetup} or the \env{scripture} environment,
+% than to the package, \fn{scripturesetup} or the \env{scripture} environment,
% then the |narrow/| prefix should be dropped.
%
% \begin{option}{narrow/aboveskip}
@@ -2126,7 +3046,7 @@
% \label{poetryoptions}
%
% If these options are passed directly to the \env{poetry} environment rather
-% than to the package, \cs{scripturesetup} or the \env{scripture} environment,
+% than to the package, \fn{scripturesetup} or the \env{scripture} environment,
% then the |poetry/| prefix should be dropped.
%
% \begin{option}{poetry/aboveskip}
@@ -2185,7 +3105,7 @@
%
% \begin{scriptureexample}[lefthand ratio=0.65]
% \begin{verbatim}
-% \begin{scripture}[Atcs 15:15--18]%
+% \begin{scripture}[Acts 15:15--18]%
% [poetry/leftmargin=2em, poetry/verse/left]
% \vs{15}The words of the prophets are in
% agreement with this, as it is written:
@@ -2207,7 +3127,7 @@
%
% \tcblower
%
-% \begin{scripture}[Atcs 15:15--18]%
+% \begin{scripture}[Acts 15:15--18]%
% [poetry/leftmargin=2em, poetry/verse/left]
% \vs{15}The words of the prophets are in
% agreement with this, as it is written:
@@ -2240,9 +3160,9 @@
% \changes{v1.1}{2022/07/31}{Add \opt{poetry/verse/sep} option}
% \begin{option}[added=2022-07-31]{poetry/verse/sep}
% \begin{syntax}
-% poetry/verse/sep = \meta{dimen} \hfill Default: 0.05 em
+% poetry/verse/sep = \meta{dimen} \hfill Default: 0.05em
% \end{syntax}
-% \meta{|dimen|} used to separate a \cs{vs} from the following text in a
+% \meta{|dimen|} used to separate a \fn{vs} from the following text in a
% \env{poetry} environment. This is only used for verses at the start of a
% line.
% \end{option}
@@ -2260,10 +3180,27 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2022-11-01]
-\ProvidesExplPackage{scripture}{2023/12/27}{2.0}
+\ProvidesExplPackage{scripture}{2025/01/02}{2.1}
{Format Scripture Quotations (DCP)}
% \end{macrocode}
%
+% \subsection{Hacks and workarounds}
+%
+% Work around odd interaction between \cs{textdir} and display math. See
+% \url{https://tex.stackexchange.com/q/716621/87678}.
+%
+% \begin{macrocode}
+\bool_new:N \l_@@_textdir_change_in_group_bool
+\cs_new_protected:Nn \@@_set_textdirection:
+ {
+ \sys_if_engine_luatex:T
+ {
+ \textdirection \int_use:N \textdirection
+ \bool_set_true:N \l_@@_textdir_change_in_group_bool
+ }
+ }
+% \end{macrocode}
+%
% \subsection{Messages}
%
% \env{scripture} environments along with all internal environments can not be
@@ -2295,6 +3232,18 @@
have~been~loaded~and~set~up.~Ignoring~option~language=#1. }
% \end{macrocode}
%
+% Error if an \fn{heading} is not used in the main \env{scripture}
+% environment.
+%
+% \begin{macrocode}
+\msg_new:nnnn { scripture } { heading-error }
+ { \token_to_str:N \heading \c_space_tl not~support~within~inner~
+ environments. }
+ { You~have~tried~to~use~\token_to_str:N \heading \c_space_tl within~the~
+ `#1'~environment,~but~this~macro~is~only~supported~in~the~main~
+ `scripture'~environment. }
+% \end{macrocode}
+%
% Error if an unknown \opt{style} is requested.
%
% \begin{macrocode}
@@ -2321,6 +3270,12 @@
, added / format .cs_set:Np = \@@_added_format:n #1
, added / format .value_required:n = true
, added / format .initial:n = \emph { #1 }
+ , after .tl_set:N = \l_@@_after_tl
+ , after .value_required:n = true
+ , after .initial:n =
+ , before .tl_set:N = \l_@@_before_tl
+ , before .value_required:n = true
+ , before .initial:n =
, belowskip .tl_set:N = \l_@@_belowskip_tl
, belowskip .value_required:n = true
, belowskip .initial:n = \c_zero_skip
@@ -2331,6 +3286,26 @@
, compact .bool_set:N = \l_@@_compact_bool
, compact .default:n = true
, compact .initial:n = false
+ , chapter / align .choices:nn = { left, right }
+ {
+ \tl_if_exist:NF \l_@@_chapter_align_tl
+ { \tl_new:N \l_@@_chapter_align_tl }
+ \str_case:Vn \l_keys_choice_tl
+ {
+ { left }
+ {
+ \tl_set:Nn \l_@@_chapter_align_tl
+ { l }
+ }
+ { right }
+ {
+ \tl_set:Nn \l_@@_chapter_align_tl
+ { r }
+ }
+ }
+ }
+ , chapter / align .value_required:n = true
+ , chapter / align .initial:n = left
, chapter / font .tl_set:N = \l_@@_chap_font_tl
, chapter / font .value_required:n = true
, chapter / font .initial:n = \bfseries
@@ -2348,9 +3323,25 @@
, chapter / hide .default:n = true
, chapter / nodrop .bool_set_inverse:N = \l_@@_chap_drop_bool
, chapter / nodrop .default:n = true
+ , chapter / para .bool_set:N = \l_@@_chap_para_bool
+ , chapter / para .default:n = true
+ , chapter / para .initial:n = false
+ , chapter / para / aboveskip .tl_set:N = \l_@@_chap_para_aboveskip_tl
+ , chapter / para / aboveskip .value_required:n = true
+ , chapter / para / aboveskip .initial:n = \bigskipamount
+ , chapter / para / belowskip .tl_set:N = \l_@@_chap_para_belowskip_tl
+ , chapter / para / belowskip .value_required:n = true
+ , chapter / para / belowskip .initial:n = \medskipamount
+ , chapter / para / indent .code:n = {
+ \bool_set:Nn
+ \l_@@_chap_para_afterindent_bool
+ { \str_if_eq_p:nn { #1 } { true } }
+ }
+ , chapter / para / indent .default:n = true
+ , chapter / para / indent .initial:n = true
, chapter / sep .tl_set:N = \l_@@_chap_sep_tl
, chapter / sep .value_required:n = true
- , chapter / sep .initial:n = 0.5 em
+ , chapter / sep .initial:n = 0.5em
, chapter / show .bool_set:N = \l_@@_chap_show_bool
, chapter / show .default:n = true
, chapter / show .initial:n = true
@@ -2357,6 +3348,39 @@
, chapter / showverse .bool_set:N = \l_@@_chap_show_verse_bool
, chapter / showverse .default:n = true
, chapter / showverse .initial:n = false
+ , chapter / smash .bool_set:N = \l_@@_chap_smash_bool
+ , chapter / smash .default:n = true
+ , chapter / smash .initial:n = false
+ , chapter / valign .choices:nn = { bottom, middle, top }
+ {
+ \tl_if_exist:NF \l_@@_chapter_valign_tl
+ { \tl_new:N \l_@@_chapter_valign_tl }
+ \str_case:Vn \l_keys_choice_tl
+ {
+ { bottom }
+ {
+ \tl_set:Nn \l_@@_chapter_valign_tl
+ { b }
+ }
+ { middle }
+ {
+ \tl_set:Nn \l_@@_chapter_valign_tl
+ { vc }
+ }
+ { top }
+ {
+ \tl_set:Nn \l_@@_chapter_valign_tl
+ { t }
+ }
+ }
+ }
+ , chapter / valign .value_required:n = true
+ , chapter / valign .initial:n = bottom
+ , chapter / xchar .tl_set:N = \l_@@_X_char_tl
+ , chapter / xchar .value_required:n = true
+ , chapter / xchar .initial:n = X
+ , defaults .code:n = \cs_if_exist_use:N \@@_setup_reset_defaults:
+ , defaults .value_forbidden:n = true
, extraskip .tl_set:N = \l_@@_extraskip_tl
, extraskip .value_required:n = true
, extraskip .initial:n = \medskipamount
@@ -2363,6 +3387,51 @@
, font .tl_set:N = \l_@@_font_tl
, font .value_required:n = true
, font .initial:n =
+ , heading / aboveskip .tl_set:N = \l_@@_heading_aboveskip_tl
+ , heading / aboveskip .value_required:n = true
+ , heading / aboveskip .initial:n = \bigskipamount
+ , heading / afterindent .bool_set:N = \l_@@_heading_afterindent_bool
+ , heading / afterindent .default:n = true
+ , heading / afterindent .initial:n = false
+ , heading / align .choices:nn = { left, right, center }
+ {
+ \tl_if_exist:NF \l_@@_heading_align_tl
+ { \tl_new:N \l_@@_heading_align_tl }
+ \str_case:Vn \l_keys_choice_tl
+ {
+ { left }
+ {
+ \tl_set:Nn \l_@@_heading_align_tl
+ { \raggedright }
+ }
+ { right }
+ {
+ \tl_set:Nn \l_@@_heading_align_tl
+ { \raggedleft }
+ }
+ { center }
+ {
+ \tl_set:Nn \l_@@_heading_align_tl
+ { \centering }
+ }
+ }
+ }
+ , heading / align .value_required:n = true
+ , heading / align .initial:n = left
+ , heading / belowskip .tl_set:N = \l_@@_heading_belowskip_tl
+ , heading / belowskip .value_required:n = true
+ , heading / belowskip .initial:n = \medskipamount
+ , heading / font .tl_set:N = \l_@@_heading_font_tl
+ , heading / font .value_required:n = true
+ , heading / font .initial:n = \small\itshape
+ , heading / format .cs_set:Np = \@@_heading_format:n #1
+ , heading / format .value_required:n = true
+ , heading / format .initial:n = #1
+ , heading / hide .bool_set_inverse:N = \l_@@_heading_show_bool
+ , heading / hide .default:n = true
+ , heading / show .bool_set:N = \l_@@_heading_show_bool
+ , heading / show .default:n = true
+ , heading / show .initial:n = true
, indent .bool_set:N = \l_@@_indent_bool
, indent .default:n = true
, indent .initial:n = true
@@ -2371,16 +3440,16 @@
, inline .initial:n = false
, inline / begin .tl_set:N = \l_@@_inline_begin_tl
, inline / begin .value_required:n = true
- , inline / begin .initial:n = ``\,
+ , inline / begin .initial:n = ``
, inline / end .tl_set:N = \l_@@_inline_end_tl
, inline / end .value_required:n = true
- , inline / end .initial:n = \,''
+ , inline / end .initial:n = ''
, inline / reference / format .cs_set:Np = \@@_inline_ref_format:n #1
, inline / reference / format .value_required:n = true
, inline / reference / format .initial:n = (#1)
, inline / reference / sep .tl_set:N = \l_@@_inline_ref_sep_tl
, inline / reference / sep .value_required:n = true
- , inline / reference / sep .initial:n = 0.5 em
+ , inline / reference / sep .initial:n = 0.5em
, inline / version / delim .tl_set:N = \l_@@_inline_version_delim_tl
, inline / version / delim .value_required:n = true
, inline / version / delim .initial:n = \c_space_tl
@@ -2410,6 +3479,12 @@
, parskip .tl_set:N = \l_@@_parskip_tl
, parskip .value_required:n = true
, parskip .initial:n = \parskip
+ , pilcrow .bool_set:N = \l_@@_pilcrow_bool
+ , pilcrow .default:n = true
+ , pilcrow .initial:n = false
+ , pilcrow / sep .tl_set:N = \l_@@_pilcrow_sep_tl
+ , pilcrow / sep .value_required:n = true
+ , pilcrow / sep .initial:n = 0.25em
, redletter .bool_set:N = \l_@@_red_letter_bool
, redletter .default:n = true
, redletter .initial:n = false
@@ -2437,9 +3512,28 @@
, reference / format .initial:n = #1
, reference / newline .meta:n = { reference / sep = \linewidth }
, reference / newline .value_forbidden:n = true
+ , reference / position .choices:nn = { start, end }
+ {
+ \tl_if_exist:NF \l_@@_ref_position_tl
+ { \tl_new:N \l_@@_ref_position_tl }
+ \tl_set_eq:NN \l_@@_ref_position_tl \l_keys_choice_tl
+ }
+ , reference / position .value_required:n = true
+ , reference / position .initial:n = end
, reference / sep .tl_set:N = \l_@@_ref_sep_tl
, reference / sep .value_required:n = true
- , reference / sep .initial:n = 2 em
+ , reference / sep .initial:n = 2em
+ , reference / start / inline .bool_set_inverse:N = \l_@@_ref_start_newline_bool
+ , reference / start / inline .default:n = true
+ , reference / start / newline .bool_set:N = \l_@@_ref_start_newline_bool
+ , reference / start / newline .default:n = true
+ , reference / start / newline .initial:n = false
+ , reference / start / sep .tl_set:N = \l_@@_ref_start_sep_tl
+ , reference / start / sep .value_required:n = true
+ , reference / start / sep .initial:n = 1em
+ , reference / start / vsep .tl_set:N = \l_@@_ref_vertical_sep_tl
+ , reference / start / vsep .value_required:n = true
+ , reference / start / vsep .initial:n = 0pt
, rightmargin .tl_set:N = \l_@@_rightmargin_tl
, rightmargin .value_required:n = true
, rightmargin .initial:n = \c_zero_dim
@@ -2454,7 +3548,7 @@
, selah / format .initial:n = #1
, selah / sep .tl_set:N = \l_@@_selah_sep_tl
, selah / sep .value_required:n = true
- , selah / sep .initial:n = 1 em
+ , selah / sep .initial:n = 1em
, style .choice:
, style / unknown .code:n = \msg_error:nnx
{ scripture }
@@ -2462,7 +3556,7 @@
{ \exp_not:n {#1} }
, textright / sep .tl_set:N = \l_@@_text_right_sep_tl
, textright / sep .value_required:n = true
- , textright / sep .initial:n = 1 em
+ , textright / sep .initial:n = 1em
, verse / colour .tl_set:N = \l_@@_verse_colour_tl
, verse / colour .value_required:n = true
, verse / colour .initial:n = .
@@ -2484,9 +3578,15 @@
, verse / format .initial:n = \textsuperscript{#1}
, verse / hide .bool_set_inverse:N = \l_@@_verse_show_bool
, verse / hide .default:n = true
+ , verse / para .bool_set:N = \l_@@_verse_para_bool
+ , verse / para .default:n = true
+ , verse / para .initial:n = false
+ , verse / para / indent .tl_set:N = \l_@@_para_indent_tl
+ , verse / para / indent .value_required:n = true
+ , verse / para / indent .initial:n = \l_@@_parindent_tl
, verse / sep .tl_set:N = \l_@@_verse_sep_tl
, verse / sep .value_required:n = true
- , verse / sep .initial:n = 0.05 em
+ , verse / sep .initial:n = 0.05em
, verse / show .bool_set:N = \l_@@_verse_show_bool
, verse / show .default:n = true
, verse / show .initial:n = true
@@ -2499,6 +3599,14 @@
, version / format .cs_set:Np = \@@_version_format:n #1
, version / format .value_required:n = true
, version / format .initial:n = (#1)
+ , version / position .choices:nn = { withref, end }
+ {
+ \tl_if_exist:NF \l_@@_version_position_tl
+ { \tl_new:N \l_@@_version_position_tl }
+ \tl_set_eq:NN \l_@@_version_position_tl \l_keys_choice_tl
+ }
+ , version / position .value_required:n = true
+ , version / position .initial:n = withref
% \end{macrocode}
% Options for the \env{center} environment.
% \begin{macrocode}
@@ -2538,15 +3646,26 @@
, hanging / belowskip .tl_set:N = \l_@@_hanging_belowskip_tl
, hanging / belowskip .value_required:n = true
, hanging / belowskip .initial:n = \medskipamount
+ , hanging / chapter / indent .bool_set:N = \l_@@_hanging_chapter_indent_bool
+ , hanging / chapter / indent .default:n = true
+ , hanging / chapter / indent .initial:n = true
, hanging / hang .tl_set:N = \l_@@_hanging_hang_tl
, hanging / hang .value_required:n = true
- , hanging / hang .initial:n = 2 em
+ , hanging / hang .initial:n = 2em
, hanging / leftmargin .tl_set:N = \l_@@_hanging_leftmargin_tl
, hanging / leftmargin .value_required:n = true
- , hanging / leftmargin .initial:n = 1 em
+ , hanging / leftmargin .initial:n = 1em
, hanging / rightmargin .tl_set:N = \l_@@_hanging_rightmargin_tl
, hanging / rightmargin .value_required:n = true
, hanging / rightmargin .initial:n = \c_zero_dim
+ , hanging / verse / left .bool_set_inverse:N = \l_@@_hanging_verse_right_bool
+ , hanging / verse / left .default:n = true
+ , hanging / verse / right .bool_set:N = \l_@@_hanging_verse_right_bool
+ , hanging / verse / right .default:n = true
+ , hanging / verse / right .initial:n = true
+ , hanging / verse / sep .tl_set:N = \l_@@_hanging_verse_sep_tl
+ , hanging / verse / sep .value_required:n = true
+ , hanging / verse / sep .initial:n = 0.05em
% \end{macrocode}
% Options for the mid-paragraph chapters (including the \env{midparachap} environment).
% \begin{macrocode}
@@ -2566,10 +3685,10 @@
, narrow / belowskip .initial:n = \medskipamount
, narrow / leftmargin .tl_set:N = \l_@@_narrow_leftmargin_tl
, narrow / leftmargin .value_required:n = true
- , narrow / leftmargin .initial:n = 1 em
+ , narrow / leftmargin .initial:n = 1em
, narrow / rightmargin .tl_set:N = \l_@@_narrow_rightmargin_tl
, narrow / rightmargin .value_required:n = true
- , narrow / rightmargin .initial:n = 1 em
+ , narrow / rightmargin .initial:n = 1em
% \end{macrocode}
% Options for the \env{poetry} environment.
% \begin{macrocode}
@@ -2581,13 +3700,13 @@
, poetry / belowskip .initial:n = \medskipamount
, poetry / bigindent .tl_set:N = \l_@@_poetry_big_indent_tl
, poetry / bigindent .value_required:n = true
- , poetry / bigindent .initial:n = 4 em
+ , poetry / bigindent .initial:n = 4em
, poetry / indent .tl_set:N = \l_@@_poetry_indent_tl
, poetry / indent .value_required:n = true
- , poetry / indent .initial:n = 1 em
+ , poetry / indent .initial:n = 1em
, poetry / leftmargin .tl_set:N = \l_@@_poetry_leftmargin_tl
, poetry / leftmargin .value_required:n = true
- , poetry / leftmargin .initial:n = 1 em
+ , poetry / leftmargin .initial:n = 1em
, poetry / rightmargin .tl_set:N = \l_@@_poetry_rightmargin_tl
, poetry / rightmargin .value_required:n = true
, poetry / rightmargin .initial:n = \c_zero_dim
@@ -2598,7 +3717,7 @@
, poetry / verse / right .initial:n = true
, poetry / verse / sep .tl_set:N = \l_@@_poetry_verse_sep_tl
, poetry / verse / sep .value_required:n = true
- , poetry / verse / sep .initial:n = 0.05 em
+ , poetry / verse / sep .initial:n = 0.05em
}
% \end{macrocode}
% Process package options.
@@ -2606,6 +3725,128 @@
\ProcessKeyOptions
% \end{macrocode}
%
+% Create interface to reset all keys to defaults.
+% \begin{macrocode}
+\tl_new:N \l_@@_default_options_tl
+\keys_precompile:nnN { scripture }
+ {
+ , aboveskip = \c_zero_skip
+ , added / font =
+ , added / format = \emph { #1 }
+ , after =
+ , before =
+ , belowskip = \c_zero_skip
+ , colour = .
+ , compact = false
+ , chapter / align = left
+ , chapter / font = \bfseries
+ , chapter / colour = .
+ , chapter / drop = true
+ , chapter / format = #1
+ , chapter / para = false
+ , chapter / para / aboveskip = \bigskipamount
+ , chapter / para / belowskip = \medskipamount
+ , chapter / para / indent = true
+ , chapter / sep = 0.5em
+ , chapter / show = true
+ , chapter / showverse = false
+ , chapter / smash = false
+ , chapter / valign = bottom
+ , chapter / xchar = X
+ , extraskip = \medskipamount
+ , font =
+ , heading / aboveskip = \bigskipamount
+ , heading / afterindent = false
+ , heading / align = left
+ , heading / belowskip = \medskipamount
+ , heading / font = \small\itshape
+ , heading / format = #1
+ , heading / show = true
+ , indent = true
+ , inline = false
+ , inline / begin = ``
+ , inline / end = ''
+ , inline / reference / format = (#1)
+ , inline / reference / sep = 0.5em
+ , inline / version / delim = \c_space_tl
+ , inline / version / format = #1
+ , language =
+ , language / variant =
+ , leftmargin = \c_zero_dim
+ , name / font = \scshape
+ , name / format = #1
+ , parindent = \parindent
+ , parskip = \parskip
+ , pilcrow = false
+ , pilcrow / sep = 0.25em
+ , redletter = false
+ , redletter / colour = red!80!black
+ , reference / align = right
+ , reference / colour = .
+ , reference / font = \bfseries
+ , reference / format = #1
+ , reference / position = end
+ , reference / sep = 2em
+ , reference / start / newline = false
+ , reference / start / sep = 1em
+ , reference / start / vsep = 0pt
+ , rightmargin = \c_zero_dim
+ , selah / text = Selah
+ , selah / font = \itshape
+ , selah / format = #1
+ , selah / sep = 1em
+ , textright / sep = 1em
+ , verse / colour = .
+ , verse / first = false
+ , verse / firstformat = #1
+ , verse / firstsep = 0.5em
+ , verse / font =
+ , verse / format = \textsuperscript{#1}
+ , verse / para = false
+ , verse / para / indent = \l_@@_parindent_tl
+ , verse / sep = 0.05em
+ , verse / show = true
+ , version =
+ , version / delim = \c_space_tl
+ , version / format = (#1)
+ , version / position = withref
+ , center / aboveskip = \medskipamount
+ , center / belowskip = \medskipamount
+ , center / leftmargin = \c_zero_dim
+ , center / rightmargin = \c_zero_dim
+ , flushright / aboveskip = \medskipamount
+ , flushright / belowskip = \medskipamount
+ , flushright / leftmargin = \c_zero_dim
+ , flushright / rightmargin = \c_zero_dim
+ , hanging / aboveskip = \medskipamount
+ , hanging / belowskip = \medskipamount
+ , hanging / chapter / indent = true
+ , hanging / hang = 2em
+ , hanging / leftmargin = 1em
+ , hanging / rightmargin = \c_zero_dim
+ , hanging / verse / right = true
+ , hanging / verse / sep = 0.05em
+ , midparachap / showverse = true
+ , narrow / aboveskip = \medskipamount
+ , narrow / belowskip = \medskipamount
+ , narrow / leftmargin = 1em
+ , narrow / rightmargin = 1em
+ , poetry / aboveskip = \medskipamount
+ , poetry / belowskip = \medskipamount
+ , poetry / bigindent = 4em
+ , poetry / indent = 1em
+ , poetry / leftmargin = 1em
+ , poetry / rightmargin = \c_zero_dim
+ , poetry / verse / right = true
+ , poetry / verse / sep = 0.05em
+ }
+ \l_@@_default_options_tl
+\cs_new_protected:Nn \@@_setup_reset_defaults:
+ {
+ \l_@@_default_options_tl
+ }
+% \end{macrocode}
+%
% \begin{macro}{\@@_setup_style:nnn}
% Specify options which can later be activated using the \opt{style} option.
% If the first argument is \val{true}, then the options are appended rather
@@ -2635,8 +3876,8 @@
% \begin{hooks}{scripture/chap/before, scripture/chap/after,
% scripture/verse/before, scripture/verse/after}
% Hooks for before and after chapters and verses. The current chapter and
-% verse is available in the hooks as \cs{scripturecurrentchapter} and
-% \cs{scripturecurrentverse} respectively. These are global.
+% verse is available in the hooks as \fn{scripturecurrentchapter} and
+% \fn{scripturecurrentverse} respectively. These are global.
% \begin{macrocode}
\hook_new_pair:nn { scripture / chap / before } { scripture / chap / after }
\hook_new_pair:nn { scripture / verse / before } { scripture / verse / after }
@@ -2643,6 +3884,17 @@
% \end{macrocode}
% \end{hooks}
%
+% \begin{hooks}{scripture/pilcrow, scripture/poetry/pilcrow}
+% These are internal hooks used to insert a pilcrow at the beginning of a
+% paragraph. Pilcrows are activated using the \opt{pilcrow} option and are
+% only in effect when the \opt{verse/para} and/or \opt{compact} options are in
+% use.
+% \begin{macrocode}
+\hook_new:n { scripture / pilcrow }
+\hook_new:n { scripture / poetry / pilcrow }
+% \end{macrocode}
+% \end{hooks}
+%
% \subsection{The main \env{scripture} environment}
%
% \begin{macro}{\l_@@_active_bool, \l_@@_active_inner_bool}
@@ -2653,6 +3905,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\g_@@_mode_vertical_inner_bool}
+% Whether an inner environment is starting in vertical mode. This flag is
+% only used with the \opt{compact} and \opt{verse/para} options.
+% \begin{macrocode}
+\bool_new:N \g_@@_mode_vertical_inner_bool
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\l_@@_clubpenalty_saved_int}
% Holds saved club penalty so we can change and restore it around chapter
% breaks.
@@ -2686,15 +3946,33 @@
% \begin{macrocode}
\cs_new_protected_nopar:Nn \@@_setup_list_noindent:n
{
- \legacy_if:nT {@newlist}
+ \legacy_if:nT { @newlist }
{
\cs_set_protected_nopar:Npn \noindent
{
\skip_horizontal:n { -#1 }
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \peek_meaning:NTF \vs
+ {
+ \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+ \@@_set_pilcrow_hook:
+ }
+ {
+ \str_if_eq:VnF \l_@@_currenvir_str { poetry }
+ { \@@_pilcrow_output: }
+ }
+ }
}
\hook_gput_next_code:nn { para / end }
{
- \cs_gset_eq:NN \noindent \tex_noindent:D
+ \bool_if:NTF \l_@@_verse_para_bool
+ {
+ \str_if_eq:VnTF \l_@@_currenvir_str { poetry }
+ { \cs_set_eq:NN \noindent \tex_noindent:D }
+ { \cs_set_eq:NN \noindent \@@_para_noindent: }
+ }
+ { \cs_set_eq:NN \noindent \tex_noindent:D }
}
}
}
@@ -2722,12 +4000,13 @@
% \begin{macro}{\@@_extra_skip:}
% Insert a little extra vertical space between two paragraphs. This function
% tests if the previous paragraph is only one line in length and began
-% with a \cs{ch} function. If this condition is met, more space is added
+% with a \fn{ch} function. If this condition is met, more space is added
% if necessary to avoid the following paragraph clashing with the drop
% chapter.
% \begin{macrocode}
\cs_new_protected:Nn \@@_extra_skip:
{
+ \mode_if_vertical:F \para_end:
\int_compare:nNnT
\g_@@_chap_par_prevgraf_int = 1
{
@@ -2788,10 +4067,10 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_format_full_ref:n}
+% \begin{macro}{\@@_format_full_ref:nn}
% Format a scripture quotation with its reference.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_format_full_ref:n
+\cs_new_protected:Nn \@@_format_full_ref:nn
{
\group_begin:
\l_@@_ref_font_tl
@@ -2803,11 +4082,11 @@
% \end{macrocode}
% Append a Bible version if it has been specified.
% \begin{macrocode}
- \tl_if_empty:NF \l_@@_version_tl
+ \tl_if_empty:oF { #2 }
{
- \tl_if_empty:nF { #1 }
+ \tl_if_empty:oF { #1 }
{ \l_@@_version_delim_tl }
- \@@_version_format:n { \l_@@_version_tl }
+ \@@_version_format:n { #2 }
}
}
\group_end:
@@ -2822,7 +4101,7 @@
{
\hbox_set:Nn \l_@@_ref_box
{
- \@@_format_full_ref:n { #1 }
+ \@@_format_full_ref:nn { #1 } \l_@@_version_tl
}
\dim_compare:nNnT
{ \box_wd:N \l_@@_ref_box + \g_@@_final_line_dim + \l_@@_ref_sep_tl }
@@ -2850,6 +4129,404 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_reference_start_inline:}
+% Output the reference for the Scripture quotation when inline at the start.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_reference_start_inline:
+ {
+ \tl_if_empty:NF \l_@@_ref_tl
+ {
+ \tl_if_eq:NnTF \l_@@_version_position_tl { withref }
+ { \@@_format_full_ref:nn { \l_@@_ref_tl } { \l_@@_version_tl } }
+ { \@@_format_full_ref:nn { \l_@@_ref_tl } { } }
+ \skip_horizontal:N \l_@@_ref_start_sep_tl
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_reference_start_newline:}
+% Output the reference for the Scripture quotation when on a new line at the
+% start.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_reference_start_newline:
+ {
+ \tl_if_empty:NF \l_@@_ref_tl
+ {
+ \bool_gset_eq:NN \g_tmpa_bool \g_@@_suppress_next_pilcrow_bool
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \noindent
+ \bool_gset_eq:NN \g_@@_suppress_next_pilcrow_bool \g_tmpa_bool
+ \str_if_eq:VnF \l_@@_currenvir_str { scripture }
+ { \skip_horizontal:n { -\leftmargin } }
+ \tl_if_eq:NnTF \l_@@_version_position_tl { withref }
+ { \@@_format_full_ref:nn { \l_@@_ref_tl } { \l_@@_version_tl } }
+ { \@@_format_full_ref:nn { \l_@@_ref_tl } { } }
+ \bool_lazy_or:nnT
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { flushright } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { center } }
+ {
+ \hfill
+ \strut
+ }
+ \bool_if:NTF \l_@@_compact_bool
+ { \para_end: }
+ {
+ \bool_lazy_all:nTF
+ {
+ { \l_@@_verse_para_bool }
+ { \bool_not_p:n { \str_if_eq_p:Vn \l_@@_currenvir_str { hanging } } }
+ { \bool_not_p:n { \str_if_eq_p:Vn \l_@@_currenvir_str { poetry } } }
+ }
+ { \para_end: }
+ { \par }
+ }
+ \nobreak
+ \@afterheading
+ \addvspace { \l_@@_ref_vertical_sep_tl }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_reference_start_peek:}
+% Peek ahead at the beginning of the \env{scripture} environment to control
+% how references are inserted at the start of a quotation.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_reference_start_peek:
+ {
+ \peek_remove_spaces:n
+ {
+ \bool_lazy_and:nnTF
+ { \str_if_eq_p:Vn \l_@@_ref_position_tl { start } }
+ { \bool_not_p:n { \tl_if_empty_p:N \l_@@_ref_tl } }
+ {
+ \bool_lazy_or:nnF
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } }
+ {
+ \bool_if:NF \l_@@_compact_bool
+ { \bool_set_true:N \l_@@_ref_start_newline_bool }
+ }
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:nF
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \heading }
+ { \@@_reference_start_newline: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \noindent }
+ {
+ \bool_if:NTF \l_@@_ref_start_newline_bool
+ { \@@_reference_start_newline: }
+ { \@@_reference_start_inline: }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nohang }
+ {
+ \bool_if:NTF \l_@@_ref_start_newline_bool
+ { \@@_reference_start_newline: }
+ { \@@_reference_start_inline: }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nopilcrow }
+ {
+ \bool_if:NTF \l_@@_ref_start_newline_bool
+ { \@@_reference_start_newline: }
+ { \@@_reference_start_inline: }
+ \peek_analysis_map_break:n
+ {
+ ##1
+ \@@_fix_protrusion:n { }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \begin }
+ {
+ \bool_if:NF \l_@@_indent_bool
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \bool_lazy_or:nnT
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } }
+ { \para_omit_indent: }
+ }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
+ {
+ \bool_if:NTF \l_@@_ref_start_newline_bool
+ { \@@_reference_start_newline: }
+ {
+ \cs_set_eq:NN \@@_temp_ch \ch
+ \RenewDocumentCommand \ch { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l_@@_X_char_tl { ##2 }
+ }
+ \cs_set_eq:NN \ch \@@_temp_ch
+ }
+ \@@_reference_start_inline:
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ {
+ \bool_if:NTF \l_@@_ref_start_newline_bool
+ { \@@_reference_start_newline: }
+ {
+ \cs_set_eq:NN \@@_temp_vs \vs
+ \RenewDocumentCommand \vs { m }
+ { \cs_set_eq:NN \vs \@@_temp_vs }
+ \@@_reference_start_inline:
+ }
+ }
+ }
+ {
+ \bool_if:NTF \l_@@_ref_start_newline_bool
+ {
+ \@@_reference_start_newline:
+ \bool_if:NTF \l_@@_compact_bool
+ {
+ \bool_if:NT \g_@@_mode_vertical_inner_bool
+ { \@@_pilcrow_output: }
+ }
+ {
+ \str_if_eq:VnF \l_@@_currenvir_str { poetry }
+ { \@@_pilcrow_output: }
+ }
+ }
+ { \@@_reference_start_inline: }
+ }
+ \exp_args:No \token_if_eq_meaning:NNF { ##1 } \begin
+ {
+ \tl_clear:N \l_@@_ref_tl
+ \tl_if_eq:NnF \l_@@_version_position_tl { end }
+ { \tl_clear:N \l_@@_version_tl }
+ }
+ \peek_analysis_map_break:n
+ { \@@_fix_protrusion:o { ##1 } }
+ }
+ }
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:nF
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \heading }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \noindent }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nohang }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nopilcrow }
+ {
+ \peek_analysis_map_break:n
+ {
+ ##1
+ \@@_fix_protrusion:n { }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \begin }
+ {
+ \bool_if:NF \l_@@_indent_bool
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \bool_lazy_or:nnT
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } }
+ { \para_omit_indent: }
+ }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ {
+ \mode_if_vertical:F
+ { \@@_set_pilcrow_hook: }
+ }
+ }
+ {
+ \bool_if:NTF \l_@@_compact_bool
+ {
+ \bool_if:NT \g_@@_mode_vertical_inner_bool
+ { \@@_pilcrow_output: }
+ }
+ {
+ \str_if_eq:VnF \l_@@_currenvir_str { poetry }
+ { \@@_pilcrow_output: }
+ }
+ }
+ \peek_analysis_map_break:n
+ {
+ \@@_fix_protrusion:o { ##1 }
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_compact_par:}
+% \cs{par} macro used when the \opt{compact} option is in use.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_compact_par:
+ {
+ \bool_gset_false:N \g_@@_mode_vertical_inner_bool
+ \dim_set:Nn \parindent { \l_@@_parindent_tl }
+ \peek_remove_spaces:n
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:n
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \begin }
+ { \bool_gset_true:N \g_@@_mode_vertical_inner_bool }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { poetry } }
+ { }
+ { \exp_args:No \token_if_letter_p:N { ##1 } }
+ { \@@_pilcrow_output: }
+ { \exp_args:No \token_if_active_p:N { ##1 } }
+ { \@@_pilcrow_output: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ { \@@_set_pilcrow_hook: }
+ }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_para_noindent:}
+% \cs{noindent} macro used when the \opt{verse/para} option is in use.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_para_noindent:
+ {
+ \legacy_if:nTF { @newlist }
+ {
+ \tex_noindent:D
+ \peek_meaning:NTF \vs
+ {
+ \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+ \@@_set_pilcrow_hook:
+ }
+ { \@@_pilcrow_output: }
+ }
+ {
+ \peek_meaning:NTF \vs
+ {
+ \bool_if:NT \l_@@_verse_para_bool
+ { \para_end: }
+ \tex_noindent:D
+ \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+ \@@_set_pilcrow_hook:
+ }
+ { \@@_pilcrow_output: }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\g_@@_para_mode_vertical_bool}
+% Flag that \cs{@@_para_par:} has been encountered and pilcrow not yet
+% printed.
+% \begin{macrocode}
+\bool_new:N \g_@@_para_mode_vertical_bool
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\g_@@_post_env_indent_box}
+% Box to store the indent after an inner environment in the case where it is
+% dropped by \cs{@@_dopeend:}. This box is then inserted if the next thing
+% is a \fn{vs}. Only used when the \opt{verse/para} option is active.
+% \begin{macrocode}
+\box_new:N \g_@@_post_env_indent_box
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_para_par:}
+% \cs{par} macro used when the \opt{verse/para} option is in use.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_para_par:
+ {
+ \bool_gset_true:N \g_@@_para_mode_vertical_bool
+ \dim_set:Nn \parindent { \l_@@_parindent_tl }
+ \peek_remove_spaces:n
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:n
+ {
+ { \exp_args:No \token_if_letter_p:N { ##1 } }
+ { \@@_pilcrow_output: }
+ { \exp_args:No \token_if_active_p:N { ##1 } }
+ { \@@_pilcrow_output: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ { \@@_set_pilcrow_hook: }
+ }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_doendpe:}
+% Custom version of \cs{@doendpe} macro used when the \opt{verse/para}
+% option is in use. This handles pilcrows after inner environments.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_doendpe:
+ {
+ \box_gclear:N \g_@@_post_env_indent_box
+ \legacy_if_set_true:n { @endpe }
+ \cs_set_nopar:Npn \par
+ {
+ \@restorepar
+ \clubpenalty \@clubpenalty
+ \everypar { }
+ \par
+ \legacy_if_set_false:n { @endpe }
+ \bool_gset_false:N \g_@@_suppress_next_pilcrow_bool
+ \@@_para_par:
+ }
+ \everypar
+ {
+ \box_gset_to_last:N \g_@@_post_env_indent_box
+ \hook_gput_next_code:nn { para / after }
+ { \box_gclear:N \g_@@_post_env_indent_box }
+ \everypar { }
+ \legacy_if_set_false:n { @endpe }
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \box_set_wd:Nn
+ \g_@@_post_env_indent_box
+ { \l_@@_para_indent_tl }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fix_protrusion:n, \@@_fix_protrusion:o}
+% The use of \cs{peek} macros breaks protrusion at the beginning of list
+% environments. This function checks conditions and add \cs{leftprotrusion}.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_fix_protrusion:n
+ {
+ \bool_if:NTF \l_@@_compact_bool
+ {
+ \str_if_eq:VnT \l_@@_currenvir_str { scripture }
+ { \cs_if_exist_use:N \leftprotrusion }
+ }
+ { \cs_if_exist_use:N \leftprotrusion }
+ #1
+ }
+\cs_generate_variant:Nn \@@_fix_protrusion:n { o }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Red lettering}
%
% \begin{macro}{\g_@@_red_letter_active_bool}
@@ -2912,6 +4589,7 @@
{
\@ifpackageloaded { babel }
{
+ \@@_set_textdirection:
\selectlanguage { \l_@@_language_tl }
}
{
@@ -2972,10 +4650,10 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\l_@@_chap_width_dim}
+% \begin{macro}{\g_@@_chap_width_dim}
% Calculated width of drop chapter number.
% \begin{macrocode}
-\dim_new:N \l_@@_chap_width_dim
+\dim_new:N \g_@@_chap_width_dim
% \end{macrocode}
% \end{macro}
%
@@ -2994,6 +4672,40 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\l_@@_para_chap_indent_dim}
+% Indent used to center chapters when placed in their own paragraph.
+% \begin{macrocode}
+\dim_new:N \l_@@_para_chap_indent_dim
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l_@@_nodrop_chap_coffin}
+% Coffin to place non-drop chapters inside.
+% \begin{macrocode}
+\coffin_new:N \l_@@_nodrop_chap_coffin
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\l_@@_nodrop_chap_voffset_dim}
+% Vertical offset to use when setting non-drop chapters.
+% \begin{macrocode}
+\dim_new:N \l_@@_nodrop_chap_voffset_dim
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_get_X_height:}
+% Calculate the height of \cs{l_@@_X_char_tl} for vertical alignment of
+% non-drop chapters.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_get_X_height:
+ {
+ \hbox_set:Nn \l_@@_chap_tmp_box { \l_@@_X_char_tl }
+ \dim_set:Nn \l_@@_chap_X_height_dim
+ { \box_ht:N \l_@@_chap_tmp_box }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_drop_chap_set_up:n}
% Set up chapter drop cap and calculate its various dimensions.
% \begin{macrocode}
@@ -3001,9 +4713,7 @@
{
\cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
\cs_gset_nopar:Npn \scripturecurrentverse { 1 }
- \hbox_set:Nn \l_@@_chap_tmp_box { X }
- \dim_set:Nn \l_@@_chap_X_height_dim
- { \box_ht:N \l_@@_chap_tmp_box }
+ \@@_get_X_height:
\dim_set:Nn \l_@@_chap_height_dim
{ \baselineskip + \l_@@_chap_X_height_dim }
\dim_set:Nn \l_@@_chap_fontsize_dim
@@ -3024,7 +4734,7 @@
{ \exp_args:NV \color_select:n \l_@@_chapter_colour_tl }
\@@_chap_format:n { #1 }
}
- \dim_set:Nn \l_@@_chap_width_dim
+ \dim_gset:Nn \g_@@_chap_width_dim
{ \box_wd:N \l_@@_chap_tmp_box }
% \end{macrocode}
% Avoid breaks in the middle of drop chapters.
@@ -3031,14 +4741,17 @@
% \begin{macrocode}
\int_set_eq:NN \l_@@_clubpenalty_saved_int \clubpenalty
\clubpenalty 10000
- \hook_gput_next_code:nn { para / after }
- {
- \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
- \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
- { \penalty 10000 }
- \hook_gput_next_code:nn { para / before }
- { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int }
- }
+ \bool_if:NF \l_@@_verse_para_bool
+ {
+ \hook_gput_next_code:nn { para / after }
+ {
+ \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
+ \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+ { \penalty 10000 }
+ \hook_gput_next_code:nn { para / before }
+ { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int }
+ }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3048,16 +4761,26 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_drop_chap_output:
{
- \noindent
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \cs_if_eq:NNTF \noindent \@@_para_noindent:
+ {
+ \legacy_if:nTF { @newlist }
+ {
+ \skip_horizontal:n { -\l_@@_parindent_tl }
+ }
+ { \tex_noindent:D }
+ \@@_pilcrow_output:
+ }
+ { \noindent }
\parshape 3 ~
\dim_eval:n
- { \@totalleftmargin + \l_@@_chap_width_dim + \l_@@_chap_sep_tl } ~
+ { \@totalleftmargin + \g_@@_chap_width_dim + \l_@@_chap_sep_tl } ~
\dim_eval:n
- { \linewidth - \l_@@_chap_width_dim - \l_@@_chap_sep_tl } ~
+ { \linewidth - \g_@@_chap_width_dim - \l_@@_chap_sep_tl } ~
\dim_eval:n
- { \@totalleftmargin + \l_@@_chap_width_dim + \l_@@_chap_sep_tl } ~
+ { \@totalleftmargin + \g_@@_chap_width_dim + \l_@@_chap_sep_tl } ~
\dim_eval:n
- { \linewidth - \l_@@_chap_width_dim - \l_@@_chap_sep_tl } ~
+ { \linewidth - \g_@@_chap_width_dim - \l_@@_chap_sep_tl } ~
\@totalleftmargin ~
\linewidth
\group_begin:
@@ -3067,6 +4790,18 @@
\group_end:
\bool_if:NT \l_@@_chap_show_verse_bool
{ \@@_verse_output:n { 1 } }
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \hook_gput_next_code:nn { para / after }
+ {
+ \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
+ \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+ { \penalty 10000 }
+ \hook_gput_next_code:nn { para / before }
+ { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int }
+ }
+ }
+ \hook_gclear_next_code:n { scripture / pilcrow }
}
% \end{macrocode}
% \end{macro}
@@ -3079,21 +4814,58 @@
\cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
\cs_gset_nopar:Npn \scripturecurrentverse { 1 }
\group_begin:
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \legacy_if:nF { @newlist }
+ { \mode_if_vertical:F \para_end: }
+ }
\bool_if:NTF \l_@@_chap_show_bool
{
+ \@@_get_X_height:
+ \hcoffin_set:Nn \l_@@_nodrop_chap_coffin
+ {
+ \str_if_eq:VnF \l_@@_chapter_colour_tl { . }
+ { \exp_args:NV \color_select:n \l_@@_chapter_colour_tl }
+ \l_@@_chap_font_tl
+ \@@_chap_format:n { #1 }
+ \kern \l_@@_chap_sep_tl
+ }
+ \dim_zero:N \l_@@_nodrop_chap_voffset_dim
+ \tl_if_eq:NnT \l_@@_chapter_valign_tl { t }
+ { \dim_set_eq:NN \l_@@_nodrop_chap_voffset_dim \l_@@_chap_X_height_dim }
+ \tl_if_eq:NnT \l_@@_chapter_valign_tl { vc }
+ { \dim_set:Nn \l_@@_nodrop_chap_voffset_dim { 0.5 \l_@@_chap_X_height_dim } }
\hook_use:n { scripture / chap / before }
- \group_begin:
- \str_if_eq:VnF \l_@@_chapter_colour_tl { . }
- { \exp_args:NV \color_select:n \l_@@_chapter_colour_tl }
- \l_@@_chap_font_tl
- \@@_chap_format:n { #1 }
- \group_end:
- \skip_horizontal:N \l_@@_chap_sep_tl
+ \bool_if:NTF \l_@@_chap_smash_bool
+ {
+ \mode_leave_vertical:
+ \smash
+ {
+ \exp_args:NNoo
+ \coffin_typeset:Nnnnn \l_@@_nodrop_chap_coffin
+ { \l_@@_chapter_align_tl }
+ { \l_@@_chapter_valign_tl }
+ { 0pt }
+ { \l_@@_nodrop_chap_voffset_dim }
+ }
+ }
+ {
+ \exp_args:NNoo
+ \coffin_typeset:Nnnnn \l_@@_nodrop_chap_coffin
+ { \l_@@_chapter_align_tl }
+ { \l_@@_chapter_valign_tl }
+ { 0pt }
+ { \l_@@_nodrop_chap_voffset_dim }
+ }
+ \nobreak
+ \skip_horizontal:N \c_zero_skip
\hook_use:n { scripture / chap / after }
\bool_if:NT \l_@@_chap_show_verse_bool
{
\@@_verse_output:n { 1 }
}
+ \str_if_eq:VnF \l_@@_currenvir_str { midparachap }
+ { \@@_pilcrow_output: }
}
{
\hook_use:n { scripture / chap / before }
@@ -3101,10 +4873,97 @@
\vs { 1 }
}
\group_end:
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ \hook_gclear_next_code:n { scripture / pilcrow }
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_para_chap:n}
+% Format a chapter in its own paragraph.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_para_chap:n
+ {
+ \cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
+ \cs_gset_nopar:Npn \scripturecurrentverse { 1 }
+ \group_begin:
+ \skip_zero:N \parskip
+ \bool_if:NTF \l_@@_chap_show_bool
+ {
+ \dim_set_eq:NN \l_@@_para_chap_indent_dim \linewidth
+ \str_if_eq:VnTF \l_@@_currenvir_str { scripture }
+ {
+ \dim_set:Nn \l_@@_para_chap_indent_dim { 0.5 \l_@@_para_chap_indent_dim }
+ }
+ {
+ \dim_add:Nn \l_@@_para_chap_indent_dim { \leftmargin + \rightmargin }
+ \dim_set:Nn \l_@@_para_chap_indent_dim { 0.5 \l_@@_para_chap_indent_dim }
+ \dim_sub:Nn \l_@@_para_chap_indent_dim \leftmargin
+ }
+ \mode_if_vertical:F \para_end:
+ \addvspace { \l_@@_chap_para_aboveskip_tl }
+ \bool_gset_eq:NN \g_tmpa_bool \g_@@_suppress_next_pilcrow_bool
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \str_if_eq:VnTF \l_@@_currenvir_str { midparachap }
+ { \tex_noindent:D }
+ { \noindent }
+ \bool_gset_eq:NN \g_@@_suppress_next_pilcrow_bool \g_tmpa_bool
+ \skip_horizontal:N \l_@@_para_chap_indent_dim
+ \hbox_overlap_center:n
+ {
+ \hook_use:n { scripture / chap / before }
+ \group_begin:
+ \str_if_eq:VnF \l_@@_chapter_colour_tl { . }
+ { \exp_args:NV \color_select:n \l_@@_chapter_colour_tl }
+ \l_@@_chap_font_tl
+ \@@_chap_format:n { #1 }
+ \group_end:
+ \hook_use:n { scripture / chap / after }
+ }
+ \para_end:
+ \nobreak
+ \bool_lazy_any:nTF
+ {
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { narrow } }
+ }
+ { \legacy_if_set:nn { @afterindent } { \l_@@_chap_para_afterindent_bool } }
+ { \legacy_if_set_true:n { @afterindent } }
+ \@afterheading
+ }
+ {
+ \hook_use:n { scripture / chap / before }
+ \hook_use:n { scripture / chap / after }
+ }
+ \peek_meaning:NTF \c_space_token
+ {
+ \addvspace { \l_@@_chap_para_belowskip_tl }
+ \group_end:
+ \hook_use:n { scripture / poetry / pilcrow }
+ }
+ {
+ \addvspace { \l_@@_chap_para_belowskip_tl }
+ \cs_if_eq:NNTF \vs \@@_poetry_mode_vertical_verse:n
+ {
+ \bool_gset_eq:NN \g_tmpa_bool \g_@@_suppress_next_pilcrow_bool
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \noindent
+ \vs { 1 }
+ \bool_gset_eq:NN \g_@@_suppress_next_pilcrow_bool \g_tmpa_bool
+ }
+ {
+ \str_if_eq:VnT \l_@@_currenvir_str { midparachap }
+ { \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool }
+ \vs { 1 }
+ }
+ \group_end:
+ \hook_use:n { scripture / poetry / pilcrow }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_chap:n}
% Position a drop chapter.
% \begin{macrocode}
@@ -3128,8 +4987,10 @@
\bool_if:NTF \l_@@_mid_para_chap_bool
{ \@@_mid_para_drop_chap_output: }
{
- \par
+ \para_end:
\@@_drop_chap_output:
+ \str_if_eq:VnF \l_@@_currenvir_str { midparachap }
+ { \@@_pilcrow_output: }
}
\hook_gput_next_code:nn { para / before }
{
@@ -3136,7 +4997,19 @@
\legacy_if:nF { @newlist }
{
\int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
- { \extraskip }
+ {
+ \dim_compare:nNnT \parskip < \baselineskip
+ {
+ \dim_compare:nNnT { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \para_omit_indent:
+ \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ }
+ }
+ }
+ }
\int_gzero:N \g_@@_chap_par_prevgraf_int
}
\parshape 1 ~ \@totalleftmargin ~ \linewidth
@@ -3162,6 +5035,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\g_@@_suppress_next_verse_para_bool}
+% Suppress the next verse from starting a new paragraph when
+% \opt{verse/para} is in use.
+% \begin{macrocode}
+\bool_new:N \g_@@_suppress_next_verse_para_bool
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_verse_output:n}
% Output a formatted verse.
% \begin{macrocode}
@@ -3180,6 +5061,11 @@
\bool_set_false:N \l_@@_no_verse_first_bool
}
\group_begin:
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \box_if_empty:NF \g_@@_post_env_indent_box
+ { \box_use_drop:N \g_@@_post_env_indent_box }
+ }
\hook_use:n { scripture / verse / before }
\bool_if:NT \l_@@_verse_show_bool
{
@@ -3203,13 +5089,132 @@
\group_end:
\kern \l_@@_verse_sep_tl
}
+ \nobreak
+ \skip_horizontal:N \c_zero_skip
}
\hook_use:n { scripture / verse / after }
+ \hook_use:n { scripture / pilcrow }
\group_end:
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_verse_compact_output:n}
+% Output a formatted verse.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_verse_compact_output:n
+ {
+ \mode_if_vertical:T
+ { \@@_set_pilcrow_hook: }
+ \@@_verse_output:n { #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_verse_para_output:n}
+% Output a formatted verse when \opt{verse/para} is set.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_verse_para_output:n
+ {
+ \mode_if_vertical:T
+ { \@@_set_pilcrow_hook: }
+ \hook_if_empty:nT { scripture / pilcrow }
+ { \dim_set:Nn \parindent \l_@@_para_indent_tl }
+ \bool_if:NTF \g_@@_suppress_next_verse_para_bool
+ { \bool_gset_false:N \g_@@_suppress_next_verse_para_bool }
+ {
+ \legacy_if:nF { @newlist }
+ {
+ \mode_if_vertical:F
+ {
+ \para_end:
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ }
+ }
+ \@@_verse_output:n { #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_hanging_verse_para:n}
+% Output a formatted verse when \opt{verse/para} is set and in a hanging
+% environment.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_hanging_verse_para:n
+ {
+ \mode_if_vertical:T
+ { \@@_set_pilcrow_hook: }
+ \bool_if:NF \g_@@_suppress_next_verse_para_bool
+ {
+ \legacy_if:nF { @newlist }
+ {
+ \mode_if_vertical:F
+ {
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \hook_gput_next_code:nn { para / begin }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ \par
+ \tex_noindent:D
+ }
+ }
+ }
+ \bool_gset_false:N \g_@@_suppress_next_verse_para_bool
+ \@@_hanging_verse:n { #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Printing pilcrows}
+%
+% \begin{macro}{\g_@@_suppress_next_pilcrow_bool}
+% Flag to suppress the next pilcrow.
+% \begin{macrocode}
+\bool_new:N \g_@@_suppress_next_pilcrow_bool
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_pilcrow_hook:}
+% Set the next \hook{scripture/pilcrow} hook to output a pilcrow providing
+% the hook is currently empty.
+% \opt{verse/para} or \opt{compact} options are set.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_set_pilcrow_hook:
+ {
+ \hook_if_empty:nT { scripture / pilcrow }
+ {
+ \hook_gput_next_code:nn { scripture / pilcrow } { \@@_pilcrow_output: }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_pilcrow_output:}
+% Output a pilcrow (\P). Pilrows only display when either the
+% \opt{verse/para} or \opt{compact} options are set.
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_pilcrow_output:
+ {
+ \bool_gset_false:N \g_@@_para_mode_vertical_bool
+ \bool_gset_false:N \g_@@_mode_vertical_inner_bool
+ \bool_if:NT \l_@@_pilcrow_bool
+ {
+ \bool_lazy_or:nnT \l_@@_verse_para_bool \l_@@_compact_bool
+ {
+ \bool_if:NTF \g_@@_suppress_next_pilcrow_bool
+ { \bool_gset_false:N \g_@@_suppress_next_pilcrow_bool }
+ {
+ \P
+ \kern \l_@@_pilcrow_sep_tl
+ \nobreak
+ \skip_horizontal:N \c_zero_skip
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{Calculating the length of the final line in a paragraph}
%
% \begin{macro}{\g_@@_final_line_dim}
@@ -3229,21 +5234,30 @@
\skip_zero:N \belowdisplayshortskip
\skip_zero:N \belowdisplayskip
$$
- \dim_compare:nNnT \predisplaysize > \c_zero_dim
+ \hook_use:n { para / after }
+ \dim_compare:nNnTF \predisplaysize > \c_zero_dim
{
\dim_gset:Nn \g_@@_final_line_dim
- { \predisplaysize - 2 em }
+ { \predisplaysize - 2em }
}
+ {
+ \bool_if:NT \l_@@_textdir_change_in_group_bool
+ {
+ \str_if_eq:VnT \l_@@_currenvir_str { scripture }
+ { \int_set:Nn \prevgraf { \int_use:N \prevgraf - 1 } }
+ }
+ }
\cs_gset_nopar:Nx \@@_reset_spacing:
{
\dim_set:Nn \predisplaysize { \dim_use:N \predisplaysize }
\int_set:Nn \prevgraf { \int_use:N \prevgraf }
+ \int_gset:Nn \g_@@_chap_par_prevgraf_int { \int_use:N \g_@@_chap_par_prevgraf_int }
}
$$
\@@_reset_spacing:
\dim_compare:nNnT \g_@@_final_line_dim > \paperwidth
{ \dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth } }
- \dim_compare:nNnT \g_@@_final_line_dim > { \c_zero_dim - 1 sp }
+ \dim_compare:nNnT \g_@@_final_line_dim > { \c_zero_dim - 1sp }
{ \skip_vertical:n { -\baselineskip - \parskip } }
}
% \end{macrocode}
@@ -3252,7 +5266,7 @@
% \subsubsection{The \env{scripture} environment}
%
% \begin{macro}{\l_@@_currenvir_str}
-% Store the current \pkg{scripture} environment.
+% Store the current \env{scripture} environment.
% \begin{macrocode}
\str_new:N \l_@@_currenvir_str
% \end{macrocode}
@@ -3266,6 +5280,13 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\l_@@_ref_tl}
+% Store the reference passed to the \env{scripture} environment.
+% \begin{macrocode}
+\tl_new:N \l_@@_ref_tl
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_added:n}
% Mark text as added.
% \begin{macrocode}
@@ -3279,6 +5300,58 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_heading:n}
+% Output a non-canonical heading.
+% \begin{macrocode}
+\cs_new_protected_nopar:Nn \@@_heading:n
+ {
+ \str_if_eq:VnTF \l_@@_currenvir_str { scripture }
+ {
+ \bool_if:NTF \l_@@_heading_show_bool
+ {
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ \group_begin:
+ \bool_set_false:N \l_@@_pilcrow_bool
+ \legacy_if:nTF { @newlist }
+ {
+ \skip_horizontal:n { -\parindent }
+ }
+ {
+ \@@_list_para_end:
+ \addvspace { \l_@@_heading_aboveskip_tl }
+ \tex_noindent:D
+ }
+ \l_@@_heading_align_tl
+ \l_@@_heading_font_tl
+ \@@_heading_format:n { #1 }
+ \@@_list_para_end:
+ \group_end:
+ \bool_if:NTF \l_@@_verse_para_bool
+ {
+ \cs_set_eq:NN \noindent \_@@_para_noindent:
+ }
+ {
+ \cs_set_eq:NN \noindent \tex_noindent:D
+ }
+ \legacy_if_set:nn { @afterindent } \l_@@_heading_afterindent_bool
+ \bool_if:NF \l_@@_heading_afterindent_bool
+ {
+ \hook_gput_next_code:nn { para / before }
+ { \para_omit_indent: }
+ }
+ \nobreak
+ \@afterheading
+ \addvspace { \l_@@_heading_belowskip_tl }
+ }
+ { \ignorespaces }
+ }
+ {
+ \msg_error:nnx { scripture } { heading-error } { \l_@@_currenvir_str }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\@@_name:n}
% Output divine name.
% \begin{macrocode}
@@ -3302,7 +5375,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_ch:nn}
+% \begin{macro}{\@@_ch_output:nn}
% Print a chapter number in the main scripture environment.
% \begin{macrocode}
\cs_new_protected:Nn \@@_ch_output:nn
@@ -3312,7 +5385,9 @@
\bool_if:NTF \l_@@_chap_drop_bool
{
\@@_chap:n { #2 }
- \bool_if:nTF { #1 }
+ \bool_lazy_and:nnTF
+ { #1 }
+ { \bool_not_p:n { \l_@@_compact_bool } }
{
\hook_gput_next_code:nn { para / after }
{
@@ -3325,17 +5400,25 @@
{ \int_gset_eq:NN \g_@@_mid_para_chap_prevgraf_int \prevgraf }
}
}
+ {
+ \bool_if:NTF \l_@@_chap_para_bool
+ { \@@_para_chap:n { #2 } }
+ { \@@_nodrop_chap:n { #2 } }
+ }
+ }
+ {
+ \bool_if:NTF \l_@@_chap_para_bool
+ { \@@_para_chap:n { #2 } }
{ \@@_nodrop_chap:n { #2 } }
}
- { \@@_nodrop_chap:n { #2 } }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_begin:n}
+% \begin{macro}{\@@_begin:nn}
% Begin a scripture quotation.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_begin:n
+\cs_new_protected:Nn \@@_begin:nn
{
\cs_set_eq:NN \@@_noindent_saved: \noindent
\bool_if:NT \l_@@_active_bool
@@ -3343,11 +5426,14 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l_@@_active_bool
- \tl_set:Nn \l_@@_currenvir_str { scripture }
\tl_if_novalue:nF { #1 }
+ { \tl_set:Nn \l_@@_ref_tl { #1 } }
+ \str_set:Nn \l_@@_currenvir_str { scripture }
+ \tl_if_novalue:nF { #2 }
{
- \keys_set:nn { scripture } { #1 }
+ \keys_set:nn { scripture } { #2 }
}
+ \l_@@_before_tl
\@@_select_language:
\int_gzero:N \g_@@_chap_par_prevgraf_int
% \end{macrocode}
@@ -3362,10 +5448,25 @@
\cs_set_eq:NN \extraskip \@@_extra_skip:
\cs_set_eq:NN \redletteron \@@_red_letter_on:
\cs_set_eq:NN \redletteroff \@@_red_letter_off:
- \DeclareDocumentCommand { \ch } { sm }
- { \@@_ch_output:nn { ##1 } { ##2 } }
+ \cs_set:Npn \nopilcrow { \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool }
+ \bool_gset_false:N \g_@@_suppress_next_pilcrow_bool
+ \bool_gset_false:N \g_@@_suppress_next_verse_para_bool
+ \bool_gset_false:N \g_@@_mode_vertical_inner_bool
+ \box_gclear:N \g_@@_post_env_indent_box
+ \skip_gzero:N \g_@@_prev_inner_below_skip
+ \bool_if:NT \l_@@_chap_para_bool
+ { \bool_set_false:N \l_@@_chap_drop_bool }
+ \DeclareDocumentCommand { \ch } { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l_@@_X_char_tl { ##2 }
+ }
+ \@@_ch_output:nn { ##1 } { ##3 }
+ }
\cs_set_eq:NN \vs \@@_verse_output:n
\cs_set_eq:NN \added \@@_added:n
+ \cs_set_eq:NN \heading \@@_heading:n
\cs_set_eq:NN \name \@@_name:n
\cs_set_protected_nopar:Npn \LORD { \name { Lord } }
\cs_set_protected_nopar:Npn \GOD { \name { God } }
@@ -3373,7 +5474,10 @@
\cs_set_protected_nopar:Npn \textright ##1
{ \@@_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } }
\hook_gclear_next_code:n { para / before }
+ \hook_gclear_next_code:n { scripture / pilcow }
+ \hook_gclear_next_code:n { scripture / poetry / pilcow }
\l_@@_font_tl
+ \tl_set:Ne \l_@@_parindent_tl { \dim_eval:n { \l_@@_parindent_tl } }
\exp_args:NnV \color_set:nn { scripture default colour } \l_@@_colour_tl
\str_if_eq:VnF \l_@@_colour_tl { . }
{ \color_select:n { scripture default colour } }
@@ -3399,21 +5503,30 @@
{
\hook_gput_next_code:nn { para / begin }
{
- \bool_lazy_any:nT
+ \bool_if:NTF \l_@@_compact_bool
+ { \para_omit_indent: }
{
- { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } }
- { \str_if_eq_p:Vn \l_@@_currenvir_str { narrow } }
- { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } }
+ \bool_lazy_any:nT
+ {
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { narrow } }
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } }
+ }
+ {
+ \legacy_if:nTF { @noparlist }
+ {
+ \bool_lazy_and:nnF
+ { \str_if_eq_p:Vn \l_@@_currenvir_str { narrow } }
+ { \str_if_eq_p:Vn \l_@@_ref_position_tl { start } }
+ { \noindent }
+ }
+ { \para_omit_indent: }
+ }
}
- {
- \legacy_if:nTF { @noparlist }
- { \noindent }
- { \para_omit_indent: }
- }
}
}
}
- \dim_set_eq:NN \parindent \l_@@_parindent_tl
+ \cs_set_eq:NN \@@_list_para_end: \@par
\item
\relax
}
@@ -3421,11 +5534,18 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_end:n}
+% \begin{macro}{\@@_end:}
% End a scripture quotation with a reference.
% \begin{macrocode}
-\cs_new_protected:Nn \@@_end:n
+\cs_new_protected:Nn \@@_end:
{
+ \tl_if_eq:NnT \l_@@_ref_position_tl { start }
+ {
+ \tl_clear:N \l_@@_ref_tl
+ \tl_if_eq:NnT \l_@@_version_position_tl { withref }
+ { \tl_clear:N \l_@@_version_tl }
+ }
+ \cs_set_eq:NN \noindent \tex_noindent:D
\bool_if:NTF \l_@@_inline_bool
{
\unskip
@@ -3432,18 +5552,18 @@
\@@_red_letter_off:
\l_@@_inline_end_tl
\bool_lazy_or:nnTF
- { \tl_if_novalue_p:n { #1 } }
- { \tl_if_empty_p:n { #1 } }
+ { \tl_if_novalue_p:n \l_@@_ref_tl }
+ { \tl_if_empty_p:N \l_@@_ref_tl }
{
\tl_if_empty:NF \l_@@_version_tl
{
\skip_horizontal:N \l_@@_ref_sep_tl
- \@@_format_full_ref:n { }
+ \@@_format_full_ref:nn { } \l_@@_version_tl
}
}
{
\skip_horizontal:N \l_@@_ref_sep_tl
- \@@_format_full_ref:n { #1 }
+ \@@_format_full_ref:nn \l_@@_ref_tl \l_@@_version_tl
}
}
{
@@ -3457,30 +5577,35 @@
{ \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_belowskip_tl \@outerparskip } }
% \end{macrocode}
% If a \env{scripture} quotation ends with an inner environment, remove the
-% below skip of the inner environment.
+% below skip of the inner environment. Also correct for \cs{textdir} quirk.
% \begin{macrocode}
\int_compare:nNnT \prevgraf = \c_zero_int
- { \skip_vertical:n { -\g_@@_prev_inner_below_skip } }
+ {
+ \bool_if:NT \l_@@_textdir_change_in_group_bool
+ { \skip_vertical:n { -\baselineskip } }
+ \skip_vertical:n { -\g_@@_prev_inner_below_skip }
+ }
\hook_gclear_next_code:n { para / before }
- \parshape 1 ~ \@totalleftmargin ~ \linewidth
\noindent
\bool_lazy_or:nnTF
- { \tl_if_novalue_p:n { #1 } }
- { \tl_if_empty_p:n { #1 } }
+ { \tl_if_novalue_p:n \l_@@_ref_tl }
+ { \tl_if_empty_p:N \l_@@_ref_tl }
{
\tl_if_empty:NTF \l_@@_version_tl
{ \hbox:n { } }
{ \@@_reference:n { } }
}
- { \@@_reference:n { #1 } }
+ { \@@_reference:n \l_@@_ref_tl }
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
% \end{macrocode}
% Set \val{@noparlist} to \val{false} to ensure \cs{topsep} is always added
% \env{scripture} environment
% \begin{macrocode}
- \@noparlistfalse
+ \legacy_if_set_false:n { @noparlist }
\endlist
}
\cs_set_eq:NN \noindent \@@_noindent_saved:
+ \l_@@_after_tl
}
% \end{macrocode}
% \end{macro}
@@ -3487,6 +5612,71 @@
%
% \subsection{Scripture internal environments}
%
+% \begin{macro}{\@@_compact_end_inner:}
+% End a compact inner environment
+% \begin{macrocode}
+\cs_new_protected:Nn \@@_compact_end_inner:
+ {
+ \bool_gset_false:N \g_@@_mode_vertical_inner_bool
+ \str_if_eq:VnT \l_@@_ref_position_tl { start }
+ {
+ \tl_gclear:N \l_@@_ref_tl
+ }
+ \bool_lazy_and:nnT \l_@@_verse_para_bool \l_@@_chap_drop_bool
+ {
+ \cs_set_eq:NN \par \para_end:
+ \@@_calc_final_line_length:
+ \int_gset_eq:NN \g_@@_mid_para_chap_prevgraf_int \g_@@_chap_par_prevgraf_int
+ \tex_noindent:D
+ \bool_lazy_and:nnTF
+ { \bool_if_p:N \l_@@_compact_bool }
+ { \int_compare_p:nNn \g_@@_mid_para_chap_prevgraf_int = 1 }
+ {
+ \hook_gput_next_code:nn { env / \l_@@_currenvir_str / after }
+ {
+ \parshape 3 ~
+ \@totalleftmargin ~ \linewidth ~
+ \dim_eval:n
+ { \@totalleftmargin + \g_@@_chap_width_dim + \l_@@_chap_sep_tl } ~
+ \dim_eval:n
+ { \linewidth - \g_@@_chap_width_dim - \l_@@_chap_sep_tl } ~
+ \@totalleftmargin ~ \linewidth
+ }
+ \hbox_to_wd:nn { \g_@@_final_line_dim - \g_@@_chap_width_dim - \l_@@_chap_sep_tl } { }
+ }
+ {
+ \hbox_to_wd:nn \g_@@_final_line_dim { }
+ }
+ \c_space_token
+ \kern 0pt
+ \cs_set_eq:NN \par \relax
+ \hook_gput_next_code:nn { para / before }
+ {
+ \int_compare:nNnT \g_@@_mid_para_chap_prevgraf_int = 1
+ {
+ \dim_compare:nNnT \parskip < \baselineskip
+ {
+ \dim_compare:nNnT { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \para_omit_indent:
+ \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ }
+ }
+ }
+ }
+ \int_gzero:N \g_@@_chap_par_prevgraf_int
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ }
+ \unskip
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \subsubsection{The \env{center} environment}
%
% \begin{macro}{\@@_center_begin:n}
@@ -3499,7 +5689,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l_@@_active_inner_bool
- \tl_set:Nn \l_@@_currenvir_str { center }
+ \str_set:Nn \l_@@_currenvir_str { center }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -3509,11 +5699,13 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l_@@_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
\list { }
{
-% \end{macrocode}
-% Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment.
-% \begin{macrocode}
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g_@@_para_mode_vertical_bool }
+ { \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l_@@_center_leftmargin_tl
\dim_set_eq:NN \rightmargin \l_@@_center_rightmargin_tl
@@ -3530,6 +5722,16 @@
{ \addvspace { \baselineskip } }
\int_gzero:N \g_@@_chap_par_prevgraf_int
\centering
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \cs_set_eq:NN \par \@@_para_par:
+ \cs_set_protected:Npn \\
+ {
+ \mode_if_horizontal:TF
+ { \unskip }
+ { \@nolnerr }
+ }
+ }
\item
\relax
}
@@ -3541,6 +5743,7 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_center_end:
{
+ \cs_set_eq:NN \par \para_end:
\dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth }
\dim_compare:nNnTF \@outerparskip > \l_@@_center_belowskip_tl
{ \skip_zero:N \@topsepadd }
@@ -3548,6 +5751,7 @@
\skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
}
% \end{macrocode}
% \end{macro}
@@ -3564,7 +5768,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l_@@_active_inner_bool
- \tl_set:Nn \l_@@_currenvir_str { flushright }
+ \str_set:Nn \l_@@_currenvir_str { flushright }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -3574,11 +5778,13 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l_@@_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
\list { }
{
-% \end{macrocode}
-% Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment.
-% \begin{macrocode}
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g_@@_para_mode_vertical_bool }
+ { \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l_@@_flushright_leftmargin_tl
\dim_set_eq:NN \rightmargin \l_@@_flushright_rightmargin_tl
@@ -3595,6 +5801,16 @@
{ \addvspace { \baselineskip } }
\int_gzero:N \g_@@_chap_par_prevgraf_int
\raggedleft
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \cs_set_eq:NN \par \@@_para_par:
+ \cs_set_protected:Npn \\
+ {
+ \mode_if_horizontal:TF
+ { \unskip }
+ { \@nolnerr }
+ }
+ }
\item
\relax
}
@@ -3606,6 +5822,7 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_flushright_end:
{
+ \cs_set_eq:NN \par \para_end:
\dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth }
\dim_compare:nNnTF \@outerparskip > \l_@@_flushright_belowskip_tl
{ \skip_zero:N \@topsepadd }
@@ -3613,6 +5830,7 @@
\skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
}
% \end{macrocode}
% \end{macro}
@@ -3631,13 +5849,22 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_hanging_ch:n
{
+ \bool_gset_false:N \g_@@_suppress_next_pilcrow_bool
\bool_if:NTF \l_@@_chap_show_bool
{
\bool_if:NTF \l_@@_chap_drop_bool
{ \@@_hanging_chap:n { #1 } }
+ {
+ \bool_if:NTF \l_@@_chap_para_bool
+ { \@@_para_chap:n { #1 } }
+ { \@@_nodrop_chap:n { #1 } }
+ }
+ }
+ {
+ \bool_if:NTF \l_@@_chap_para_bool
+ { \@@_para_chap:n { #1 } }
{ \@@_nodrop_chap:n { #1 } }
}
- { \@@_nodrop_chap:n { #1 } }
}
% \end{macrocode}
% \end{macro}
@@ -3649,11 +5876,14 @@
{
\@@_drop_chap_set_up:n { #1 }
\dim_compare:nNnTF
- \l_@@_chap_width_dim < \leftmargin
+ { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } < \leftmargin
{
- \tl_set:Nx \l_@@_chap_sep_tl
+ \bool_if:NT \l_@@_hanging_chapter_indent_bool
{
- \dim_eval:n { \leftmargin - \l_@@_chap_width_dim }
+ \tl_set:Nx \l_@@_chap_sep_tl
+ {
+ \dim_eval:n { \leftmargin - \g_@@_chap_width_dim }
+ }
}
}
{
@@ -3660,35 +5890,65 @@
\parshape 3 ~
\dim_eval:n
{
- \@totalleftmargin - \leftmargin + \l_@@_chap_width_dim +
+ \@totalleftmargin - \leftmargin + \g_@@_chap_width_dim +
\l_@@_chap_sep_tl
} ~
\dim_eval:n
{
- \linewidth + \leftmargin - \l_@@_chap_width_dim -
+ \linewidth + \leftmargin - \g_@@_chap_width_dim -
\l_@@_chap_sep_tl
} ~
\dim_eval:n
{
- \@totalleftmargin - \leftmargin + \l_@@_chap_width_dim +
+ \@totalleftmargin - \leftmargin + \g_@@_chap_width_dim +
\l_@@_chap_sep_tl
} ~
\dim_eval:n
{
- \linewidth + \leftmargin - \l_@@_chap_width_dim -
+ \linewidth + \leftmargin - \g_@@_chap_width_dim -
\l_@@_chap_sep_tl
} ~
\@totalleftmargin ~ \linewidth
}
- \tl_set:Nx \l_@@_chap_sep_tl
+ \par
+ \bool_if:NTF \l_@@_hanging_chapter_indent_bool
{
- \dim_eval:n
+ \tl_set:Nx \l_@@_chap_sep_tl
{
- \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim
+ \dim_eval:n
+ {
+ \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim
+ }
}
+ \@@_nohang:
}
- \par
- \@@_nohang:
+ {
+ \mode_leave_vertical:
+ \dim_compare:nNnTF
+ { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \l_@@_hanging_leftmargin_tl
+ {
+ \dim_compare:nNnTF
+ { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \leftmargin
+ {
+ \skip_horizontal:n { \l_@@_hanging_hang_tl }
+ }
+ {
+ \skip_horizontal:n
+ {
+ \l_@@_chap_sep_tl +
+ \g_@@_chap_width_dim -
+ \l_@@_hanging_leftmargin_tl
+ }
+ }
+ }
+ {
+ \tl_set:Nx \l_@@_chap_sep_tl
+ {
+ \dim_eval:n
+ { \l_@@_hanging_leftmargin_tl - \g_@@_chap_width_dim }
+ }
+ }
+ }
\hbox_set:Nn \l_@@_chap_box
{
\box_move_down:nn
@@ -3712,14 +5972,53 @@
{
\@@_verse_output:n { 1 }
}
+ \@@_pilcrow_output:
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \hook_gput_next_code:nn { para / after }
+ {
+ \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
+ \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+ { \penalty 10000 }
+ \hook_gput_next_code:nn { para / before }
+ {
+ \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int
+ }
+ }
+ }
\hook_gput_next_code:nn { para / begin }
- { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ {
+ \int_compare:nNnTF \g_@@_chap_par_prevgraf_int = \c_one_int
+ {
+ \dim_compare:nNnTF
+ { \l_@@_hanging_leftmargin_tl } < { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ {
+ \parshape 2 ~
+ \dim_eval:n
+ {
+ \@totalleftmargin - \leftmargin + \g_@@_chap_width_dim +
+ \l_@@_chap_sep_tl
+ } ~
+ \dim_eval:n
+ {
+ \linewidth + \leftmargin - \g_@@_chap_width_dim -
+ \l_@@_chap_sep_tl
+ } ~
+ \@totalleftmargin ~ \linewidth
+ }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ \hook_gput_next_code:nn { para / begin }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ \int_gzero:N \g_@@_chap_par_prevgraf_int
+ }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_hanging_verse:n}
-% Position a \cs{vs} in a \env{hanging} environment. The verse is set to
+% Position a \fn{vs} in a \env{hanging} environment. The verse is set to
% overlap to the left if at the beginning of a hanging paragraph.
% \begin{macrocode}
\cs_new_protected:Nn \@@_hanging_verse:n
@@ -3726,11 +6025,54 @@
{
\mode_if_vertical:TF
{
- \strut
- \hbox_overlap_left:n
+ \tl_set_eq:NN \l_tmpa_tl \l_@@_verse_sep_tl
+ \tl_set_eq:NN \l_@@_verse_sep_tl \l_@@_hanging_verse_sep_tl
+ \bool_lazy_and:nnTF
+ { \legacy_if_p:n { @newlist } }
+ { \g_@@_suppress_next_pilcrow_bool }
{
- \@@_verse_output:n { #1 }
+ \strut
+ \bool_if:NTF \l_@@_hanging_verse_right_bool
+ {
+ \hbox_overlap_left:n
+ {
+ \@@_verse_output:n { #1 }
+ }
+ }
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_overlap_right:n
+ {
+ \@@_verse_output:n { #1 }
+ }
+ \skip_horizontal:N \l_@@_hanging_leftmargin_tl
+ }
+ }
}
+ {
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \strut
+ \bool_if:NTF \l_@@_hanging_verse_right_bool
+ {
+ \hbox_overlap_left:n
+ {
+ \@@_verse_output:n { #1 }
+ }
+ }
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_overlap_right:n
+ {
+ \@@_verse_output:n { #1 }
+ }
+ \skip_horizontal:N \l_@@_hanging_leftmargin_tl
+ }
+ }
+ \@@_pilcrow_output:
+ }
+ \tl_set_eq:NN \l_@@_verse_sep_tl \l_tmpa_tl
}
{ \@@_verse_output:n { #1 } }
}
@@ -3743,8 +6085,15 @@
% \begin{macrocode}
\cs_new_protected_nopar:Nn \@@_nohang:
{
- \noindent
+ \legacy_if:nTF {@newlist}
+ { \skip_horizontal:n { \l_@@_hanging_hang_tl } }
+ { \tex_noindent:D }
\hbox_to_wd:nn { \l_@@_hanging_parindent_saved_dim } { }
+ \peek_meaning:NT \vs
+ {
+ \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+ \@@_set_pilcrow_hook:
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3759,7 +6108,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l_@@_active_inner_bool
- \tl_set:Nn \l_@@_currenvir_str { hanging }
+ \str_set:Nn \l_@@_currenvir_str { hanging }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -3766,18 +6115,30 @@
{ scripture / hanging }
{ #1 }
}
- \DeclareDocumentCommand { \ch } { sm } { \@@_hanging_ch:n { ##2 } }
- \cs_set_eq:NN \vs \@@_hanging_verse:n
+ \DeclareDocumentCommand { \ch } { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l_@@_X_char_tl { ##2 }
+ }
+ \@@_hanging_ch:n { ##3 }
+ }
+ \bool_if:NTF \l_@@_verse_para_bool
+ { \cs_set_eq:NN \vs \@@_hanging_verse_para:n }
+ { \cs_set_eq:NN \vs \@@_hanging_verse:n }
\cs_set_eq:NN \nohang \@@_nohang:
\dim_set_eq:NN \l_@@_hanging_parindent_saved_dim \parindent
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l_@@_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
+ \hook_gclear_next_code:n { para/ before }
\list { }
{
-% \end{macrocode}
-% Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment.
-% \begin{macrocode}
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g_@@_para_mode_vertical_bool }
+ { \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set:Nn \leftmargin { \l_@@_hanging_leftmargin_tl + \l_@@_hanging_hang_tl }
\dim_set_eq:NN \rightmargin \l_@@_hanging_rightmargin_tl
@@ -3811,6 +6172,7 @@
\skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
}
% \end{macrocode}
% \end{macro}
@@ -3881,6 +6243,35 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_mid_para_chap_end_orig:n,
+% \@@_mid_para_chap_end:n}
+% Custom \cs{end} macro for the \env{midparachap} environment. This is only
+% used when the \opt{verse/para} and/or \opt{compact} options are in use.
+% \begin{macrocode}
+\cs_set_eq:Nc \@@_mid_para_chap_end_orig:n { end ~ }
+\cs_new_nopar:Nn \@@_mid_para_chap_end:n
+ {
+ \@@_mid_para_chap_end_orig:n { #1 }
+ \bool_if:NT \l_@@_compact_bool
+ { \c_space_token }
+ \peek_remove_spaces:n
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:n
+ {
+ { \exp_args:No \token_if_letter_p:N { ##1 } }
+ { \@@_pilcrow_output: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ { \@@_set_pilcrow_hook: }
+ }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\l_@@_mid_para_chap_box,
% \l_@@_mid_para_chap_split_box,
% \l_@@_mid_para_chap_split_top_box}
@@ -3913,11 +6304,11 @@
\dim_compare:nNnTF
{
\box_wd:N \l_@@_mid_para_chap_snap_box +
- \l_@@_chap_width_dim +
+ \g_@@_chap_width_dim +
\l_@@_chap_sep_tl
}
<
- { \linewidth - \leftskip - \rightskip - 3 em }
+ { \linewidth - \leftskip - \rightskip - 3em }
{
\@@_drop_chap_output:
\hbox_unpack_drop:N \l_@@_mid_para_chap_snap_box
@@ -3948,7 +6339,7 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_mid_para_chap_begin:n
{
- \tl_set:Nn \l_@@_currenvir_str { midparachap }
+ \str_set:Nn \l_@@_currenvir_str { midparachap }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -3955,9 +6346,7 @@
{ scripture / midparachap }
{ #1 }
}
- \bool_lazy_and:nnT
- { \bool_if_p:n \l_@@_chap_show_verse_bool }
- { \bool_if_p:n \l_@@_chap_drop_bool }
+ \bool_lazy_and:nnT \l_@@_chap_show_verse_bool \l_@@_chap_drop_bool
{
\bool_set_true:N \l_@@_midparachap_show_verse_bool
\bool_set_false:N \l_@@_chap_show_verse_bool
@@ -3998,8 +6387,8 @@
\prevgraf < 3
{
\noindent
- \skip_horizontal:n { \l_@@_chap_width_dim + \l_@@_chap_sep_tl }
- \dim_gadd:Nn \g_@@_final_line_dim { \l_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ \skip_horizontal:n { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ \dim_gadd:Nn \g_@@_final_line_dim { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
}
\box_use_drop:N \l_@@_mid_para_chap_line_box
\vbox_set_end:
@@ -4042,7 +6431,24 @@
\int_gset_eq:NN \g_@@_chap_par_prevgraf_int \g_@@_mid_para_chap_prevgraf_int
\hook_gput_next_code:nn { para / before }
{
- \int_gzero:N \g_@@_chap_par_prevgraf_int
+ \legacy_if:nF { @newlist }
+ {
+ \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+ {
+ \dim_compare:nNnT \parskip < \baselineskip
+ {
+ \dim_compare:nNnT { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \para_omit_indent:
+ \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ }
+ }
+ }
+ }
+ \int_gzero:N \g_@@_chap_par_prevgraf_int
+ }
\parshape 1 ~ \@totalleftmargin ~ \linewidth
}
}
@@ -4061,7 +6467,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l_@@_active_inner_bool
- \tl_set:Nn \l_@@_currenvir_str { narrow }
+ \str_set:Nn \l_@@_currenvir_str { narrow }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -4071,24 +6477,22 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l_@@_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
\list { }
{
-% \end{macrocode}
-% Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment.
-% \begin{macrocode}
- %\int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
- % { \addvspace { \baselineskip } }
- %\int_gzero:N \g_@@_chap_par_prevgraf_int
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l_@@_narrow_leftmargin_tl
\dim_set_eq:NN \rightmargin \l_@@_narrow_rightmargin_tl
\dim_set_eq:NN \listparindent \parindent
- \mode_if_vertical:TF
+ \bool_lazy_or:nnTF
+ { \mode_if_vertical_p: }
+ { \g_@@_para_mode_vertical_bool }
{
\dim_set:Nn \itemindent { \parindent - \l_@@_outer_itemindent_dim }
\@@_setup_list_noindent:n { \parindent }
}
{
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
\dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim }
\@@_setup_list_noindent:n { \c_zero_dim }
}
@@ -4101,6 +6505,8 @@
\int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
{ \addvspace { \baselineskip } }
\int_gzero:N \g_@@_chap_par_prevgraf_int
+ \bool_if:NT \l_@@_verse_para_bool
+ { \cs_set_eq:NN \par \@@_para_par: }
\item
\relax
}
@@ -4112,6 +6518,7 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_narrow_end:
{
+ \cs_set_eq:NN \par \para_end:
\@@_calc_final_line_length:
\dim_compare:nNnTF \@outerparskip > \l_@@_narrow_belowskip_tl
{ \skip_zero:N \@topsepadd }
@@ -4119,6 +6526,7 @@
\skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
}
% \end{macrocode}
% \end{macro}
@@ -4140,11 +6548,11 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\g_@@_poetry_midparachap_show_verse_bool}
+% \begin{macro}{\l_@@_poetry_midparachap_show_verse_bool}
% Flag indicating whether the verse number should be printed immediately
-% after a \cs{ch} or not in a \env{poetry} environment.
+% after a \fn{ch} or not in a \env{poetry} environment.
% \begin{macrocode}
-\bool_new:N \g_@@_poetry_midparachap_show_verse_bool
+\bool_new:N \l_@@_poetry_midparachap_show_verse_bool
% \end{macrocode}
% \end{macro}
%
@@ -4172,28 +6580,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_poetry_extra_skip:}
-% Insert a little extra vertical space between two lines in a \env{poetry}
-% environment.
-% \begin{macrocode}
-\cs_new_protected:Nn \@@_poetry_extra_skip:
- {
- \skip_vertical:n { \l_@@_extraskip_tl - \baselineskip - \parskip }
- \bool_gset_false:N \g_@@_poetry_midparachap_show_verse_bool
- \strut
- \hook_gput_next_code:nn { para / after }
- {
- \hook_gput_next_code:nn { para / after }
- {
- \bool_gset_eq:NN
- \g_@@_poetry_midparachap_show_verse_bool
- \l_@@_midparachap_show_verse_bool
- }
- }
- }
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\@@_poetry_text_right:nn}
% Align a word to the right and finish a paragraph, pushing to the next line
% if there is not space for the word.
@@ -4240,9 +6626,17 @@
{
\bool_if:NTF \l_@@_chap_drop_bool
{ \@@_poetry_chap:n { #1 } }
+ {
+ \bool_if:NTF \l_@@_chap_para_bool
+ { \@@_para_chap:n { #1 } }
+ { \@@_poetry_nodrop_chap:n { #1 } }
+ }
+ }
+ {
+ \bool_if:NTF \l_@@_chap_para_bool
+ { \@@_para_chap:n { #1 } }
{ \@@_poetry_nodrop_chap:n { #1 } }
}
- { \@@_poetry_nodrop_chap:n { #1 } }
}
% \end{macrocode}
% \end{macro}
@@ -4253,15 +6647,23 @@
\cs_new_protected:Nn \@@_poetry_chap:n
{
\@@_drop_chap_set_up:n { #1 }
- \mode_if_vertical:TF
+ \hook_gput_next_code:nn { para / after }
+ {
+ \hook_gput_next_code:nn { para / after }
+ { \int_gzero:N \g_@@_chap_par_prevgraf_int }
+ }
+ \cs_if_eq:NNTF \vs \@@_poetry_mode_vertical_verse:n
{
+ \dim_zero:N \l_@@_poetry_chap_indent_dim
+ \noindent
+ }
+ {
\dim_set_eq:NN \l_@@_poetry_chap_indent_dim \l_@@_poetry_indent_tl
\mode_leave_vertical:
}
- { \dim_zero:N \l_@@_poetry_chap_indent_dim }
\dim_set_eq:NN \l_@@_poetry_chap_sep_dim \l_@@_chap_sep_tl
\dim_compare:nNnT
- { \l_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
<
{ \l_@@_poetry_leftmargin_tl + \l_@@_poetry_chap_indent_dim }
{
@@ -4268,7 +6670,7 @@
\dim_set:Nn \l_@@_poetry_chap_sep_dim
{
\l_@@_poetry_leftmargin_tl + \l_@@_poetry_chap_indent_dim -
- \l_@@_chap_width_dim
+ \g_@@_chap_width_dim
}
}
\hbox_set:Nn \l_@@_chap_box
@@ -4287,7 +6689,7 @@
\box_set_dp:Nn \l_@@_chap_box { \c_zero_dim }
\dim_set:Nn \l_@@_poetry_chap_parshape_correction_dim
{
- \l_@@_chap_width_dim + \l_@@_poetry_chap_sep_dim -
+ \g_@@_chap_width_dim + \l_@@_poetry_chap_sep_dim -
\l_@@_poetry_leftmargin_tl - \l_@@_poetry_chap_indent_dim
}
\parshape 2 ~
@@ -4300,13 +6702,10 @@
\dim_eval:n
{ \linewidth - \l_@@_poetry_big_indent_tl }
% \end{macrocode}
-% Because of interactions with \LaTeX{} \env{list} environments and
-% \cs{@@_obeylines:}, \cs{@@_poetry_par:} setting the \cs{parshape} for the
-% second line after a drop chapter number is more difficult than it should
-% be. There's probably a better way.
+% Set the \cs{parshape} for the second line after a drop chapter number.
% \begin{macrocode}
\dim_compare:nNnT
- { \l_@@_chap_width_dim + \l_@@_poetry_chap_sep_dim }
+ { \g_@@_chap_width_dim + \l_@@_poetry_chap_sep_dim }
>
\l_@@_poetry_leftmargin_tl
{
@@ -4314,51 +6713,52 @@
{
\int_compare:nNnT \l_@@_poetry_prevgraf_int = 1
{
+ \cs_if_eq:NNTF \vs \@@_poetry_mode_vertical_verse:n
% \end{macrocode}
-% This \cs{parshape} is in effect when the next line is the second half of a
+% This \cs{parshape} is in effect when the next line is the first half of a
% poetry verse.
% \begin{macrocode}
- \dim_compare:nNnTF
- { \l_@@_chap_width_dim + \l_@@_chap_sep_tl }
- <
- { \l_@@_poetry_leftmargin_tl + \l_@@_poetry_indent_tl }
- { \dim_zero:N \l_@@_poetry_chap_parshape_correction_dim }
{
- \dim_set:Nn \l_@@_poetry_chap_parshape_correction_dim
+ \dim_compare:nNnTF
+ { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ <
+ \l_@@_poetry_leftmargin_tl
+ { \dim_zero:N \l_@@_poetry_chap_parshape_correction_dim }
{
- \l_@@_chap_width_dim + \l_@@_chap_sep_tl -
- \l_@@_poetry_leftmargin_tl - \l_@@_poetry_indent_tl
+ \dim_set:Nn \l_@@_poetry_chap_parshape_correction_dim
+ {
+ \g_@@_chap_width_dim + \l_@@_chap_sep_tl -
+ \l_@@_poetry_leftmargin_tl
+ }
}
+ \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+ {
+ \parshape 2 ~
+ \dim_eval:n
+ { \@totalleftmargin + \l_@@_poetry_chap_parshape_correction_dim } ~
+ \dim_eval:n
+ { \linewidth - \l_@@_poetry_chap_parshape_correction_dim } ~
+ \dim_eval:n
+ { \@totalleftmargin + \l_@@_poetry_big_indent_tl } ~
+ \dim_eval:n
+ { \linewidth - \l_@@_poetry_big_indent_tl }
+ }
}
- \parshape 2 ~
- \dim_eval:n
- { \@totalleftmargin + \l_@@_poetry_chap_parshape_correction_dim } ~
- \dim_eval:n
- { \linewidth - \l_@@_poetry_chap_parshape_correction_dim } ~
- \dim_eval:n
- { \@totalleftmargin + \l_@@_poetry_big_indent_tl } ~
- \dim_eval:n
- { \linewidth - \l_@@_poetry_big_indent_tl }
- \hook_gput_next_code:nn { para / after }
- {
- \hook_gclear_next_code:n { scripture / poetry / para / after }
- }
- \hook_gput_next_code:nn { scripture / poetry / para / after }
- {
% \end{macrocode}
-% This \cs{parshape} is in effect when the next line is the first half of a
+% This \cs{parshape} is in effect when the next line is the second half of a
% poetry verse.
% \begin{macrocode}
+ {
\dim_compare:nNnTF
- { \l_@@_chap_width_dim + \l_@@_chap_sep_tl }
+ { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
<
- \l_@@_poetry_leftmargin_tl
+ { \l_@@_poetry_leftmargin_tl + \l_@@_poetry_indent_tl }
{ \dim_zero:N \l_@@_poetry_chap_parshape_correction_dim }
{
\dim_set:Nn \l_@@_poetry_chap_parshape_correction_dim
{
- \l_@@_chap_width_dim + \l_@@_chap_sep_tl -
- \l_@@_poetry_leftmargin_tl
+ \g_@@_chap_width_dim + \l_@@_chap_sep_tl -
+ \l_@@_poetry_leftmargin_tl - \l_@@_poetry_indent_tl
}
}
\parshape 2 ~
@@ -4379,12 +6779,9 @@
\box_use:N \l_@@_chap_box
\hook_use:n { scripture / chap / after }
\group_end:
- \bool_lazy_or:nnT
- { \bool_if_p:n \l_@@_chap_show_verse_bool }
- { \bool_if_p:n \g_@@_poetry_midparachap_show_verse_bool }
- {
- \@@_verse_output:n { 1 }
- }
+ \bool_lazy_or:nnT \l_@@_chap_show_verse_bool \l_@@_poetry_midparachap_show_verse_bool
+ { \@@_verse_output:n { 1 } }
+ \hook_use:n { scripture / poetry / pilcrow }
}
% \end{macrocode}
% \end{macro}
@@ -4398,6 +6795,8 @@
\cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
\cs_gset_nopar:Npn \scripturecurrentverse { 1 }
\group_begin:
+ \cs_if_eq:NNT \vs \@@_poetry_mode_vertical_verse:n
+ { \noindent }
\bool_if:NTF \l_@@_chap_show_bool
{
\hbox_overlap_left:n
@@ -4412,12 +6811,8 @@
\skip_horizontal:N \l_@@_chap_sep_tl
\hook_use:n { scripture / chap / after }
}
- \bool_lazy_or:nnT
- { \bool_if_p:n \l_@@_chap_show_verse_bool }
- { \bool_if_p:n \g_@@_poetry_midparachap_show_verse_bool }
- {
- \@@_verse_output:n { 1 }
- }
+ \bool_lazy_or:nnT \l_@@_chap_show_verse_bool \l_@@_poetry_midparachap_show_verse_bool
+ { \@@_verse_output:n { 1 } }
}
{
\hook_use:n { scripture / chap / before }
@@ -4425,46 +6820,66 @@
\vs { 1 }
}
\group_end:
+ \hook_use:n { scripture / poetry / pilcrow }
}
% \end{macrocode}
% \end{macro}
%
-%
% \begin{macro}{\@@_poetry_mode_vertical_verse:n}
-% Format a verse for poetry scripture quotations in vertical and horizontal
-% mode.
+% Format a verse for poetry scripture quotations in vertical mode.
% \begin{macrocode}
\cs_new_protected:Nn \@@_poetry_mode_vertical_verse:n
{
\group_begin:
\tl_set_eq:NN \l_@@_verse_sep_tl \l_@@_poetry_verse_sep_tl
+ \hook_gclear_next_code:n { scripture / pilcrow }
\strut
- \bool_if:NTF \l_@@_poetry_verse_right_bool
+ \int_compare:nNnTF \g_@@_chap_par_prevgraf_int = 1
{
- \hbox_overlap_left:n
- {
- \@@_verse_output:n { #1 }
- }
+ \@@_verse_output:n { #1 }
}
{
- \hbox_overlap_left:n
+ \bool_if:NTF \l_@@_poetry_verse_right_bool
{
- \hbox_overlap_right:n
+ \hbox_overlap_left:n
{
\@@_verse_output:n { #1 }
}
- \skip_horizontal:N \l_@@_poetry_leftmargin_tl
}
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_overlap_right:n
+ {
+ \@@_verse_output:n { #1 }
+ }
+ \skip_horizontal:N \l_@@_poetry_leftmargin_tl
+ }
+ }
}
\group_end:
+ \bool_if:NF \g_@@_suppress_next_pilcrow_bool
+ { \hook_use:n { scripture / poetry / pilcrow } }
}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_poetry_mode_horizontal_verse:n}
+% Format a verse for poetry scripture quotations in horizontal mode.
+% \begin{macrocode}
\cs_new_protected:Nn \@@_poetry_mode_horizontal_verse:n
{
\group_begin:
\tl_set_eq:NN \l_@@_verse_sep_tl \l_@@_poetry_verse_sep_tl
- \skip_horizontal:n { -\listparindent }
- \@@_poetry_mode_vertical_verse:n { #1 }
- \skip_horizontal:N \listparindent
+ \int_compare:nNnTF \g_@@_chap_par_prevgraf_int = 1
+ {
+ \@@_poetry_mode_vertical_verse:n { #1 }
+ }
+ {
+ \skip_horizontal:n { -\listparindent }
+ \@@_poetry_mode_vertical_verse:n { #1 }
+ \skip_horizontal:N \listparindent
+ }
\group_end:
}
% \end{macrocode}
@@ -4475,16 +6890,8 @@
% \begin{macrocode}
\cs_new_protected:Nn \@@_poetry_par:
{
- \mode_if_vertical:TF
- {
- \cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n
- \noindent
- }
- {
- \cs_set_eq:NN \vs \@@_poetry_mode_horizontal_verse:n
- \@@_tmp_para_end:
- \int_set_eq:NN \l_@@_poetry_prevgraf_int \prevgraf
- }
+ \para_end:
+ \int_set:Nn \l_@@_poetry_prevgraf_int { \int_use:N \prevgraf }
\parshape 2 ~
\@totalleftmargin ~
\linewidth ~
@@ -4506,16 +6913,68 @@
\cs_gset_protected_nopar:Nn \@@_obeylines: %
{%
\char_set_catcode_active:N \^^M%
- \cs_set_eq:NN ^^M \@@_obeylines_end:%
+ \cs_set_eq:NN ^^M \@@_obeylines_eol:%
}%
\group_end:
-\cs_new_protected:Nn \@@_obeylines_end:
+\cs_new_protected:Nn \@@_obeylines_eol:
{
- \peek_meaning:NF \end
+ \mode_if_vertical:TF
{
- \par
- \int_set:Nn \l_@@_poetry_prevgraf_int { \int_use:N \prevgraf }
+ \cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n
+ \hook_gput_next_code:nn { scripture / poetry / para / after }
+ { \bool_set_false:N \l_@@_poetry_midparachap_show_verse_bool }
}
+ { \cs_set_eq:NN \vs \@@_poetry_mode_horizontal_verse:n }
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:nF
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
+ {
+ \bool_set_eq:NN \l_@@_poetry_midparachap_show_verse_bool \l_@@_midparachap_show_verse_bool
+ \@@_poetry_par:
+ \peek_analysis_map_break:n { ##1 }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \end }
+ { \peek_analysis_map_break:n { ##1 } }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \extraskip }
+ { \peek_analysis_map_break:n { ##1 } }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nopilcrow }
+ {
+ \@@_poetry_par:
+ \cs_if_eq:NNT \vs \@@_poetry_mode_vertical_verse:n
+ { \noindent }
+ \peek_analysis_map_break:n
+ {
+ \@@_fix_protrusion:o { ##1 }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ {
+ \@@_poetry_par:
+ \cs_if_eq:NNT \vs \@@_poetry_mode_vertical_verse:n
+ { \noindent }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \@@_obeylines_eol: }
+ { \cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n }
+ }
+ {
+ \@@_poetry_par:
+ \cs_if_eq:NNT \vs \@@_poetry_mode_vertical_verse:n
+ { \noindent }
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \@@_pilcrow_output:
+ \bool_set_false:N \l_@@_verse_para_bool
+ \bool_set_false:N \l_@@_pilcrow_bool
+ }
+ \peek_analysis_map_break:n
+ {
+ \@@_fix_protrusion:o { ##1 }
+ }
+ }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -4530,11 +6989,17 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l_@@_active_inner_bool
- \tl_set:Nn \l_@@_currenvir_str { poetry }
+ \str_set:Nn \l_@@_currenvir_str { poetry }
\bool_gset_false:N \g_@@_poetry_midparachap_show_verse_bool
- \DeclareDocumentCommand { \ch } { sm } { \@@_poetry_ch:n { ##2 } }
+ \DeclareDocumentCommand { \ch } { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l_@@_X_char_tl { ##2 }
+ }
+ \@@_poetry_ch:n { ##3 }
+ }
\cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n
- \cs_set_eq:NN \extraskip \@@_poetry_extra_skip:
\cs_set_eq:NN \selah \@@_selah_output:
\cs_set_protected_nopar:Npn \textright ##1
{ \@@_poetry_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } }
@@ -4541,8 +7006,20 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l_@@_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
+ \cs_set_eq:NN \noindent \tex_noindent:D
+ \hook_gput_next_code:nn { scripture / poetry / pilcrow }
+ {
+ \@@_pilcrow_output:
+ \bool_set_false:N \l_@@_pilcrow_bool
+ \bool_set_false:N \l_@@_verse_para_bool
+ }
\list { }
{
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g_@@_para_mode_vertical_bool }
+ { \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l_@@_poetry_leftmargin_tl
\dim_set_eq:NN \rightmargin \l_@@_poetry_rightmargin_tl
@@ -4562,10 +7039,6 @@
\dim_set_eq:NN \parindent \l_@@_poetry_indent_tl
\item
\relax
- \cs_set_eq:NN \@@_tmp_para_end: \par
- \cs_set_eq:NN \par \@@_poetry_par:
- \hook_gput_next_code:nn { para / after }
- { \bool_gset_eq:NN \g_@@_poetry_midparachap_show_verse_bool \l_@@_midparachap_show_verse_bool }
}
% \end{macrocode}
% \end{macro}
@@ -4582,6 +7055,8 @@
\skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+ \hook_gclear_next_code:n { scripture / poetry / pilcrow }
\bool_gset_true:N \g_@@_poetry_end_bool
\hook_gput_next_code:nn { para / begin }
{ \bool_gset_false:N \g_@@_poetry_end_bool }
@@ -4593,7 +7068,7 @@
% \subsection{Public \LaTeX{} Interface}
%
% \begin{macro}{\scripturecurrentchapter, \scripturecurrentverse}
-% Globally stores the most recent argument of \cs{ch} and \cs{vs}. These
+% Globally stores the most recent argument of \fn{ch} and \fn{vs}. These
% could be used in hooks, for example.
% \begin{macrocode}
\cs_set_nopar:Npn \scripturecurrentchapter { }
@@ -4620,8 +7095,9 @@
% \item \meta{|options|} to set for the style.
% \end{arguments}
% Set key-value settings to be applied when using the \opt{style} option
-% with value \val{name}. The starred version appends the \val{options} to
-% any existing ones.
+% with value \val{name}. You may want to pass \opt{defaults} as the first
+% option to ensure any unset options in your style are expected defaults.
+% The starred version appends the \val{options} to any existing ones.
% \begin{macrocode}
\NewDocumentCommand { \scripturestyle } { s m m }
{
@@ -4663,7 +7139,7 @@
% \begin{macrocode}
\NewDocumentEnvironment { scripture } { o o }
{
- \@@_begin:n { #2 }
+ \@@_begin:nn { #1 } { #2 }
% \end{macrocode}
% \begin{envmacro}{center}
% \begin{arguments}
@@ -4673,7 +7149,7 @@
\DeclareDocumentEnvironment { center } { o }
{
\@@_center_begin:n { ##1 }
- \ignorespaces
+ \@@_reference_start_peek:
}
{ \@@_center_end: }
% \end{macrocode}
@@ -4686,7 +7162,7 @@
\DeclareDocumentEnvironment { flushright } { o }
{
\@@_flushright_begin:n { ##1 }
- \ignorespaces
+ \@@_reference_start_peek:
}
{ \@@_flushright_end: }
% \end{macrocode}
@@ -4699,7 +7175,7 @@
\DeclareDocumentEnvironment { hanging } { o }
{
\@@_hanging_begin:n { ##1 }
- \ignorespaces
+ \@@_reference_start_peek:
}
{ \@@_hanging_end: }
% \end{macrocode}
@@ -4710,7 +7186,7 @@
\DeclareDocumentEnvironment { midparachap } { o }
{
\@@_mid_para_chap_begin:n { ##1 }
- \ignorespaces
+ \@@_reference_start_peek:
}
{ \@@_mid_para_chap_end: }
% \end{macrocode}
@@ -4723,7 +7199,7 @@
\DeclareDocumentEnvironment { narrow } { o }
{
\@@_narrow_begin:n { ##1 }
- \ignorespaces
+ \@@_reference_start_peek:
}
{ \@@_narrow_end: }
% \end{macrocode}
@@ -4732,19 +7208,19 @@
% \begin{arguments}
% \item \meta{|options|} to set.
% \end{arguments}
-% The \env{poetryaux} environment is required because \cs{@@_obeylines:}
+% The \val{poetryaux} environment is required because \cs{@@_obeylines:}
% breaks the reading of optional arguments.
% \begin{macrocode}
\DeclareDocumentEnvironment { poetryaux } { o }
{
\tl_if_novalue:nF { ##1 }
- {
- \keys_set:nn
- { scripture / poetry }
- { ##1 }
- }
+ {
+ \keys_set:nn
+ { scripture / poetry }
+ { ##1 }
+ }
\@@_poetry_begin:
- \ignorespaces
+ \@@_reference_start_peek:
}
{ \@@_poetry_end: }
\DeclareDocumentEnvironment { poetry } { }
@@ -4766,19 +7242,91 @@
\tl_set_eq:NN \l_@@_ref_sep_tl \l_@@_inline_ref_sep_tl
\cs_set_eq:NN \@@_version_format:n \@@_inline_version_format:n
\tl_set_eq:NN \l_@@_version_delim_tl \l_@@_inline_version_delim_tl
+ \bool_set_false:N \l_@@_chap_para_bool
\bool_set_true:N \l_@@_compact_bool
+ \bool_set_false:N \l_@@_heading_show_bool
}
+ \bool_if:NT \l_@@_chap_para_bool
+ {
+ \RenewDocumentEnvironment { midparachap } { o } { \ignorespaces } { \unskip }
+ }
+ \bool_if:NT \l_@@_verse_para_bool
+ {
+ \cs_set_eq:NN \vs \@@_verse_para_output:n
+ \cs_set_eq:NN \par \@@_para_par:
+ \cs_set_eq:NN \@par \@@_para_par:
+ \cs_set_eq:NN \@doendpe \@@_doendpe:
+ \cs_set_eq:NN \noindent \@@_para_noindent:
+ \cs_set_protected:Npn \\
+ {
+ \mode_if_horizontal:TF
+ { \unskip }
+ { \@nolnerr }
+ }
+ \RenewDocumentEnvironment { midparachap } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { midparachap }
+ \cs_set_eq:NN \noindent \tex_noindent:D
+ \cs_set_eq:cN { end ~ } \@@_mid_para_chap_end:n
+ \@@_reference_start_peek:
+ }
+ {
+ \para_end:
+ \bool_gset_false:N \g_@@_suppress_next_pilcrow_bool
+ }
+ }
\bool_if:NT \l_@@_compact_bool
{
- \scripturesetup { chapter / nodrop }
- \RenewDocumentEnvironment { center } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { flushright } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { hanging } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { midparachap } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { narrow } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { poetry } { o } { \ignorespaces } { \unskip }
+ \cs_set_eq:NN \noindent \@@_para_noindent:
+ \bool_if:NF \l_@@_verse_para_bool
+ {
+ \bool_set_false:N \l_@@_chap_drop_bool
+ \bool_set_false:N \l_@@_chap_drop_llap_bool
+ \bool_set_false:N \l_@@_chap_drop_smash_bool
+ \bool_set_false:N \l_@@_chap_para_bool
+ \cs_set_eq:NN \vs \@@_verse_compact_output:n
+ }
+ \bool_gset:Nn \g_@@_mode_vertical_inner_bool
+ { \mode_if_vertical_p: }
+ \RenewDocumentEnvironment { center } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { center }
+ \@@_reference_start_peek:
+ }
+ { \@@_compact_end_inner: }
+ \RenewDocumentEnvironment { flushright } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { flushright }
+ \@@_reference_start_peek:
+ }
+ { \@@_compact_end_inner: }
+ \RenewDocumentEnvironment { hanging } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { hanging }
+ \@@_reference_start_peek:
+ }
+ { \@@_compact_end_inner: }
+ \RenewDocumentEnvironment { midparachap } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { midparachap }
+ \cs_set_eq:cN { end ~ } \@@_mid_para_chap_end:n
+ \@@_reference_start_peek:
+ }
+ { \@@_compact_end_inner: }
+ \RenewDocumentEnvironment { narrow } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { narrow }
+ \@@_reference_start_peek:
+ }
+ { \@@_compact_end_inner: }
+ \RenewDocumentEnvironment { poetry } { o }
+ {
+ \str_set:Nn \l_@@_currenvir_str { poetry }
+ \@@_reference_start_peek:
+ }
+ { \@@_compact_end_inner: }
\cs_set_eq:NN \\ \unskip
- \cs_set_eq:NN \par \relax
+ \cs_set_eq:NN \par \@@_compact_par:
\cs_set_eq:NN \extraskip \relax
\cs_set_eq:NN \nohang \relax
\cs_set:Npn \selah
@@ -4796,14 +7344,13 @@
\c_space_tl
##1
}
- \mode_leave_vertical:
}
- \ignorespaces
+ \@@_reference_start_peek:
}
{
- \bool_if:NT \l_@@_compact_bool
- { \cs_set_eq:NN \par \endgraf }
- \@@_end:n { #1 }
+ \bool_lazy_or:nnT \l_@@_compact_bool \l_@@_verse_para_bool
+ { \cs_set_eq:NN \par \para_end: }
+ \@@_end:
}
% \end{macrocode}
% \end{envmacro}
Modified: trunk/Master/texmf-dist/source/latex/scripture/scripture.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/scripture/scripture.ins 2025-01-02 20:33:47 UTC (rev 73275)
+++ trunk/Master/texmf-dist/source/latex/scripture/scripture.ins 2025-01-02 20:33:56 UTC (rev 73276)
@@ -1,6 +1,6 @@
\iffalse meta-comment
-Copyright (c) 2022-2023 David Purton <dcpurton at marshwiggle.net>
+Copyright (c) 2022-2025 David Purton <dcpurton at marshwiggle.net>
This work may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.3c of this license
Modified: trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty 2025-01-02 20:33:47 UTC (rev 73275)
+++ trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty 2025-01-02 20:33:56 UTC (rev 73276)
@@ -25,8 +25,17 @@
%% and the derived files scripture.sty and scripture.pdf
%%
\NeedsTeXFormat{LaTeX2e}[2022-11-01]
-\ProvidesExplPackage{scripture}{2023/12/27}{2.0}
+\ProvidesExplPackage{scripture}{2025/01/02}{2.1}
{Format Scripture Quotations (DCP)}
+\bool_new:N \l__scripture_textdir_change_in_group_bool
+\cs_new_protected:Nn \__scripture_set_textdirection:
+ {
+ \sys_if_engine_luatex:T
+ {
+ \textdirection \int_use:N \textdirection
+ \bool_set_true:N \l__scripture_textdir_change_in_group_bool
+ }
+ }
\msg_new:nnnn { scripture } { nested-environment }
{ Nesting~of~scripture~environments~not~supported. }
{ You~have~tried~to~nest~a~scripture~environment~or \\
@@ -39,6 +48,12 @@
{ Language~requested~without~support. }
{ You~have~requested~language=#1,~but~neither~babel~nor~polyglossia~
have~been~loaded~and~set~up.~Ignoring~option~language=#1. }
+\msg_new:nnnn { scripture } { heading-error }
+ { \token_to_str:N \heading \c_space_tl not~support~within~inner~
+ environments. }
+ { You~have~tried~to~use~\token_to_str:N \heading \c_space_tl within~the~
+ `#1'~environment,~but~this~macro~is~only~supported~in~the~main~
+ `scripture'~environment. }
\msg_new:nnnn { scripture } { unknown-style }
{ Style~#1~not~defined. }
{ You~have~requested~style=#1,~but~it~has~not~been~defined.~
@@ -55,6 +70,12 @@
, added / format .cs_set:Np = \__scripture_added_format:n #1
, added / format .value_required:n = true
, added / format .initial:n = \emph { #1 }
+ , after .tl_set:N = \l__scripture_after_tl
+ , after .value_required:n = true
+ , after .initial:n =
+ , before .tl_set:N = \l__scripture_before_tl
+ , before .value_required:n = true
+ , before .initial:n =
, belowskip .tl_set:N = \l__scripture_belowskip_tl
, belowskip .value_required:n = true
, belowskip .initial:n = \c_zero_skip
@@ -65,6 +86,26 @@
, compact .bool_set:N = \l__scripture_compact_bool
, compact .default:n = true
, compact .initial:n = false
+ , chapter / align .choices:nn = { left, right }
+ {
+ \tl_if_exist:NF \l__scripture_chapter_align_tl
+ { \tl_new:N \l__scripture_chapter_align_tl }
+ \str_case:Vn \l_keys_choice_tl
+ {
+ { left }
+ {
+ \tl_set:Nn \l__scripture_chapter_align_tl
+ { l }
+ }
+ { right }
+ {
+ \tl_set:Nn \l__scripture_chapter_align_tl
+ { r }
+ }
+ }
+ }
+ , chapter / align .value_required:n = true
+ , chapter / align .initial:n = left
, chapter / font .tl_set:N = \l__scripture_chap_font_tl
, chapter / font .value_required:n = true
, chapter / font .initial:n = \bfseries
@@ -82,9 +123,25 @@
, chapter / hide .default:n = true
, chapter / nodrop .bool_set_inverse:N = \l__scripture_chap_drop_bool
, chapter / nodrop .default:n = true
+ , chapter / para .bool_set:N = \l__scripture_chap_para_bool
+ , chapter / para .default:n = true
+ , chapter / para .initial:n = false
+ , chapter / para / aboveskip .tl_set:N = \l__scripture_chap_para_aboveskip_tl
+ , chapter / para / aboveskip .value_required:n = true
+ , chapter / para / aboveskip .initial:n = \bigskipamount
+ , chapter / para / belowskip .tl_set:N = \l__scripture_chap_para_belowskip_tl
+ , chapter / para / belowskip .value_required:n = true
+ , chapter / para / belowskip .initial:n = \medskipamount
+ , chapter / para / indent .code:n = {
+ \bool_set:Nn
+ \l__scripture_chap_para_afterindent_bool
+ { \str_if_eq_p:nn { #1 } { true } }
+ }
+ , chapter / para / indent .default:n = true
+ , chapter / para / indent .initial:n = true
, chapter / sep .tl_set:N = \l__scripture_chap_sep_tl
, chapter / sep .value_required:n = true
- , chapter / sep .initial:n = 0.5 em
+ , chapter / sep .initial:n = 0.5em
, chapter / show .bool_set:N = \l__scripture_chap_show_bool
, chapter / show .default:n = true
, chapter / show .initial:n = true
@@ -91,6 +148,39 @@
, chapter / showverse .bool_set:N = \l__scripture_chap_show_verse_bool
, chapter / showverse .default:n = true
, chapter / showverse .initial:n = false
+ , chapter / smash .bool_set:N = \l__scripture_chap_smash_bool
+ , chapter / smash .default:n = true
+ , chapter / smash .initial:n = false
+ , chapter / valign .choices:nn = { bottom, middle, top }
+ {
+ \tl_if_exist:NF \l__scripture_chapter_valign_tl
+ { \tl_new:N \l__scripture_chapter_valign_tl }
+ \str_case:Vn \l_keys_choice_tl
+ {
+ { bottom }
+ {
+ \tl_set:Nn \l__scripture_chapter_valign_tl
+ { b }
+ }
+ { middle }
+ {
+ \tl_set:Nn \l__scripture_chapter_valign_tl
+ { vc }
+ }
+ { top }
+ {
+ \tl_set:Nn \l__scripture_chapter_valign_tl
+ { t }
+ }
+ }
+ }
+ , chapter / valign .value_required:n = true
+ , chapter / valign .initial:n = bottom
+ , chapter / xchar .tl_set:N = \l__scripture_X_char_tl
+ , chapter / xchar .value_required:n = true
+ , chapter / xchar .initial:n = X
+ , defaults .code:n = \cs_if_exist_use:N \__scripture_setup_reset_defaults:
+ , defaults .value_forbidden:n = true
, extraskip .tl_set:N = \l__scripture_extraskip_tl
, extraskip .value_required:n = true
, extraskip .initial:n = \medskipamount
@@ -97,6 +187,51 @@
, font .tl_set:N = \l__scripture_font_tl
, font .value_required:n = true
, font .initial:n =
+ , heading / aboveskip .tl_set:N = \l__scripture_heading_aboveskip_tl
+ , heading / aboveskip .value_required:n = true
+ , heading / aboveskip .initial:n = \bigskipamount
+ , heading / afterindent .bool_set:N = \l__scripture_heading_afterindent_bool
+ , heading / afterindent .default:n = true
+ , heading / afterindent .initial:n = false
+ , heading / align .choices:nn = { left, right, center }
+ {
+ \tl_if_exist:NF \l__scripture_heading_align_tl
+ { \tl_new:N \l__scripture_heading_align_tl }
+ \str_case:Vn \l_keys_choice_tl
+ {
+ { left }
+ {
+ \tl_set:Nn \l__scripture_heading_align_tl
+ { \raggedright }
+ }
+ { right }
+ {
+ \tl_set:Nn \l__scripture_heading_align_tl
+ { \raggedleft }
+ }
+ { center }
+ {
+ \tl_set:Nn \l__scripture_heading_align_tl
+ { \centering }
+ }
+ }
+ }
+ , heading / align .value_required:n = true
+ , heading / align .initial:n = left
+ , heading / belowskip .tl_set:N = \l__scripture_heading_belowskip_tl
+ , heading / belowskip .value_required:n = true
+ , heading / belowskip .initial:n = \medskipamount
+ , heading / font .tl_set:N = \l__scripture_heading_font_tl
+ , heading / font .value_required:n = true
+ , heading / font .initial:n = \small\itshape
+ , heading / format .cs_set:Np = \__scripture_heading_format:n #1
+ , heading / format .value_required:n = true
+ , heading / format .initial:n = #1
+ , heading / hide .bool_set_inverse:N = \l__scripture_heading_show_bool
+ , heading / hide .default:n = true
+ , heading / show .bool_set:N = \l__scripture_heading_show_bool
+ , heading / show .default:n = true
+ , heading / show .initial:n = true
, indent .bool_set:N = \l__scripture_indent_bool
, indent .default:n = true
, indent .initial:n = true
@@ -105,16 +240,16 @@
, inline .initial:n = false
, inline / begin .tl_set:N = \l__scripture_inline_begin_tl
, inline / begin .value_required:n = true
- , inline / begin .initial:n = ``\,
+ , inline / begin .initial:n = ``
, inline / end .tl_set:N = \l__scripture_inline_end_tl
, inline / end .value_required:n = true
- , inline / end .initial:n = \,''
+ , inline / end .initial:n = ''
, inline / reference / format .cs_set:Np = \__scripture_inline_ref_format:n #1
, inline / reference / format .value_required:n = true
, inline / reference / format .initial:n = (#1)
, inline / reference / sep .tl_set:N = \l__scripture_inline_ref_sep_tl
, inline / reference / sep .value_required:n = true
- , inline / reference / sep .initial:n = 0.5 em
+ , inline / reference / sep .initial:n = 0.5em
, inline / version / delim .tl_set:N = \l__scripture_inline_version_delim_tl
, inline / version / delim .value_required:n = true
, inline / version / delim .initial:n = \c_space_tl
@@ -144,6 +279,12 @@
, parskip .tl_set:N = \l__scripture_parskip_tl
, parskip .value_required:n = true
, parskip .initial:n = \parskip
+ , pilcrow .bool_set:N = \l__scripture_pilcrow_bool
+ , pilcrow .default:n = true
+ , pilcrow .initial:n = false
+ , pilcrow / sep .tl_set:N = \l__scripture_pilcrow_sep_tl
+ , pilcrow / sep .value_required:n = true
+ , pilcrow / sep .initial:n = 0.25em
, redletter .bool_set:N = \l__scripture_red_letter_bool
, redletter .default:n = true
, redletter .initial:n = false
@@ -171,9 +312,28 @@
, reference / format .initial:n = #1
, reference / newline .meta:n = { reference / sep = \linewidth }
, reference / newline .value_forbidden:n = true
+ , reference / position .choices:nn = { start, end }
+ {
+ \tl_if_exist:NF \l__scripture_ref_position_tl
+ { \tl_new:N \l__scripture_ref_position_tl }
+ \tl_set_eq:NN \l__scripture_ref_position_tl \l_keys_choice_tl
+ }
+ , reference / position .value_required:n = true
+ , reference / position .initial:n = end
, reference / sep .tl_set:N = \l__scripture_ref_sep_tl
, reference / sep .value_required:n = true
- , reference / sep .initial:n = 2 em
+ , reference / sep .initial:n = 2em
+ , reference / start / inline .bool_set_inverse:N = \l__scripture_ref_start_newline_bool
+ , reference / start / inline .default:n = true
+ , reference / start / newline .bool_set:N = \l__scripture_ref_start_newline_bool
+ , reference / start / newline .default:n = true
+ , reference / start / newline .initial:n = false
+ , reference / start / sep .tl_set:N = \l__scripture_ref_start_sep_tl
+ , reference / start / sep .value_required:n = true
+ , reference / start / sep .initial:n = 1em
+ , reference / start / vsep .tl_set:N = \l__scripture_ref_vertical_sep_tl
+ , reference / start / vsep .value_required:n = true
+ , reference / start / vsep .initial:n = 0pt
, rightmargin .tl_set:N = \l__scripture_rightmargin_tl
, rightmargin .value_required:n = true
, rightmargin .initial:n = \c_zero_dim
@@ -188,7 +348,7 @@
, selah / format .initial:n = #1
, selah / sep .tl_set:N = \l__scripture_selah_sep_tl
, selah / sep .value_required:n = true
- , selah / sep .initial:n = 1 em
+ , selah / sep .initial:n = 1em
, style .choice:
, style / unknown .code:n = \msg_error:nnx
{ scripture }
@@ -196,7 +356,7 @@
{ \exp_not:n {#1} }
, textright / sep .tl_set:N = \l__scripture_text_right_sep_tl
, textright / sep .value_required:n = true
- , textright / sep .initial:n = 1 em
+ , textright / sep .initial:n = 1em
, verse / colour .tl_set:N = \l__scripture_verse_colour_tl
, verse / colour .value_required:n = true
, verse / colour .initial:n = .
@@ -218,9 +378,15 @@
, verse / format .initial:n = \textsuperscript{#1}
, verse / hide .bool_set_inverse:N = \l__scripture_verse_show_bool
, verse / hide .default:n = true
+ , verse / para .bool_set:N = \l__scripture_verse_para_bool
+ , verse / para .default:n = true
+ , verse / para .initial:n = false
+ , verse / para / indent .tl_set:N = \l__scripture_para_indent_tl
+ , verse / para / indent .value_required:n = true
+ , verse / para / indent .initial:n = \l__scripture_parindent_tl
, verse / sep .tl_set:N = \l__scripture_verse_sep_tl
, verse / sep .value_required:n = true
- , verse / sep .initial:n = 0.05 em
+ , verse / sep .initial:n = 0.05em
, verse / show .bool_set:N = \l__scripture_verse_show_bool
, verse / show .default:n = true
, verse / show .initial:n = true
@@ -233,6 +399,14 @@
, version / format .cs_set:Np = \__scripture_version_format:n #1
, version / format .value_required:n = true
, version / format .initial:n = (#1)
+ , version / position .choices:nn = { withref, end }
+ {
+ \tl_if_exist:NF \l__scripture_version_position_tl
+ { \tl_new:N \l__scripture_version_position_tl }
+ \tl_set_eq:NN \l__scripture_version_position_tl \l_keys_choice_tl
+ }
+ , version / position .value_required:n = true
+ , version / position .initial:n = withref
, center / aboveskip .tl_set:N = \l__scripture_center_aboveskip_tl
, center / aboveskip .value_required:n = true
, center / aboveskip .initial:n = \medskipamount
@@ -263,15 +437,26 @@
, hanging / belowskip .tl_set:N = \l__scripture_hanging_belowskip_tl
, hanging / belowskip .value_required:n = true
, hanging / belowskip .initial:n = \medskipamount
+ , hanging / chapter / indent .bool_set:N = \l__scripture_hanging_chapter_indent_bool
+ , hanging / chapter / indent .default:n = true
+ , hanging / chapter / indent .initial:n = true
, hanging / hang .tl_set:N = \l__scripture_hanging_hang_tl
, hanging / hang .value_required:n = true
- , hanging / hang .initial:n = 2 em
+ , hanging / hang .initial:n = 2em
, hanging / leftmargin .tl_set:N = \l__scripture_hanging_leftmargin_tl
, hanging / leftmargin .value_required:n = true
- , hanging / leftmargin .initial:n = 1 em
+ , hanging / leftmargin .initial:n = 1em
, hanging / rightmargin .tl_set:N = \l__scripture_hanging_rightmargin_tl
, hanging / rightmargin .value_required:n = true
, hanging / rightmargin .initial:n = \c_zero_dim
+ , hanging / verse / left .bool_set_inverse:N = \l__scripture_hanging_verse_right_bool
+ , hanging / verse / left .default:n = true
+ , hanging / verse / right .bool_set:N = \l__scripture_hanging_verse_right_bool
+ , hanging / verse / right .default:n = true
+ , hanging / verse / right .initial:n = true
+ , hanging / verse / sep .tl_set:N = \l__scripture_hanging_verse_sep_tl
+ , hanging / verse / sep .value_required:n = true
+ , hanging / verse / sep .initial:n = 0.05em
, midparachap / hideverse .bool_set_inverse:N = \l__scripture_midparachap_show_verse_bool
, midparachap / hideverse .default:n = true
, midparachap / showverse .bool_set:N = \l__scripture_midparachap_show_verse_bool
@@ -285,10 +470,10 @@
, narrow / belowskip .initial:n = \medskipamount
, narrow / leftmargin .tl_set:N = \l__scripture_narrow_leftmargin_tl
, narrow / leftmargin .value_required:n = true
- , narrow / leftmargin .initial:n = 1 em
+ , narrow / leftmargin .initial:n = 1em
, narrow / rightmargin .tl_set:N = \l__scripture_narrow_rightmargin_tl
, narrow / rightmargin .value_required:n = true
- , narrow / rightmargin .initial:n = 1 em
+ , narrow / rightmargin .initial:n = 1em
, poetry / aboveskip .tl_set:N = \l__scripture_poetry_aboveskip_tl
, poetry / aboveskip .value_required:n = true
, poetry / aboveskip .initial:n = \medskipamount
@@ -297,13 +482,13 @@
, poetry / belowskip .initial:n = \medskipamount
, poetry / bigindent .tl_set:N = \l__scripture_poetry_big_indent_tl
, poetry / bigindent .value_required:n = true
- , poetry / bigindent .initial:n = 4 em
+ , poetry / bigindent .initial:n = 4em
, poetry / indent .tl_set:N = \l__scripture_poetry_indent_tl
, poetry / indent .value_required:n = true
- , poetry / indent .initial:n = 1 em
+ , poetry / indent .initial:n = 1em
, poetry / leftmargin .tl_set:N = \l__scripture_poetry_leftmargin_tl
, poetry / leftmargin .value_required:n = true
- , poetry / leftmargin .initial:n = 1 em
+ , poetry / leftmargin .initial:n = 1em
, poetry / rightmargin .tl_set:N = \l__scripture_poetry_rightmargin_tl
, poetry / rightmargin .value_required:n = true
, poetry / rightmargin .initial:n = \c_zero_dim
@@ -314,9 +499,127 @@
, poetry / verse / right .initial:n = true
, poetry / verse / sep .tl_set:N = \l__scripture_poetry_verse_sep_tl
, poetry / verse / sep .value_required:n = true
- , poetry / verse / sep .initial:n = 0.05 em
+ , poetry / verse / sep .initial:n = 0.05em
}
\ProcessKeyOptions
+\tl_new:N \l__scripture_default_options_tl
+\keys_precompile:nnN { scripture }
+ {
+ , aboveskip = \c_zero_skip
+ , added / font =
+ , added / format = \emph { #1 }
+ , after =
+ , before =
+ , belowskip = \c_zero_skip
+ , colour = .
+ , compact = false
+ , chapter / align = left
+ , chapter / font = \bfseries
+ , chapter / colour = .
+ , chapter / drop = true
+ , chapter / format = #1
+ , chapter / para = false
+ , chapter / para / aboveskip = \bigskipamount
+ , chapter / para / belowskip = \medskipamount
+ , chapter / para / indent = true
+ , chapter / sep = 0.5em
+ , chapter / show = true
+ , chapter / showverse = false
+ , chapter / smash = false
+ , chapter / valign = bottom
+ , chapter / xchar = X
+ , extraskip = \medskipamount
+ , font =
+ , heading / aboveskip = \bigskipamount
+ , heading / afterindent = false
+ , heading / align = left
+ , heading / belowskip = \medskipamount
+ , heading / font = \small\itshape
+ , heading / format = #1
+ , heading / show = true
+ , indent = true
+ , inline = false
+ , inline / begin = ``
+ , inline / end = ''
+ , inline / reference / format = (#1)
+ , inline / reference / sep = 0.5em
+ , inline / version / delim = \c_space_tl
+ , inline / version / format = #1
+ , language =
+ , language / variant =
+ , leftmargin = \c_zero_dim
+ , name / font = \scshape
+ , name / format = #1
+ , parindent = \parindent
+ , parskip = \parskip
+ , pilcrow = false
+ , pilcrow / sep = 0.25em
+ , redletter = false
+ , redletter / colour = red!80!black
+ , reference / align = right
+ , reference / colour = .
+ , reference / font = \bfseries
+ , reference / format = #1
+ , reference / position = end
+ , reference / sep = 2em
+ , reference / start / newline = false
+ , reference / start / sep = 1em
+ , reference / start / vsep = 0pt
+ , rightmargin = \c_zero_dim
+ , selah / text = Selah
+ , selah / font = \itshape
+ , selah / format = #1
+ , selah / sep = 1em
+ , textright / sep = 1em
+ , verse / colour = .
+ , verse / first = false
+ , verse / firstformat = #1
+ , verse / firstsep = 0.5em
+ , verse / font =
+ , verse / format = \textsuperscript{#1}
+ , verse / para = false
+ , verse / para / indent = \l__scripture_parindent_tl
+ , verse / sep = 0.05em
+ , verse / show = true
+ , version =
+ , version / delim = \c_space_tl
+ , version / format = (#1)
+ , version / position = withref
+ , center / aboveskip = \medskipamount
+ , center / belowskip = \medskipamount
+ , center / leftmargin = \c_zero_dim
+ , center / rightmargin = \c_zero_dim
+ , flushright / aboveskip = \medskipamount
+ , flushright / belowskip = \medskipamount
+ , flushright / leftmargin = \c_zero_dim
+ , flushright / rightmargin = \c_zero_dim
+ , hanging / aboveskip = \medskipamount
+ , hanging / belowskip = \medskipamount
+ , hanging / chapter / indent = true
+ , hanging / hang = 2em
+ , hanging / leftmargin = 1em
+ , hanging / rightmargin = \c_zero_dim
+ , hanging / verse / right = true
+ , hanging / verse / sep = 0.05em
+ , midparachap / showverse = true
+ , narrow / aboveskip = \medskipamount
+ , narrow / belowskip = \medskipamount
+ , narrow / leftmargin = 1em
+ , narrow / rightmargin = 1em
+ , poetry / aboveskip = \medskipamount
+ , poetry / belowskip = \medskipamount
+ , poetry / bigindent = 4em
+ , poetry / indent = 1em
+ , poetry / leftmargin = 1em
+ , poetry / rightmargin = \c_zero_dim
+ , poetry / verse / right = true
+ , poetry / verse / sep = 0.05em
+ }
+ \l__scripture_default_options_tl
+\cs_new_protected:Nn \__scripture_setup_reset_defaults:
+ {
+ \l__scripture_default_options_tl
+ }
\cs_new_protected:Nn \__scripture_setup_style:nnn
{
\bool_if:NTF #1
@@ -335,22 +638,43 @@
\cs_generate_variant:Nn \__scripture_setup_style:nnn { nne }
\hook_new_pair:nn { scripture / chap / before } { scripture / chap / after }
\hook_new_pair:nn { scripture / verse / before } { scripture / verse / after }
+\hook_new:n { scripture / pilcrow }
+\hook_new:n { scripture / poetry / pilcrow }
\bool_new:N \l__scripture_active_bool
\bool_new:N \l__scripture_active_inner_bool
+\bool_new:N \g__scripture_mode_vertical_inner_bool
\int_new:N \l__scripture_clubpenalty_saved_int
\skip_new:N \g__scripture_prev_inner_below_skip
\dim_new:N \l__scripture_outer_itemindent_dim
\cs_new_protected_nopar:Nn \__scripture_setup_list_noindent:n
{
- \legacy_if:nT {@newlist}
+ \legacy_if:nT { @newlist }
{
\cs_set_protected_nopar:Npn \noindent
{
\skip_horizontal:n { -#1 }
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \peek_meaning:NTF \vs
+ {
+ \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+ \__scripture_set_pilcrow_hook:
+ }
+ {
+ \str_if_eq:VnF \l__scripture_currenvir_str { poetry }
+ { \__scripture_pilcrow_output: }
+ }
+ }
}
\hook_gput_next_code:nn { para / end }
{
- \cs_gset_eq:NN \noindent \tex_noindent:D
+ \bool_if:NTF \l__scripture_verse_para_bool
+ {
+ \str_if_eq:VnTF \l__scripture_currenvir_str { poetry }
+ { \cs_set_eq:NN \noindent \tex_noindent:D }
+ { \cs_set_eq:NN \noindent \__scripture_para_noindent: }
+ }
+ { \cs_set_eq:NN \noindent \tex_noindent:D }
}
}
}
@@ -367,6 +691,7 @@
}
\cs_new_protected:Nn \__scripture_extra_skip:
{
+ \mode_if_vertical:F \para_end:
\int_compare:nNnT
\g__scripture_chap_par_prevgraf_int = 1
{
@@ -409,7 +734,7 @@
}
}
\box_new:N \l__scripture_ref_box
-\cs_new_protected:Nn \__scripture_format_full_ref:n
+\cs_new_protected:Nn \__scripture_format_full_ref:nn
{
\group_begin:
\l__scripture_ref_font_tl
@@ -418,11 +743,11 @@
\__scripture_ref_format:n
{
#1
- \tl_if_empty:NF \l__scripture_version_tl
+ \tl_if_empty:oF { #2 }
{
- \tl_if_empty:nF { #1 }
+ \tl_if_empty:oF { #1 }
{ \l__scripture_version_delim_tl }
- \__scripture_version_format:n { \l__scripture_version_tl }
+ \__scripture_version_format:n { #2 }
}
}
\group_end:
@@ -431,7 +756,7 @@
{
\hbox_set:Nn \l__scripture_ref_box
{
- \__scripture_format_full_ref:n { #1 }
+ \__scripture_format_full_ref:nn { #1 } \l__scripture_version_tl
}
\dim_compare:nNnT
{ \box_wd:N \l__scripture_ref_box + \g__scripture_final_line_dim + \l__scripture_ref_sep_tl }
@@ -456,6 +781,337 @@
}
\box_use:N \l__scripture_ref_box
}
+\cs_new_protected:Nn \__scripture_reference_start_inline:
+ {
+ \tl_if_empty:NF \l__scripture_ref_tl
+ {
+ \tl_if_eq:NnTF \l__scripture_version_position_tl { withref }
+ { \__scripture_format_full_ref:nn { \l__scripture_ref_tl } { \l__scripture_version_tl } }
+ { \__scripture_format_full_ref:nn { \l__scripture_ref_tl } { } }
+ \skip_horizontal:N \l__scripture_ref_start_sep_tl
+ }
+ }
+\cs_new_protected:Nn \__scripture_reference_start_newline:
+ {
+ \tl_if_empty:NF \l__scripture_ref_tl
+ {
+ \bool_gset_eq:NN \g_tmpa_bool \g__scripture_suppress_next_pilcrow_bool
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \noindent
+ \bool_gset_eq:NN \g__scripture_suppress_next_pilcrow_bool \g_tmpa_bool
+ \str_if_eq:VnF \l__scripture_currenvir_str { scripture }
+ { \skip_horizontal:n { -\leftmargin } }
+ \tl_if_eq:NnTF \l__scripture_version_position_tl { withref }
+ { \__scripture_format_full_ref:nn { \l__scripture_ref_tl } { \l__scripture_version_tl } }
+ { \__scripture_format_full_ref:nn { \l__scripture_ref_tl } { } }
+ \bool_lazy_or:nnT
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { flushright } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { center } }
+ {
+ \hfill
+ \strut
+ }
+ \bool_if:NTF \l__scripture_compact_bool
+ { \para_end: }
+ {
+ \bool_lazy_all:nTF
+ {
+ { \l__scripture_verse_para_bool }
+ { \bool_not_p:n { \str_if_eq_p:Vn \l__scripture_currenvir_str { hanging } } }
+ { \bool_not_p:n { \str_if_eq_p:Vn \l__scripture_currenvir_str { poetry } } }
+ }
+ { \para_end: }
+ { \par }
+ }
+ \nobreak
+ \@afterheading
+ \addvspace { \l__scripture_ref_vertical_sep_tl }
+ }
+ }
+\cs_new_protected:Nn \__scripture_reference_start_peek:
+ {
+ \peek_remove_spaces:n
+ {
+ \bool_lazy_and:nnTF
+ { \str_if_eq_p:Vn \l__scripture_ref_position_tl { start } }
+ { \bool_not_p:n { \tl_if_empty_p:N \l__scripture_ref_tl } }
+ {
+ \bool_lazy_or:nnF
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { scripture } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { midparachap } }
+ {
+ \bool_if:NF \l__scripture_compact_bool
+ { \bool_set_true:N \l__scripture_ref_start_newline_bool }
+ }
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:nF
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \heading }
+ { \__scripture_reference_start_newline: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \noindent }
+ {
+ \bool_if:NTF \l__scripture_ref_start_newline_bool
+ { \__scripture_reference_start_newline: }
+ { \__scripture_reference_start_inline: }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nohang }
+ {
+ \bool_if:NTF \l__scripture_ref_start_newline_bool
+ { \__scripture_reference_start_newline: }
+ { \__scripture_reference_start_inline: }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nopilcrow }
+ {
+ \bool_if:NTF \l__scripture_ref_start_newline_bool
+ { \__scripture_reference_start_newline: }
+ { \__scripture_reference_start_inline: }
+ \peek_analysis_map_break:n
+ {
+ ##1
+ \__scripture_fix_protrusion:n { }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \begin }
+ {
+ \bool_if:NF \l__scripture_indent_bool
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \bool_lazy_or:nnT
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { scripture } }
+ { \para_omit_indent: }
+ }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
+ {
+ \bool_if:NTF \l__scripture_ref_start_newline_bool
+ { \__scripture_reference_start_newline: }
+ {
+ \cs_set_eq:NN \__scripture_temp_ch \ch
+ \RenewDocumentCommand \ch { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l__scripture_X_char_tl { ##2 }
+ }
+ \cs_set_eq:NN \ch \__scripture_temp_ch
+ }
+ \__scripture_reference_start_inline:
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ {
+ \bool_if:NTF \l__scripture_ref_start_newline_bool
+ { \__scripture_reference_start_newline: }
+ {
+ \cs_set_eq:NN \__scripture_temp_vs \vs
+ \RenewDocumentCommand \vs { m }
+ { \cs_set_eq:NN \vs \__scripture_temp_vs }
+ \__scripture_reference_start_inline:
+ }
+ }
+ }
+ {
+ \bool_if:NTF \l__scripture_ref_start_newline_bool
+ {
+ \__scripture_reference_start_newline:
+ \bool_if:NTF \l__scripture_compact_bool
+ {
+ \bool_if:NT \g__scripture_mode_vertical_inner_bool
+ { \__scripture_pilcrow_output: }
+ }
+ {
+ \str_if_eq:VnF \l__scripture_currenvir_str { poetry }
+ { \__scripture_pilcrow_output: }
+ }
+ }
+ { \__scripture_reference_start_inline: }
+ }
+ \exp_args:No \token_if_eq_meaning:NNF { ##1 } \begin
+ {
+ \tl_clear:N \l__scripture_ref_tl
+ \tl_if_eq:NnF \l__scripture_version_position_tl { end }
+ { \tl_clear:N \l__scripture_version_tl }
+ }
+ \peek_analysis_map_break:n
+ { \__scripture_fix_protrusion:o { ##1 } }
+ }
+ }
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:nF
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \heading }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \noindent }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nohang }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nopilcrow }
+ {
+ \peek_analysis_map_break:n
+ {
+ ##1
+ \__scripture_fix_protrusion:n { }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \begin }
+ {
+ \bool_if:NF \l__scripture_indent_bool
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \bool_lazy_or:nnT
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { scripture } }
+ { \para_omit_indent: }
+ }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
+ { }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ {
+ \mode_if_vertical:F
+ { \__scripture_set_pilcrow_hook: }
+ }
+ }
+ {
+ \bool_if:NTF \l__scripture_compact_bool
+ {
+ \bool_if:NT \g__scripture_mode_vertical_inner_bool
+ { \__scripture_pilcrow_output: }
+ }
+ {
+ \str_if_eq:VnF \l__scripture_currenvir_str { poetry }
+ { \__scripture_pilcrow_output: }
+ }
+ }
+ \peek_analysis_map_break:n
+ {
+ \__scripture_fix_protrusion:o { ##1 }
+ }
+ }
+ }
+ }
+ }
+\cs_new_protected:Nn \__scripture_compact_par:
+ {
+ \bool_gset_false:N \g__scripture_mode_vertical_inner_bool
+ \dim_set:Nn \parindent { \l__scripture_parindent_tl }
+ \peek_remove_spaces:n
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:n
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \begin }
+ { \bool_gset_true:N \g__scripture_mode_vertical_inner_bool }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { poetry } }
+ { }
+ { \exp_args:No \token_if_letter_p:N { ##1 } }
+ { \__scripture_pilcrow_output: }
+ { \exp_args:No \token_if_active_p:N { ##1 } }
+ { \__scripture_pilcrow_output: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ { \__scripture_set_pilcrow_hook: }
+ }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ }
+ }
+\cs_new_protected:Nn \__scripture_para_noindent:
+ {
+ \legacy_if:nTF { @newlist }
+ {
+ \tex_noindent:D
+ \peek_meaning:NTF \vs
+ {
+ \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+ \__scripture_set_pilcrow_hook:
+ }
+ { \__scripture_pilcrow_output: }
+ }
+ {
+ \peek_meaning:NTF \vs
+ {
+ \bool_if:NT \l__scripture_verse_para_bool
+ { \para_end: }
+ \tex_noindent:D
+ \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+ \__scripture_set_pilcrow_hook:
+ }
+ { \__scripture_pilcrow_output: }
+ }
+ }
+\bool_new:N \g__scripture_para_mode_vertical_bool
+\box_new:N \g__scripture_post_env_indent_box
+\cs_new_protected:Nn \__scripture_para_par:
+ {
+ \bool_gset_true:N \g__scripture_para_mode_vertical_bool
+ \dim_set:Nn \parindent { \l__scripture_parindent_tl }
+ \peek_remove_spaces:n
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:n
+ {
+ { \exp_args:No \token_if_letter_p:N { ##1 } }
+ { \__scripture_pilcrow_output: }
+ { \exp_args:No \token_if_active_p:N { ##1 } }
+ { \__scripture_pilcrow_output: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ { \__scripture_set_pilcrow_hook: }
+ }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ }
+ }
+\cs_new_protected:Nn \__scripture_doendpe:
+ {
+ \box_gclear:N \g__scripture_post_env_indent_box
+ \legacy_if_set_true:n { @endpe }
+ \cs_set_nopar:Npn \par
+ {
+ \@restorepar
+ \clubpenalty \@clubpenalty
+ \everypar { }
+ \par
+ \legacy_if_set_false:n { @endpe }
+ \bool_gset_false:N \g__scripture_suppress_next_pilcrow_bool
+ \__scripture_para_par:
+ }
+ \everypar
+ {
+ \box_gset_to_last:N \g__scripture_post_env_indent_box
+ \hook_gput_next_code:nn { para / after }
+ { \box_gclear:N \g__scripture_post_env_indent_box }
+ \everypar { }
+ \legacy_if_set_false:n { @endpe }
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \box_set_wd:Nn
+ \g__scripture_post_env_indent_box
+ { \l__scripture_para_indent_tl }
+ }
+ }
+ }
+\cs_new_protected:Nn \__scripture_fix_protrusion:n
+ {
+ \bool_if:NTF \l__scripture_compact_bool
+ {
+ \str_if_eq:VnT \l__scripture_currenvir_str { scripture }
+ { \cs_if_exist_use:N \leftprotrusion }
+ }
+ { \cs_if_exist_use:N \leftprotrusion }
+ #1
+ }
+\cs_generate_variant:Nn \__scripture_fix_protrusion:n { o }
\bool_new:N \g__scripture_red_letter_active_bool
\cs_new_protected:Nn \__scripture_red_letter_on:
{
@@ -493,6 +1149,7 @@
{
\@ifpackageloaded { babel }
{
+ \__scripture_set_textdirection:
\selectlanguage { \l__scripture_language_tl }
}
{
@@ -530,16 +1187,23 @@
\box_new:N \l__scripture_chap_tmp_box
\dim_new:N \l__scripture_chap_fontsize_dim
\dim_new:N \l__scripture_chap_height_dim
-\dim_new:N \l__scripture_chap_width_dim
+\dim_new:N \g__scripture_chap_width_dim
\int_new:N \g__scripture_chap_par_prevgraf_int
\dim_new:N \l__scripture_chap_X_height_dim
+\dim_new:N \l__scripture_para_chap_indent_dim
+\coffin_new:N \l__scripture_nodrop_chap_coffin
+\dim_new:N \l__scripture_nodrop_chap_voffset_dim
+\cs_new_protected:Nn \__scripture_get_X_height:
+ {
+ \hbox_set:Nn \l__scripture_chap_tmp_box { \l__scripture_X_char_tl }
+ \dim_set:Nn \l__scripture_chap_X_height_dim
+ { \box_ht:N \l__scripture_chap_tmp_box }
+ }
\cs_new_protected:Nn \__scripture_drop_chap_set_up:n
{
\cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
\cs_gset_nopar:Npn \scripturecurrentverse { 1 }
- \hbox_set:Nn \l__scripture_chap_tmp_box { X }
- \dim_set:Nn \l__scripture_chap_X_height_dim
- { \box_ht:N \l__scripture_chap_tmp_box }
+ \__scripture_get_X_height:
\dim_set:Nn \l__scripture_chap_height_dim
{ \baselineskip + \l__scripture_chap_X_height_dim }
\dim_set:Nn \l__scripture_chap_fontsize_dim
@@ -560,31 +1224,44 @@
{ \exp_args:NV \color_select:n \l__scripture_chapter_colour_tl }
\__scripture_chap_format:n { #1 }
}
- \dim_set:Nn \l__scripture_chap_width_dim
+ \dim_gset:Nn \g__scripture_chap_width_dim
{ \box_wd:N \l__scripture_chap_tmp_box }
\int_set_eq:NN \l__scripture_clubpenalty_saved_int \clubpenalty
\clubpenalty 10000
- \hook_gput_next_code:nn { para / after }
- {
- \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
- \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
- { \penalty 10000 }
- \hook_gput_next_code:nn { para / before }
- { \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int }
- }
+ \bool_if:NF \l__scripture_verse_para_bool
+ {
+ \hook_gput_next_code:nn { para / after }
+ {
+ \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
+ \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+ { \penalty 10000 }
+ \hook_gput_next_code:nn { para / before }
+ { \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int }
+ }
+ }
}
\cs_new_protected:Nn \__scripture_drop_chap_output:
{
- \noindent
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \cs_if_eq:NNTF \noindent \__scripture_para_noindent:
+ {
+ \legacy_if:nTF { @newlist }
+ {
+ \skip_horizontal:n { -\l__scripture_parindent_tl }
+ }
+ { \tex_noindent:D }
+ \__scripture_pilcrow_output:
+ }
+ { \noindent }
\parshape 3 ~
\dim_eval:n
- { \@totalleftmargin + \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
+ { \@totalleftmargin + \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
\dim_eval:n
- { \linewidth - \l__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
+ { \linewidth - \g__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
\dim_eval:n
- { \@totalleftmargin + \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
+ { \@totalleftmargin + \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
\dim_eval:n
- { \linewidth - \l__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
+ { \linewidth - \g__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
\@totalleftmargin ~
\linewidth
\group_begin:
@@ -594,6 +1271,18 @@
\group_end:
\bool_if:NT \l__scripture_chap_show_verse_bool
{ \__scripture_verse_output:n { 1 } }
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \hook_gput_next_code:nn { para / after }
+ {
+ \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
+ \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+ { \penalty 10000 }
+ \hook_gput_next_code:nn { para / before }
+ { \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int }
+ }
+ }
+ \hook_gclear_next_code:n { scripture / pilcrow }
}
\cs_new_protected:Nn \__scripture_nodrop_chap:n
{
@@ -600,21 +1289,58 @@
\cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
\cs_gset_nopar:Npn \scripturecurrentverse { 1 }
\group_begin:
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \legacy_if:nF { @newlist }
+ { \mode_if_vertical:F \para_end: }
+ }
\bool_if:NTF \l__scripture_chap_show_bool
{
+ \__scripture_get_X_height:
+ \hcoffin_set:Nn \l__scripture_nodrop_chap_coffin
+ {
+ \str_if_eq:VnF \l__scripture_chapter_colour_tl { . }
+ { \exp_args:NV \color_select:n \l__scripture_chapter_colour_tl }
+ \l__scripture_chap_font_tl
+ \__scripture_chap_format:n { #1 }
+ \kern \l__scripture_chap_sep_tl
+ }
+ \dim_zero:N \l__scripture_nodrop_chap_voffset_dim
+ \tl_if_eq:NnT \l__scripture_chapter_valign_tl { t }
+ { \dim_set_eq:NN \l__scripture_nodrop_chap_voffset_dim \l__scripture_chap_X_height_dim }
+ \tl_if_eq:NnT \l__scripture_chapter_valign_tl { vc }
+ { \dim_set:Nn \l__scripture_nodrop_chap_voffset_dim { 0.5 \l__scripture_chap_X_height_dim } }
\hook_use:n { scripture / chap / before }
- \group_begin:
- \str_if_eq:VnF \l__scripture_chapter_colour_tl { . }
- { \exp_args:NV \color_select:n \l__scripture_chapter_colour_tl }
- \l__scripture_chap_font_tl
- \__scripture_chap_format:n { #1 }
- \group_end:
- \skip_horizontal:N \l__scripture_chap_sep_tl
+ \bool_if:NTF \l__scripture_chap_smash_bool
+ {
+ \mode_leave_vertical:
+ \smash
+ {
+ \exp_args:NNoo
+ \coffin_typeset:Nnnnn \l__scripture_nodrop_chap_coffin
+ { \l__scripture_chapter_align_tl }
+ { \l__scripture_chapter_valign_tl }
+ { 0pt }
+ { \l__scripture_nodrop_chap_voffset_dim }
+ }
+ }
+ {
+ \exp_args:NNoo
+ \coffin_typeset:Nnnnn \l__scripture_nodrop_chap_coffin
+ { \l__scripture_chapter_align_tl }
+ { \l__scripture_chapter_valign_tl }
+ { 0pt }
+ { \l__scripture_nodrop_chap_voffset_dim }
+ }
+ \nobreak
+ \skip_horizontal:N \c_zero_skip
\hook_use:n { scripture / chap / after }
\bool_if:NT \l__scripture_chap_show_verse_bool
{
\__scripture_verse_output:n { 1 }
}
+ \str_if_eq:VnF \l__scripture_currenvir_str { midparachap }
+ { \__scripture_pilcrow_output: }
}
{
\hook_use:n { scripture / chap / before }
@@ -622,7 +1348,88 @@
\vs { 1 }
}
\group_end:
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ \hook_gclear_next_code:n { scripture / pilcrow }
}
+\cs_new_protected:Nn \__scripture_para_chap:n
+ {
+ \cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
+ \cs_gset_nopar:Npn \scripturecurrentverse { 1 }
+ \group_begin:
+ \skip_zero:N \parskip
+ \bool_if:NTF \l__scripture_chap_show_bool
+ {
+ \dim_set_eq:NN \l__scripture_para_chap_indent_dim \linewidth
+ \str_if_eq:VnTF \l__scripture_currenvir_str { scripture }
+ {
+ \dim_set:Nn \l__scripture_para_chap_indent_dim { 0.5 \l__scripture_para_chap_indent_dim }
+ }
+ {
+ \dim_add:Nn \l__scripture_para_chap_indent_dim { \leftmargin + \rightmargin }
+ \dim_set:Nn \l__scripture_para_chap_indent_dim { 0.5 \l__scripture_para_chap_indent_dim }
+ \dim_sub:Nn \l__scripture_para_chap_indent_dim \leftmargin
+ }
+ \mode_if_vertical:F \para_end:
+ \addvspace { \l__scripture_chap_para_aboveskip_tl }
+ \bool_gset_eq:NN \g_tmpa_bool \g__scripture_suppress_next_pilcrow_bool
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \str_if_eq:VnTF \l__scripture_currenvir_str { midparachap }
+ { \tex_noindent:D }
+ { \noindent }
+ \bool_gset_eq:NN \g__scripture_suppress_next_pilcrow_bool \g_tmpa_bool
+ \skip_horizontal:N \l__scripture_para_chap_indent_dim
+ \hbox_overlap_center:n
+ {
+ \hook_use:n { scripture / chap / before }
+ \group_begin:
+ \str_if_eq:VnF \l__scripture_chapter_colour_tl { . }
+ { \exp_args:NV \color_select:n \l__scripture_chapter_colour_tl }
+ \l__scripture_chap_font_tl
+ \__scripture_chap_format:n { #1 }
+ \group_end:
+ \hook_use:n { scripture / chap / after }
+ }
+ \para_end:
+ \nobreak
+ \bool_lazy_any:nTF
+ {
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { scripture } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { narrow } }
+ }
+ { \legacy_if_set:nn { @afterindent } { \l__scripture_chap_para_afterindent_bool } }
+ { \legacy_if_set_true:n { @afterindent } }
+ \@afterheading
+ }
+ {
+ \hook_use:n { scripture / chap / before }
+ \hook_use:n { scripture / chap / after }
+ }
+ \peek_meaning:NTF \c_space_token
+ {
+ \addvspace { \l__scripture_chap_para_belowskip_tl }
+ \group_end:
+ \hook_use:n { scripture / poetry / pilcrow }
+ }
+ {
+ \addvspace { \l__scripture_chap_para_belowskip_tl }
+ \cs_if_eq:NNTF \vs \__scripture_poetry_mode_vertical_verse:n
+ {
+ \bool_gset_eq:NN \g_tmpa_bool \g__scripture_suppress_next_pilcrow_bool
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \noindent
+ \vs { 1 }
+ \bool_gset_eq:NN \g__scripture_suppress_next_pilcrow_bool \g_tmpa_bool
+ }
+ {
+ \str_if_eq:VnT \l__scripture_currenvir_str { midparachap }
+ { \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool }
+ \vs { 1 }
+ }
+ \group_end:
+ \hook_use:n { scripture / poetry / pilcrow }
+ }
+ }
\cs_new_protected:Nn \__scripture_chap:n
{
\__scripture_drop_chap_set_up:n { #1 }
@@ -643,8 +1450,10 @@
\bool_if:NTF \l__scripture_mid_para_chap_bool
{ \__scripture_mid_para_drop_chap_output: }
{
- \par
+ \para_end:
\__scripture_drop_chap_output:
+ \str_if_eq:VnF \l__scripture_currenvir_str { midparachap }
+ { \__scripture_pilcrow_output: }
}
\hook_gput_next_code:nn { para / before }
{
@@ -651,7 +1460,19 @@
\legacy_if:nF { @newlist }
{
\int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
- { \extraskip }
+ {
+ \dim_compare:nNnT \parskip < \baselineskip
+ {
+ \dim_compare:nNnT { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \para_omit_indent:
+ \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ }
+ }
+ }
+ }
\int_gzero:N \g__scripture_chap_par_prevgraf_int
}
\parshape 1 ~ \@totalleftmargin ~ \linewidth
@@ -659,6 +1480,7 @@
}
\bool_new:N \l__scripture_verse_par_start_bool
\bool_new:N \l__scripture_no_verse_first_bool
+\bool_new:N \g__scripture_suppress_next_verse_para_bool
\cs_new_protected:Nn \__scripture_verse_output:n
{
\cs_gset_nopar:Npn \scripturecurrentverse { #1 }
@@ -674,6 +1496,11 @@
\bool_set_false:N \l__scripture_no_verse_first_bool
}
\group_begin:
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \box_if_empty:NF \g__scripture_post_env_indent_box
+ { \box_use_drop:N \g__scripture_post_env_indent_box }
+ }
\hook_use:n { scripture / verse / before }
\bool_if:NT \l__scripture_verse_show_bool
{
@@ -697,10 +1524,87 @@
\group_end:
\kern \l__scripture_verse_sep_tl
}
+ \nobreak
+ \skip_horizontal:N \c_zero_skip
}
\hook_use:n { scripture / verse / after }
+ \hook_use:n { scripture / pilcrow }
\group_end:
}
+\cs_new_protected:Nn \__scripture_verse_compact_output:n
+ {
+ \mode_if_vertical:T
+ { \__scripture_set_pilcrow_hook: }
+ \__scripture_verse_output:n { #1 }
+ }
+\cs_new_protected:Nn \__scripture_verse_para_output:n
+ {
+ \mode_if_vertical:T
+ { \__scripture_set_pilcrow_hook: }
+ \hook_if_empty:nT { scripture / pilcrow }
+ { \dim_set:Nn \parindent \l__scripture_para_indent_tl }
+ \bool_if:NTF \g__scripture_suppress_next_verse_para_bool
+ { \bool_gset_false:N \g__scripture_suppress_next_verse_para_bool }
+ {
+ \legacy_if:nF { @newlist }
+ {
+ \mode_if_vertical:F
+ {
+ \para_end:
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ }
+ }
+ \__scripture_verse_output:n { #1 }
+ }
+\cs_new_protected:Nn \__scripture_hanging_verse_para:n
+ {
+ \mode_if_vertical:T
+ { \__scripture_set_pilcrow_hook: }
+ \bool_if:NF \g__scripture_suppress_next_verse_para_bool
+ {
+ \legacy_if:nF { @newlist }
+ {
+ \mode_if_vertical:F
+ {
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \hook_gput_next_code:nn { para / begin }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ \par
+ \tex_noindent:D
+ }
+ }
+ }
+ \bool_gset_false:N \g__scripture_suppress_next_verse_para_bool
+ \__scripture_hanging_verse:n { #1 }
+ }
+\bool_new:N \g__scripture_suppress_next_pilcrow_bool
+\cs_new_protected:Nn \__scripture_set_pilcrow_hook:
+ {
+ \hook_if_empty:nT { scripture / pilcrow }
+ {
+ \hook_gput_next_code:nn { scripture / pilcrow } { \__scripture_pilcrow_output: }
+ }
+ }
+\cs_new_protected:Nn \__scripture_pilcrow_output:
+ {
+ \bool_gset_false:N \g__scripture_para_mode_vertical_bool
+ \bool_gset_false:N \g__scripture_mode_vertical_inner_bool
+ \bool_if:NT \l__scripture_pilcrow_bool
+ {
+ \bool_lazy_or:nnT \l__scripture_verse_para_bool \l__scripture_compact_bool
+ {
+ \bool_if:NTF \g__scripture_suppress_next_pilcrow_bool
+ { \bool_gset_false:N \g__scripture_suppress_next_pilcrow_bool }
+ {
+ \P
+ \kern \l__scripture_pilcrow_sep_tl
+ \nobreak
+ \skip_horizontal:N \c_zero_skip
+ }
+ }
+ }
+ }
\dim_new:N \g__scripture_final_line_dim
\cs_new_protected:Nn \__scripture_calc_final_line_length:
{
@@ -709,25 +1613,35 @@
\skip_zero:N \belowdisplayshortskip
\skip_zero:N \belowdisplayskip
$$
- \dim_compare:nNnT \predisplaysize > \c_zero_dim
+ \hook_use:n { para / after }
+ \dim_compare:nNnTF \predisplaysize > \c_zero_dim
{
\dim_gset:Nn \g__scripture_final_line_dim
- { \predisplaysize - 2 em }
+ { \predisplaysize - 2em }
}
+ {
+ \bool_if:NT \l__scripture_textdir_change_in_group_bool
+ {
+ \str_if_eq:VnT \l__scripture_currenvir_str { scripture }
+ { \int_set:Nn \prevgraf { \int_use:N \prevgraf - 1 } }
+ }
+ }
\cs_gset_nopar:Nx \__scripture_reset_spacing:
{
\dim_set:Nn \predisplaysize { \dim_use:N \predisplaysize }
\int_set:Nn \prevgraf { \int_use:N \prevgraf }
+ \int_gset:Nn \g__scripture_chap_par_prevgraf_int { \int_use:N \g__scripture_chap_par_prevgraf_int }
}
$$
\__scripture_reset_spacing:
\dim_compare:nNnT \g__scripture_final_line_dim > \paperwidth
{ \dim_gset:Nn \g__scripture_final_line_dim { \@totalleftmargin + \linewidth } }
- \dim_compare:nNnT \g__scripture_final_line_dim > { \c_zero_dim - 1 sp }
+ \dim_compare:nNnT \g__scripture_final_line_dim > { \c_zero_dim - 1sp }
{ \skip_vertical:n { -\baselineskip - \parskip } }
}
\str_new:N \l__scripture_currenvir_str
\skip_new:N \l__scripture_parskip_correction_skip
+\tl_new:N \l__scripture_ref_tl
\cs_new_protected_nopar:Nn \__scripture_added:n
{
\group_begin:
@@ -735,6 +1649,52 @@
\__scripture_added_format:n { #1 }
\group_end:
}
+\cs_new_protected_nopar:Nn \__scripture_heading:n
+ {
+ \str_if_eq:VnTF \l__scripture_currenvir_str { scripture }
+ {
+ \bool_if:NTF \l__scripture_heading_show_bool
+ {
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ \group_begin:
+ \bool_set_false:N \l__scripture_pilcrow_bool
+ \legacy_if:nTF { @newlist }
+ {
+ \skip_horizontal:n { -\parindent }
+ }
+ {
+ \__scripture_list_para_end:
+ \addvspace { \l__scripture_heading_aboveskip_tl }
+ \tex_noindent:D
+ }
+ \l__scripture_heading_align_tl
+ \l__scripture_heading_font_tl
+ \__scripture_heading_format:n { #1 }
+ \__scripture_list_para_end:
+ \group_end:
+ \bool_if:NTF \l__scripture_verse_para_bool
+ {
+ \cs_set_eq:NN \noindent \__scripture_para_noindent:
+ }
+ {
+ \cs_set_eq:NN \noindent \tex_noindent:D
+ }
+ \legacy_if_set:nn { @afterindent } \l__scripture_heading_afterindent_bool
+ \bool_if:NF \l__scripture_heading_afterindent_bool
+ {
+ \hook_gput_next_code:nn { para / before }
+ { \para_omit_indent: }
+ }
+ \nobreak
+ \@afterheading
+ \addvspace { \l__scripture_heading_belowskip_tl }
+ }
+ { \ignorespaces }
+ }
+ {
+ \msg_error:nnx { scripture } { heading-error } { \l__scripture_currenvir_str }
+ }
+ }
\cs_new_protected_nopar:Nn \__scripture_name:n
{
\group_begin:
@@ -753,7 +1713,9 @@
\bool_if:NTF \l__scripture_chap_drop_bool
{
\__scripture_chap:n { #2 }
- \bool_if:nTF { #1 }
+ \bool_lazy_and:nnTF
+ { #1 }
+ { \bool_not_p:n { \l__scripture_compact_bool } }
{
\hook_gput_next_code:nn { para / after }
{
@@ -766,11 +1728,19 @@
{ \int_gset_eq:NN \g__scripture_mid_para_chap_prevgraf_int \prevgraf }
}
}
+ {
+ \bool_if:NTF \l__scripture_chap_para_bool
+ { \__scripture_para_chap:n { #2 } }
+ { \__scripture_nodrop_chap:n { #2 } }
+ }
+ }
+ {
+ \bool_if:NTF \l__scripture_chap_para_bool
+ { \__scripture_para_chap:n { #2 } }
{ \__scripture_nodrop_chap:n { #2 } }
}
- { \__scripture_nodrop_chap:n { #2 } }
}
-\cs_new_protected:Nn \__scripture_begin:n
+\cs_new_protected:Nn \__scripture_begin:nn
{
\cs_set_eq:NN \__scripture_noindent_saved: \noindent
\bool_if:NT \l__scripture_active_bool
@@ -778,11 +1748,14 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l__scripture_active_bool
- \tl_set:Nn \l__scripture_currenvir_str { scripture }
\tl_if_novalue:nF { #1 }
+ { \tl_set:Nn \l__scripture_ref_tl { #1 } }
+ \str_set:Nn \l__scripture_currenvir_str { scripture }
+ \tl_if_novalue:nF { #2 }
{
- \keys_set:nn { scripture } { #1 }
+ \keys_set:nn { scripture } { #2 }
}
+ \l__scripture_before_tl
\__scripture_select_language:
\int_gzero:N \g__scripture_chap_par_prevgraf_int
\everydisplay { }
@@ -794,10 +1767,25 @@
\cs_set_eq:NN \extraskip \__scripture_extra_skip:
\cs_set_eq:NN \redletteron \__scripture_red_letter_on:
\cs_set_eq:NN \redletteroff \__scripture_red_letter_off:
- \DeclareDocumentCommand { \ch } { sm }
- { \__scripture_ch_output:nn { ##1 } { ##2 } }
+ \cs_set:Npn \nopilcrow { \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool }
+ \bool_gset_false:N \g__scripture_suppress_next_pilcrow_bool
+ \bool_gset_false:N \g__scripture_suppress_next_verse_para_bool
+ \bool_gset_false:N \g__scripture_mode_vertical_inner_bool
+ \box_gclear:N \g__scripture_post_env_indent_box
+ \skip_gzero:N \g__scripture_prev_inner_below_skip
+ \bool_if:NT \l__scripture_chap_para_bool
+ { \bool_set_false:N \l__scripture_chap_drop_bool }
+ \DeclareDocumentCommand { \ch } { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l__scripture_X_char_tl { ##2 }
+ }
+ \__scripture_ch_output:nn { ##1 } { ##3 }
+ }
\cs_set_eq:NN \vs \__scripture_verse_output:n
\cs_set_eq:NN \added \__scripture_added:n
+ \cs_set_eq:NN \heading \__scripture_heading:n
\cs_set_eq:NN \name \__scripture_name:n
\cs_set_protected_nopar:Npn \LORD { \name { Lord } }
\cs_set_protected_nopar:Npn \GOD { \name { God } }
@@ -805,7 +1793,10 @@
\cs_set_protected_nopar:Npn \textright ##1
{ \__scripture_text_right:nn { \l__scripture_text_right_sep_tl } { ##1 } }
\hook_gclear_next_code:n { para / before }
+ \hook_gclear_next_code:n { scripture / pilcow }
+ \hook_gclear_next_code:n { scripture / poetry / pilcow }
\l__scripture_font_tl
+ \tl_set:Ne \l__scripture_parindent_tl { \dim_eval:n { \l__scripture_parindent_tl } }
\exp_args:NnV \color_set:nn { scripture default colour } \l__scripture_colour_tl
\str_if_eq:VnF \l__scripture_colour_tl { . }
{ \color_select:n { scripture default colour } }
@@ -831,27 +1822,43 @@
{
\hook_gput_next_code:nn { para / begin }
{
- \bool_lazy_any:nT
+ \bool_if:NTF \l__scripture_compact_bool
+ { \para_omit_indent: }
{
- { \str_if_eq_p:Vn \l__scripture_currenvir_str { midparachap } }
- { \str_if_eq_p:Vn \l__scripture_currenvir_str { narrow } }
- { \str_if_eq_p:Vn \l__scripture_currenvir_str { scripture } }
+ \bool_lazy_any:nT
+ {
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { midparachap } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { narrow } }
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { scripture } }
+ }
+ {
+ \legacy_if:nTF { @noparlist }
+ {
+ \bool_lazy_and:nnF
+ { \str_if_eq_p:Vn \l__scripture_currenvir_str { narrow } }
+ { \str_if_eq_p:Vn \l__scripture_ref_position_tl { start } }
+ { \noindent }
+ }
+ { \para_omit_indent: }
+ }
}
- {
- \legacy_if:nTF { @noparlist }
- { \noindent }
- { \para_omit_indent: }
- }
}
}
}
- \dim_set_eq:NN \parindent \l__scripture_parindent_tl
+ \cs_set_eq:NN \__scripture_list_para_end: \@par
\item
\relax
}
}
-\cs_new_protected:Nn \__scripture_end:n
+\cs_new_protected:Nn \__scripture_end:
{
+ \tl_if_eq:NnT \l__scripture_ref_position_tl { start }
+ {
+ \tl_clear:N \l__scripture_ref_tl
+ \tl_if_eq:NnT \l__scripture_version_position_tl { withref }
+ { \tl_clear:N \l__scripture_version_tl }
+ }
+ \cs_set_eq:NN \noindent \tex_noindent:D
\bool_if:NTF \l__scripture_inline_bool
{
\unskip
@@ -858,18 +1865,18 @@
\__scripture_red_letter_off:
\l__scripture_inline_end_tl
\bool_lazy_or:nnTF
- { \tl_if_novalue_p:n { #1 } }
- { \tl_if_empty_p:n { #1 } }
+ { \tl_if_novalue_p:n \l__scripture_ref_tl }
+ { \tl_if_empty_p:N \l__scripture_ref_tl }
{
\tl_if_empty:NF \l__scripture_version_tl
{
\skip_horizontal:N \l__scripture_ref_sep_tl
- \__scripture_format_full_ref:n { }
+ \__scripture_format_full_ref:nn { } \l__scripture_version_tl
}
}
{
\skip_horizontal:N \l__scripture_ref_sep_tl
- \__scripture_format_full_ref:n { #1 }
+ \__scripture_format_full_ref:nn \l__scripture_ref_tl \l__scripture_version_tl
}
}
{
@@ -882,24 +1889,86 @@
{ \skip_zero:N \@topsepadd }
{ \skip_set:Nn \@topsepadd { \__scripture_skip_diff:NN \l__scripture_belowskip_tl \@outerparskip } }
\int_compare:nNnT \prevgraf = \c_zero_int
- { \skip_vertical:n { -\g__scripture_prev_inner_below_skip } }
+ {
+ \bool_if:NT \l__scripture_textdir_change_in_group_bool
+ { \skip_vertical:n { -\baselineskip } }
+ \skip_vertical:n { -\g__scripture_prev_inner_below_skip }
+ }
\hook_gclear_next_code:n { para / before }
- \parshape 1 ~ \@totalleftmargin ~ \linewidth
\noindent
\bool_lazy_or:nnTF
- { \tl_if_novalue_p:n { #1 } }
- { \tl_if_empty_p:n { #1 } }
+ { \tl_if_novalue_p:n \l__scripture_ref_tl }
+ { \tl_if_empty_p:N \l__scripture_ref_tl }
{
\tl_if_empty:NTF \l__scripture_version_tl
{ \hbox:n { } }
{ \__scripture_reference:n { } }
}
- { \__scripture_reference:n { #1 } }
- \@noparlistfalse
+ { \__scripture_reference:n \l__scripture_ref_tl }
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ \legacy_if_set_false:n { @noparlist }
\endlist
}
\cs_set_eq:NN \noindent \__scripture_noindent_saved:
+ \l__scripture_after_tl
}
+\cs_new_protected:Nn \__scripture_compact_end_inner:
+ {
+ \bool_gset_false:N \g__scripture_mode_vertical_inner_bool
+ \str_if_eq:VnT \l__scripture_ref_position_tl { start }
+ {
+ \tl_gclear:N \l__scripture_ref_tl
+ }
+ \bool_lazy_and:nnT \l__scripture_verse_para_bool \l__scripture_chap_drop_bool
+ {
+ \cs_set_eq:NN \par \para_end:
+ \__scripture_calc_final_line_length:
+ \int_gset_eq:NN \g__scripture_mid_para_chap_prevgraf_int \g__scripture_chap_par_prevgraf_int
+ \tex_noindent:D
+ \bool_lazy_and:nnTF
+ { \bool_if_p:N \l__scripture_compact_bool }
+ { \int_compare_p:nNn \g__scripture_mid_para_chap_prevgraf_int = 1 }
+ {
+ \hook_gput_next_code:nn { env / \l__scripture_currenvir_str / after }
+ {
+ \parshape 3 ~
+ \@totalleftmargin ~ \linewidth ~
+ \dim_eval:n
+ { \@totalleftmargin + \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
+ \dim_eval:n
+ { \linewidth - \g__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
+ \@totalleftmargin ~ \linewidth
+ }
+ \hbox_to_wd:nn { \g__scripture_final_line_dim - \g__scripture_chap_width_dim - \l__scripture_chap_sep_tl } { }
+ }
+ {
+ \hbox_to_wd:nn \g__scripture_final_line_dim { }
+ }
+ \c_space_token
+ \kern 0pt
+ \cs_set_eq:NN \par \relax
+ \hook_gput_next_code:nn { para / before }
+ {
+ \int_compare:nNnT \g__scripture_mid_para_chap_prevgraf_int = 1
+ {
+ \dim_compare:nNnT \parskip < \baselineskip
+ {
+ \dim_compare:nNnT { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \para_omit_indent:
+ \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ }
+ }
+ }
+ }
+ \int_gzero:N \g__scripture_chap_par_prevgraf_int
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ }
+ \unskip
+ }
\cs_new_protected:Nn \__scripture_center_begin:n
{
\bool_if:NT \l__scripture_active_inner_bool
@@ -907,7 +1976,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l__scripture_active_inner_bool
- \tl_set:Nn \l__scripture_currenvir_str { center }
+ \str_set:Nn \l__scripture_currenvir_str { center }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -917,8 +1986,13 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l__scripture_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
\list { }
{
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g__scripture_para_mode_vertical_bool }
+ { \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l__scripture_center_leftmargin_tl
\dim_set_eq:NN \rightmargin \l__scripture_center_rightmargin_tl
@@ -935,11 +2009,22 @@
{ \addvspace { \baselineskip } }
\int_gzero:N \g__scripture_chap_par_prevgraf_int
\centering
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \cs_set_eq:NN \par \__scripture_para_par:
+ \cs_set_protected:Npn \\
+ {
+ \mode_if_horizontal:TF
+ { \unskip }
+ { \@nolnerr }
+ }
+ }
\item
\relax
}
\cs_new_protected:Nn \__scripture_center_end:
{
+ \cs_set_eq:NN \par \para_end:
\dim_gset:Nn \g__scripture_final_line_dim { \@totalleftmargin + \linewidth }
\dim_compare:nNnTF \@outerparskip > \l__scripture_center_belowskip_tl
{ \skip_zero:N \@topsepadd }
@@ -947,6 +2032,7 @@
\skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
}
\cs_new_protected:Nn \__scripture_flushright_begin:n
{
@@ -955,7 +2041,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l__scripture_active_inner_bool
- \tl_set:Nn \l__scripture_currenvir_str { flushright }
+ \str_set:Nn \l__scripture_currenvir_str { flushright }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -965,8 +2051,13 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l__scripture_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
\list { }
{
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g__scripture_para_mode_vertical_bool }
+ { \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l__scripture_flushright_leftmargin_tl
\dim_set_eq:NN \rightmargin \l__scripture_flushright_rightmargin_tl
@@ -983,11 +2074,22 @@
{ \addvspace { \baselineskip } }
\int_gzero:N \g__scripture_chap_par_prevgraf_int
\raggedleft
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \cs_set_eq:NN \par \__scripture_para_par:
+ \cs_set_protected:Npn \\
+ {
+ \mode_if_horizontal:TF
+ { \unskip }
+ { \@nolnerr }
+ }
+ }
\item
\relax
}
\cs_new_protected:Nn \__scripture_flushright_end:
{
+ \cs_set_eq:NN \par \para_end:
\dim_gset:Nn \g__scripture_final_line_dim { \@totalleftmargin + \linewidth }
\dim_compare:nNnTF \@outerparskip > \l__scripture_flushright_belowskip_tl
{ \skip_zero:N \@topsepadd }
@@ -995,27 +2097,40 @@
\skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
}
\dim_new:N \l__scripture_hanging_parindent_saved_dim
\cs_new_protected:Nn \__scripture_hanging_ch:n
{
+ \bool_gset_false:N \g__scripture_suppress_next_pilcrow_bool
\bool_if:NTF \l__scripture_chap_show_bool
{
\bool_if:NTF \l__scripture_chap_drop_bool
{ \__scripture_hanging_chap:n { #1 } }
+ {
+ \bool_if:NTF \l__scripture_chap_para_bool
+ { \__scripture_para_chap:n { #1 } }
+ { \__scripture_nodrop_chap:n { #1 } }
+ }
+ }
+ {
+ \bool_if:NTF \l__scripture_chap_para_bool
+ { \__scripture_para_chap:n { #1 } }
{ \__scripture_nodrop_chap:n { #1 } }
}
- { \__scripture_nodrop_chap:n { #1 } }
}
\cs_new_protected:Nn \__scripture_hanging_chap:n
{
\__scripture_drop_chap_set_up:n { #1 }
\dim_compare:nNnTF
- \l__scripture_chap_width_dim < \leftmargin
+ { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } < \leftmargin
{
- \tl_set:Nx \l__scripture_chap_sep_tl
+ \bool_if:NT \l__scripture_hanging_chapter_indent_bool
{
- \dim_eval:n { \leftmargin - \l__scripture_chap_width_dim }
+ \tl_set:Nx \l__scripture_chap_sep_tl
+ {
+ \dim_eval:n { \leftmargin - \g__scripture_chap_width_dim }
+ }
}
}
{
@@ -1022,35 +2137,65 @@
\parshape 3 ~
\dim_eval:n
{
- \@totalleftmargin - \leftmargin + \l__scripture_chap_width_dim +
+ \@totalleftmargin - \leftmargin + \g__scripture_chap_width_dim +
\l__scripture_chap_sep_tl
} ~
\dim_eval:n
{
- \linewidth + \leftmargin - \l__scripture_chap_width_dim -
+ \linewidth + \leftmargin - \g__scripture_chap_width_dim -
\l__scripture_chap_sep_tl
} ~
\dim_eval:n
{
- \@totalleftmargin - \leftmargin + \l__scripture_chap_width_dim +
+ \@totalleftmargin - \leftmargin + \g__scripture_chap_width_dim +
\l__scripture_chap_sep_tl
} ~
\dim_eval:n
{
- \linewidth + \leftmargin - \l__scripture_chap_width_dim -
+ \linewidth + \leftmargin - \g__scripture_chap_width_dim -
\l__scripture_chap_sep_tl
} ~
\@totalleftmargin ~ \linewidth
}
- \tl_set:Nx \l__scripture_chap_sep_tl
+ \par
+ \bool_if:NTF \l__scripture_hanging_chapter_indent_bool
{
- \dim_eval:n
+ \tl_set:Nx \l__scripture_chap_sep_tl
{
- \l__scripture_chap_sep_tl + \l__scripture_hanging_parindent_saved_dim
+ \dim_eval:n
+ {
+ \l__scripture_chap_sep_tl + \l__scripture_hanging_parindent_saved_dim
+ }
}
+ \__scripture_nohang:
}
- \par
- \__scripture_nohang:
+ {
+ \mode_leave_vertical:
+ \dim_compare:nNnTF
+ { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \l__scripture_hanging_leftmargin_tl
+ {
+ \dim_compare:nNnTF
+ { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \leftmargin
+ {
+ \skip_horizontal:n { \l__scripture_hanging_hang_tl }
+ }
+ {
+ \skip_horizontal:n
+ {
+ \l__scripture_chap_sep_tl +
+ \g__scripture_chap_width_dim -
+ \l__scripture_hanging_leftmargin_tl
+ }
+ }
+ }
+ {
+ \tl_set:Nx \l__scripture_chap_sep_tl
+ {
+ \dim_eval:n
+ { \l__scripture_hanging_leftmargin_tl - \g__scripture_chap_width_dim }
+ }
+ }
+ }
\hbox_set:Nn \l__scripture_chap_box
{
\box_move_down:nn
@@ -1074,25 +2219,114 @@
{
\__scripture_verse_output:n { 1 }
}
+ \__scripture_pilcrow_output:
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \hook_gput_next_code:nn { para / after }
+ {
+ \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
+ \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+ { \penalty 10000 }
+ \hook_gput_next_code:nn { para / before }
+ {
+ \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int
+ }
+ }
+ }
\hook_gput_next_code:nn { para / begin }
- { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ {
+ \int_compare:nNnTF \g__scripture_chap_par_prevgraf_int = \c_one_int
+ {
+ \dim_compare:nNnTF
+ { \l__scripture_hanging_leftmargin_tl } < { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ {
+ \parshape 2 ~
+ \dim_eval:n
+ {
+ \@totalleftmargin - \leftmargin + \g__scripture_chap_width_dim +
+ \l__scripture_chap_sep_tl
+ } ~
+ \dim_eval:n
+ {
+ \linewidth + \leftmargin - \g__scripture_chap_width_dim -
+ \l__scripture_chap_sep_tl
+ } ~
+ \@totalleftmargin ~ \linewidth
+ }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ \hook_gput_next_code:nn { para / begin }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ \int_gzero:N \g__scripture_chap_par_prevgraf_int
+ }
}
\cs_new_protected:Nn \__scripture_hanging_verse:n
{
\mode_if_vertical:TF
{
- \strut
- \hbox_overlap_left:n
+ \tl_set_eq:NN \l_tmpa_tl \l__scripture_verse_sep_tl
+ \tl_set_eq:NN \l__scripture_verse_sep_tl \l__scripture_hanging_verse_sep_tl
+ \bool_lazy_and:nnTF
+ { \legacy_if_p:n { @newlist } }
+ { \g__scripture_suppress_next_pilcrow_bool }
{
- \__scripture_verse_output:n { #1 }
+ \strut
+ \bool_if:NTF \l__scripture_hanging_verse_right_bool
+ {
+ \hbox_overlap_left:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ }
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_overlap_right:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ \skip_horizontal:N \l__scripture_hanging_leftmargin_tl
+ }
+ }
}
+ {
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \strut
+ \bool_if:NTF \l__scripture_hanging_verse_right_bool
+ {
+ \hbox_overlap_left:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ }
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_overlap_right:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ \skip_horizontal:N \l__scripture_hanging_leftmargin_tl
+ }
+ }
+ \__scripture_pilcrow_output:
+ }
+ \tl_set_eq:NN \l__scripture_verse_sep_tl \l_tmpa_tl
}
{ \__scripture_verse_output:n { #1 } }
}
\cs_new_protected_nopar:Nn \__scripture_nohang:
{
- \noindent
+ \legacy_if:nTF {@newlist}
+ { \skip_horizontal:n { \l__scripture_hanging_hang_tl } }
+ { \tex_noindent:D }
\hbox_to_wd:nn { \l__scripture_hanging_parindent_saved_dim } { }
+ \peek_meaning:NT \vs
+ {
+ \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+ \__scripture_set_pilcrow_hook:
+ }
}
\cs_new_protected:Nn \__scripture_hanging_begin:n
{
@@ -1101,7 +2335,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l__scripture_active_inner_bool
- \tl_set:Nn \l__scripture_currenvir_str { hanging }
+ \str_set:Nn \l__scripture_currenvir_str { hanging }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -1108,15 +2342,30 @@
{ scripture / hanging }
{ #1 }
}
- \DeclareDocumentCommand { \ch } { sm } { \__scripture_hanging_ch:n { ##2 } }
- \cs_set_eq:NN \vs \__scripture_hanging_verse:n
+ \DeclareDocumentCommand { \ch } { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l__scripture_X_char_tl { ##2 }
+ }
+ \__scripture_hanging_ch:n { ##3 }
+ }
+ \bool_if:NTF \l__scripture_verse_para_bool
+ { \cs_set_eq:NN \vs \__scripture_hanging_verse_para:n }
+ { \cs_set_eq:NN \vs \__scripture_hanging_verse:n }
\cs_set_eq:NN \nohang \__scripture_nohang:
\dim_set_eq:NN \l__scripture_hanging_parindent_saved_dim \parindent
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l__scripture_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
+ \hook_gclear_next_code:n { para/ before }
\list { }
{
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g__scripture_para_mode_vertical_bool }
+ { \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set:Nn \leftmargin { \l__scripture_hanging_leftmargin_tl + \l__scripture_hanging_hang_tl }
\dim_set_eq:NN \rightmargin \l__scripture_hanging_rightmargin_tl
@@ -1144,6 +2393,7 @@
\skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
}
\cs_new_protected:Npn \__scripture_vbox_set_top:Nw #1
{
@@ -1158,6 +2408,27 @@
\int_new:N \g__scripture_mid_para_chap_prevgraf_int
\box_new:N \l__scripture_mid_para_chap_snap_box
\int_new:N \l__scripture_mid_para_chap_spacefactor_int
+\cs_set_eq:Nc \__scripture_mid_para_chap_end_orig:n { end ~ }
+\cs_new_nopar:Nn \__scripture_mid_para_chap_end:n
+ {
+ \__scripture_mid_para_chap_end_orig:n { #1 }
+ \bool_if:NT \l__scripture_compact_bool
+ { \c_space_token }
+ \peek_remove_spaces:n
+ {
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:n
+ {
+ { \exp_args:No \token_if_letter_p:N { ##1 } }
+ { \__scripture_pilcrow_output: }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ { \__scripture_set_pilcrow_hook: }
+ }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ }
+ }
\box_new:N \l__scripture_mid_para_chap_box
\box_new:N \l__scripture_mid_para_chap_split_box
\box_new:N \l__scripture_mid_para_chap_split_top_box
@@ -1179,11 +2450,11 @@
\dim_compare:nNnTF
{
\box_wd:N \l__scripture_mid_para_chap_snap_box +
- \l__scripture_chap_width_dim +
+ \g__scripture_chap_width_dim +
\l__scripture_chap_sep_tl
}
<
- { \linewidth - \leftskip - \rightskip - 3 em }
+ { \linewidth - \leftskip - \rightskip - 3em }
{
\__scripture_drop_chap_output:
\hbox_unpack_drop:N \l__scripture_mid_para_chap_snap_box
@@ -1208,7 +2479,7 @@
}
\cs_new_protected:Nn \__scripture_mid_para_chap_begin:n
{
- \tl_set:Nn \l__scripture_currenvir_str { midparachap }
+ \str_set:Nn \l__scripture_currenvir_str { midparachap }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -1215,9 +2486,7 @@
{ scripture / midparachap }
{ #1 }
}
- \bool_lazy_and:nnT
- { \bool_if_p:n \l__scripture_chap_show_verse_bool }
- { \bool_if_p:n \l__scripture_chap_drop_bool }
+ \bool_lazy_and:nnT \l__scripture_chap_show_verse_bool \l__scripture_chap_drop_bool
{
\bool_set_true:N \l__scripture_midparachap_show_verse_bool
\bool_set_false:N \l__scripture_chap_show_verse_bool
@@ -1252,8 +2521,8 @@
\prevgraf < 3
{
\noindent
- \skip_horizontal:n { \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
- \dim_gadd:Nn \g__scripture_final_line_dim { \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ \skip_horizontal:n { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ \dim_gadd:Nn \g__scripture_final_line_dim { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
}
\box_use_drop:N \l__scripture_mid_para_chap_line_box
\vbox_set_end:
@@ -1293,7 +2562,24 @@
\int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \g__scripture_mid_para_chap_prevgraf_int
\hook_gput_next_code:nn { para / before }
{
- \int_gzero:N \g__scripture_chap_par_prevgraf_int
+ \legacy_if:nF { @newlist }
+ {
+ \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+ {
+ \dim_compare:nNnT \parskip < \baselineskip
+ {
+ \dim_compare:nNnT { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \para_omit_indent:
+ \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ }
+ }
+ }
+ }
+ \int_gzero:N \g__scripture_chap_par_prevgraf_int
+ }
\parshape 1 ~ \@totalleftmargin ~ \linewidth
}
}
@@ -1304,7 +2590,7 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l__scripture_active_inner_bool
- \tl_set:Nn \l__scripture_currenvir_str { narrow }
+ \str_set:Nn \l__scripture_currenvir_str { narrow }
\tl_if_novalue:nF { #1 }
{
\keys_set:nn
@@ -1314,21 +2600,22 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l__scripture_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
\list { }
{
- %\int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
- % { \addvspace { \baselineskip } }
- %\int_gzero:N \g__scripture_chap_par_prevgraf_int
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l__scripture_narrow_leftmargin_tl
\dim_set_eq:NN \rightmargin \l__scripture_narrow_rightmargin_tl
\dim_set_eq:NN \listparindent \parindent
- \mode_if_vertical:TF
+ \bool_lazy_or:nnTF
+ { \mode_if_vertical_p: }
+ { \g__scripture_para_mode_vertical_bool }
{
\dim_set:Nn \itemindent { \parindent - \l__scripture_outer_itemindent_dim }
\__scripture_setup_list_noindent:n { \parindent }
}
{
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
\dim_set:Nn \itemindent { -\l__scripture_outer_itemindent_dim }
\__scripture_setup_list_noindent:n { \c_zero_dim }
}
@@ -1341,11 +2628,14 @@
\int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
{ \addvspace { \baselineskip } }
\int_gzero:N \g__scripture_chap_par_prevgraf_int
+ \bool_if:NT \l__scripture_verse_para_bool
+ { \cs_set_eq:NN \par \__scripture_para_par: }
\item
\relax
}
\cs_new_protected:Nn \__scripture_narrow_end:
{
+ \cs_set_eq:NN \par \para_end:
\__scripture_calc_final_line_length:
\dim_compare:nNnTF \@outerparskip > \l__scripture_narrow_belowskip_tl
{ \skip_zero:N \@topsepadd }
@@ -1353,29 +2643,15 @@
\skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
}
\hook_new:n { scripture / poetry / para / after }
\bool_new:N \g__scripture_poetry_end_bool
-\bool_new:N \g__scripture_poetry_midparachap_show_verse_bool
+\bool_new:N \l__scripture_poetry_midparachap_show_verse_bool
\dim_new:N \l__scripture_poetry_chap_indent_dim
\dim_new:N \l__scripture_poetry_chap_sep_dim
\dim_new:N \l__scripture_poetry_chap_parshape_correction_dim
\int_new:N \l__scripture_poetry_prevgraf_int
-\cs_new_protected:Nn \__scripture_poetry_extra_skip:
- {
- \skip_vertical:n { \l__scripture_extraskip_tl - \baselineskip - \parskip }
- \bool_gset_false:N \g__scripture_poetry_midparachap_show_verse_bool
- \strut
- \hook_gput_next_code:nn { para / after }
- {
- \hook_gput_next_code:nn { para / after }
- {
- \bool_gset_eq:NN
- \g__scripture_poetry_midparachap_show_verse_bool
- \l__scripture_midparachap_show_verse_bool
- }
- }
- }
\cs_new_protected:Nn \__scripture_poetry_text_right:nn
{
{
@@ -1406,22 +2682,38 @@
{
\bool_if:NTF \l__scripture_chap_drop_bool
{ \__scripture_poetry_chap:n { #1 } }
+ {
+ \bool_if:NTF \l__scripture_chap_para_bool
+ { \__scripture_para_chap:n { #1 } }
+ { \__scripture_poetry_nodrop_chap:n { #1 } }
+ }
+ }
+ {
+ \bool_if:NTF \l__scripture_chap_para_bool
+ { \__scripture_para_chap:n { #1 } }
{ \__scripture_poetry_nodrop_chap:n { #1 } }
}
- { \__scripture_poetry_nodrop_chap:n { #1 } }
}
\cs_new_protected:Nn \__scripture_poetry_chap:n
{
\__scripture_drop_chap_set_up:n { #1 }
- \mode_if_vertical:TF
+ \hook_gput_next_code:nn { para / after }
+ {
+ \hook_gput_next_code:nn { para / after }
+ { \int_gzero:N \g__scripture_chap_par_prevgraf_int }
+ }
+ \cs_if_eq:NNTF \vs \__scripture_poetry_mode_vertical_verse:n
{
+ \dim_zero:N \l__scripture_poetry_chap_indent_dim
+ \noindent
+ }
+ {
\dim_set_eq:NN \l__scripture_poetry_chap_indent_dim \l__scripture_poetry_indent_tl
\mode_leave_vertical:
}
- { \dim_zero:N \l__scripture_poetry_chap_indent_dim }
\dim_set_eq:NN \l__scripture_poetry_chap_sep_dim \l__scripture_chap_sep_tl
\dim_compare:nNnT
- { \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
<
{ \l__scripture_poetry_leftmargin_tl + \l__scripture_poetry_chap_indent_dim }
{
@@ -1428,7 +2720,7 @@
\dim_set:Nn \l__scripture_poetry_chap_sep_dim
{
\l__scripture_poetry_leftmargin_tl + \l__scripture_poetry_chap_indent_dim -
- \l__scripture_chap_width_dim
+ \g__scripture_chap_width_dim
}
}
\hbox_set:Nn \l__scripture_chap_box
@@ -1447,7 +2739,7 @@
\box_set_dp:Nn \l__scripture_chap_box { \c_zero_dim }
\dim_set:Nn \l__scripture_poetry_chap_parshape_correction_dim
{
- \l__scripture_chap_width_dim + \l__scripture_poetry_chap_sep_dim -
+ \g__scripture_chap_width_dim + \l__scripture_poetry_chap_sep_dim -
\l__scripture_poetry_leftmargin_tl - \l__scripture_poetry_chap_indent_dim
}
\parshape 2 ~
@@ -1460,7 +2752,7 @@
\dim_eval:n
{ \linewidth - \l__scripture_poetry_big_indent_tl }
\dim_compare:nNnT
- { \l__scripture_chap_width_dim + \l__scripture_poetry_chap_sep_dim }
+ { \g__scripture_chap_width_dim + \l__scripture_poetry_chap_sep_dim }
>
\l__scripture_poetry_leftmargin_tl
{
@@ -1468,43 +2760,44 @@
{
\int_compare:nNnT \l__scripture_poetry_prevgraf_int = 1
{
- \dim_compare:nNnTF
- { \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
- <
- { \l__scripture_poetry_leftmargin_tl + \l__scripture_poetry_indent_tl }
- { \dim_zero:N \l__scripture_poetry_chap_parshape_correction_dim }
+ \cs_if_eq:NNTF \vs \__scripture_poetry_mode_vertical_verse:n
{
- \dim_set:Nn \l__scripture_poetry_chap_parshape_correction_dim
+ \dim_compare:nNnTF
+ { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ <
+ \l__scripture_poetry_leftmargin_tl
+ { \dim_zero:N \l__scripture_poetry_chap_parshape_correction_dim }
{
- \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl -
- \l__scripture_poetry_leftmargin_tl - \l__scripture_poetry_indent_tl
+ \dim_set:Nn \l__scripture_poetry_chap_parshape_correction_dim
+ {
+ \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl -
+ \l__scripture_poetry_leftmargin_tl
+ }
}
+ \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+ {
+ \parshape 2 ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_poetry_chap_parshape_correction_dim } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_poetry_chap_parshape_correction_dim } ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_poetry_big_indent_tl } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_poetry_big_indent_tl }
+ }
}
- \parshape 2 ~
- \dim_eval:n
- { \@totalleftmargin + \l__scripture_poetry_chap_parshape_correction_dim } ~
- \dim_eval:n
- { \linewidth - \l__scripture_poetry_chap_parshape_correction_dim } ~
- \dim_eval:n
- { \@totalleftmargin + \l__scripture_poetry_big_indent_tl } ~
- \dim_eval:n
- { \linewidth - \l__scripture_poetry_big_indent_tl }
- \hook_gput_next_code:nn { para / after }
{
- \hook_gclear_next_code:n { scripture / poetry / para / after }
- }
- \hook_gput_next_code:nn { scripture / poetry / para / after }
- {
\dim_compare:nNnTF
- { \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
<
- \l__scripture_poetry_leftmargin_tl
+ { \l__scripture_poetry_leftmargin_tl + \l__scripture_poetry_indent_tl }
{ \dim_zero:N \l__scripture_poetry_chap_parshape_correction_dim }
{
\dim_set:Nn \l__scripture_poetry_chap_parshape_correction_dim
{
- \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl -
- \l__scripture_poetry_leftmargin_tl
+ \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl -
+ \l__scripture_poetry_leftmargin_tl - \l__scripture_poetry_indent_tl
}
}
\parshape 2 ~
@@ -1525,12 +2818,9 @@
\box_use:N \l__scripture_chap_box
\hook_use:n { scripture / chap / after }
\group_end:
- \bool_lazy_or:nnT
- { \bool_if_p:n \l__scripture_chap_show_verse_bool }
- { \bool_if_p:n \g__scripture_poetry_midparachap_show_verse_bool }
- {
- \__scripture_verse_output:n { 1 }
- }
+ \bool_lazy_or:nnT \l__scripture_chap_show_verse_bool \l__scripture_poetry_midparachap_show_verse_bool
+ { \__scripture_verse_output:n { 1 } }
+ \hook_use:n { scripture / poetry / pilcrow }
}
\cs_new_protected:Nn \__scripture_poetry_nodrop_chap:n
{
@@ -1537,6 +2827,8 @@
\cs_gset_nopar:Npn \scripturecurrentchapter { #1 }
\cs_gset_nopar:Npn \scripturecurrentverse { 1 }
\group_begin:
+ \cs_if_eq:NNT \vs \__scripture_poetry_mode_vertical_verse:n
+ { \noindent }
\bool_if:NTF \l__scripture_chap_show_bool
{
\hbox_overlap_left:n
@@ -1551,12 +2843,8 @@
\skip_horizontal:N \l__scripture_chap_sep_tl
\hook_use:n { scripture / chap / after }
}
- \bool_lazy_or:nnT
- { \bool_if_p:n \l__scripture_chap_show_verse_bool }
- { \bool_if_p:n \g__scripture_poetry_midparachap_show_verse_bool }
- {
- \__scripture_verse_output:n { 1 }
- }
+ \bool_lazy_or:nnT \l__scripture_chap_show_verse_bool \l__scripture_poetry_midparachap_show_verse_bool
+ { \__scripture_verse_output:n { 1 } }
}
{
\hook_use:n { scripture / chap / before }
@@ -1564,52 +2852,60 @@
\vs { 1 }
}
\group_end:
+ \hook_use:n { scripture / poetry / pilcrow }
}
\cs_new_protected:Nn \__scripture_poetry_mode_vertical_verse:n
{
\group_begin:
\tl_set_eq:NN \l__scripture_verse_sep_tl \l__scripture_poetry_verse_sep_tl
+ \hook_gclear_next_code:n { scripture / pilcrow }
\strut
- \bool_if:NTF \l__scripture_poetry_verse_right_bool
+ \int_compare:nNnTF \g__scripture_chap_par_prevgraf_int = 1
{
- \hbox_overlap_left:n
- {
- \__scripture_verse_output:n { #1 }
- }
+ \__scripture_verse_output:n { #1 }
}
{
- \hbox_overlap_left:n
+ \bool_if:NTF \l__scripture_poetry_verse_right_bool
{
- \hbox_overlap_right:n
+ \hbox_overlap_left:n
{
\__scripture_verse_output:n { #1 }
}
- \skip_horizontal:N \l__scripture_poetry_leftmargin_tl
}
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_overlap_right:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ \skip_horizontal:N \l__scripture_poetry_leftmargin_tl
+ }
+ }
}
\group_end:
+ \bool_if:NF \g__scripture_suppress_next_pilcrow_bool
+ { \hook_use:n { scripture / poetry / pilcrow } }
}
\cs_new_protected:Nn \__scripture_poetry_mode_horizontal_verse:n
{
\group_begin:
\tl_set_eq:NN \l__scripture_verse_sep_tl \l__scripture_poetry_verse_sep_tl
- \skip_horizontal:n { -\listparindent }
- \__scripture_poetry_mode_vertical_verse:n { #1 }
- \skip_horizontal:N \listparindent
+ \int_compare:nNnTF \g__scripture_chap_par_prevgraf_int = 1
+ {
+ \__scripture_poetry_mode_vertical_verse:n { #1 }
+ }
+ {
+ \skip_horizontal:n { -\listparindent }
+ \__scripture_poetry_mode_vertical_verse:n { #1 }
+ \skip_horizontal:N \listparindent
+ }
\group_end:
}
\cs_new_protected:Nn \__scripture_poetry_par:
{
- \mode_if_vertical:TF
- {
- \cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n
- \noindent
- }
- {
- \cs_set_eq:NN \vs \__scripture_poetry_mode_horizontal_verse:n
- \__scripture_tmp_para_end:
- \int_set_eq:NN \l__scripture_poetry_prevgraf_int \prevgraf
- }
+ \para_end:
+ \int_set:Nn \l__scripture_poetry_prevgraf_int { \int_use:N \prevgraf }
\parshape 2 ~
\@totalleftmargin ~
\linewidth ~
@@ -1624,16 +2920,68 @@
\cs_gset_protected_nopar:Nn \__scripture_obeylines: %
{%
\char_set_catcode_active:N \^^M%
- \cs_set_eq:NN ^^M \__scripture_obeylines_end:%
+ \cs_set_eq:NN ^^M \__scripture_obeylines_eol:%
}%
\group_end:
-\cs_new_protected:Nn \__scripture_obeylines_end:
+\cs_new_protected:Nn \__scripture_obeylines_eol:
{
- \peek_meaning:NF \end
+ \mode_if_vertical:TF
{
- \par
- \int_set:Nn \l__scripture_poetry_prevgraf_int { \int_use:N \prevgraf }
+ \cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n
+ \hook_gput_next_code:nn { scripture / poetry / para / after }
+ { \bool_set_false:N \l__scripture_poetry_midparachap_show_verse_bool }
}
+ { \cs_set_eq:NN \vs \__scripture_poetry_mode_horizontal_verse:n }
+ \peek_analysis_map_inline:n
+ {
+ \bool_case:nF
+ {
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
+ {
+ \bool_set_eq:NN \l__scripture_poetry_midparachap_show_verse_bool \l__scripture_midparachap_show_verse_bool
+ \__scripture_poetry_par:
+ \peek_analysis_map_break:n { ##1 }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \end }
+ { \peek_analysis_map_break:n { ##1 } }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \extraskip }
+ { \peek_analysis_map_break:n { ##1 } }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \nopilcrow }
+ {
+ \__scripture_poetry_par:
+ \cs_if_eq:NNT \vs \__scripture_poetry_mode_vertical_verse:n
+ { \noindent }
+ \peek_analysis_map_break:n
+ {
+ \__scripture_fix_protrusion:o { ##1 }
+ }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+ {
+ \__scripture_poetry_par:
+ \cs_if_eq:NNT \vs \__scripture_poetry_mode_vertical_verse:n
+ { \noindent }
+ \peek_analysis_map_break:n { ##1 }
+ }
+ { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \__scripture_obeylines_eol: }
+ { \cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n }
+ }
+ {
+ \__scripture_poetry_par:
+ \cs_if_eq:NNT \vs \__scripture_poetry_mode_vertical_verse:n
+ { \noindent }
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \__scripture_pilcrow_output:
+ \bool_set_false:N \l__scripture_verse_para_bool
+ \bool_set_false:N \l__scripture_pilcrow_bool
+ }
+ \peek_analysis_map_break:n
+ {
+ \__scripture_fix_protrusion:o { ##1 }
+ }
+ }
+ }
}
\cs_new_protected:Nn \__scripture_poetry_begin:
{
@@ -1642,11 +2990,17 @@
\msg_error:nn { scripture } { nested-environment }
}
\bool_set_true:N \l__scripture_active_inner_bool
- \tl_set:Nn \l__scripture_currenvir_str { poetry }
+ \str_set:Nn \l__scripture_currenvir_str { poetry }
\bool_gset_false:N \g__scripture_poetry_midparachap_show_verse_bool
- \DeclareDocumentCommand { \ch } { sm } { \__scripture_poetry_ch:n { ##2 } }
+ \DeclareDocumentCommand { \ch } { s o m }
+ {
+ \tl_if_novalue:nF { ##2 }
+ {
+ \tl_set:Nn \l__scripture_X_char_tl { ##2 }
+ }
+ \__scripture_poetry_ch:n { ##3 }
+ }
\cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n
- \cs_set_eq:NN \extraskip \__scripture_poetry_extra_skip:
\cs_set_eq:NN \selah \__scripture_selah_output:
\cs_set_protected_nopar:Npn \textright ##1
{ \__scripture_poetry_text_right:nn { \l__scripture_text_right_sep_tl } { ##1 } }
@@ -1653,8 +3007,20 @@
\legacy_if:nTF { @newlist }
{ \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
{ \dim_zero:N \l__scripture_outer_itemindent_dim }
+ \cs_set_eq:NN \par \para_end:
+ \cs_set_eq:NN \noindent \tex_noindent:D
+ \hook_gput_next_code:nn { scripture / poetry / pilcrow }
+ {
+ \__scripture_pilcrow_output:
+ \bool_set_false:N \l__scripture_pilcrow_bool
+ \bool_set_false:N \l__scripture_verse_para_bool
+ }
\list { }
{
+ \bool_lazy_or:nnF
+ { \mode_if_vertical_p: }
+ { \g__scripture_para_mode_vertical_bool }
+ { \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool }
\dim_zero:N \labelsep
\dim_set_eq:NN \leftmargin \l__scripture_poetry_leftmargin_tl
\dim_set_eq:NN \rightmargin \l__scripture_poetry_rightmargin_tl
@@ -1674,10 +3040,6 @@
\dim_set_eq:NN \parindent \l__scripture_poetry_indent_tl
\item
\relax
- \cs_set_eq:NN \__scripture_tmp_para_end: \par
- \cs_set_eq:NN \par \__scripture_poetry_par:
- \hook_gput_next_code:nn { para / after }
- { \bool_gset_eq:NN \g__scripture_poetry_midparachap_show_verse_bool \l__scripture_midparachap_show_verse_bool }
}
\cs_new_protected:Nn \__scripture_poetry_end:
{
@@ -1688,6 +3050,8 @@
\skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd
\legacy_if_set_false:n { @noparlist }
\endlist
+ \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+ \hook_gclear_next_code:n { scripture / poetry / pilcrow }
\bool_gset_true:N \g__scripture_poetry_end_bool
\hook_gput_next_code:nn { para / begin }
{ \bool_gset_false:N \g__scripture_poetry_end_bool }
@@ -1716,47 +3080,47 @@
}
\NewDocumentEnvironment { scripture } { o o }
{
- \__scripture_begin:n { #2 }
+ \__scripture_begin:nn { #1 } { #2 }
\DeclareDocumentEnvironment { center } { o }
{
\__scripture_center_begin:n { ##1 }
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{ \__scripture_center_end: }
\DeclareDocumentEnvironment { flushright } { o }
{
\__scripture_flushright_begin:n { ##1 }
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{ \__scripture_flushright_end: }
\DeclareDocumentEnvironment { hanging } { o }
{
\__scripture_hanging_begin:n { ##1 }
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{ \__scripture_hanging_end: }
\DeclareDocumentEnvironment { midparachap } { o }
{
\__scripture_mid_para_chap_begin:n { ##1 }
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{ \__scripture_mid_para_chap_end: }
\DeclareDocumentEnvironment { narrow } { o }
{
\__scripture_narrow_begin:n { ##1 }
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{ \__scripture_narrow_end: }
\DeclareDocumentEnvironment { poetryaux } { o }
{
\tl_if_novalue:nF { ##1 }
- {
- \keys_set:nn
- { scripture / poetry }
- { ##1 }
- }
+ {
+ \keys_set:nn
+ { scripture / poetry }
+ { ##1 }
+ }
\__scripture_poetry_begin:
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{ \__scripture_poetry_end: }
\DeclareDocumentEnvironment { poetry } { }
@@ -1775,19 +3139,91 @@
\tl_set_eq:NN \l__scripture_ref_sep_tl \l__scripture_inline_ref_sep_tl
\cs_set_eq:NN \__scripture_version_format:n \__scripture_inline_version_format:n
\tl_set_eq:NN \l__scripture_version_delim_tl \l__scripture_inline_version_delim_tl
+ \bool_set_false:N \l__scripture_chap_para_bool
\bool_set_true:N \l__scripture_compact_bool
+ \bool_set_false:N \l__scripture_heading_show_bool
}
+ \bool_if:NT \l__scripture_chap_para_bool
+ {
+ \RenewDocumentEnvironment { midparachap } { o } { \ignorespaces } { \unskip }
+ }
+ \bool_if:NT \l__scripture_verse_para_bool
+ {
+ \cs_set_eq:NN \vs \__scripture_verse_para_output:n
+ \cs_set_eq:NN \par \__scripture_para_par:
+ \cs_set_eq:NN \@par \__scripture_para_par:
+ \cs_set_eq:NN \@doendpe \__scripture_doendpe:
+ \cs_set_eq:NN \noindent \__scripture_para_noindent:
+ \cs_set_protected:Npn \\
+ {
+ \mode_if_horizontal:TF
+ { \unskip }
+ { \@nolnerr }
+ }
+ \RenewDocumentEnvironment { midparachap } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { midparachap }
+ \cs_set_eq:NN \noindent \tex_noindent:D
+ \cs_set_eq:cN { end ~ } \__scripture_mid_para_chap_end:n
+ \__scripture_reference_start_peek:
+ }
+ {
+ \para_end:
+ \bool_gset_false:N \g__scripture_suppress_next_pilcrow_bool
+ }
+ }
\bool_if:NT \l__scripture_compact_bool
{
- \scripturesetup { chapter / nodrop }
- \RenewDocumentEnvironment { center } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { flushright } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { hanging } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { midparachap } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { narrow } { o } { \ignorespaces } { \unskip }
- \RenewDocumentEnvironment { poetry } { o } { \ignorespaces } { \unskip }
+ \cs_set_eq:NN \noindent \__scripture_para_noindent:
+ \bool_if:NF \l__scripture_verse_para_bool
+ {
+ \bool_set_false:N \l__scripture_chap_drop_bool
+ \bool_set_false:N \l__scripture_chap_drop_llap_bool
+ \bool_set_false:N \l__scripture_chap_drop_smash_bool
+ \bool_set_false:N \l__scripture_chap_para_bool
+ \cs_set_eq:NN \vs \__scripture_verse_compact_output:n
+ }
+ \bool_gset:Nn \g__scripture_mode_vertical_inner_bool
+ { \mode_if_vertical_p: }
+ \RenewDocumentEnvironment { center } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { center }
+ \__scripture_reference_start_peek:
+ }
+ { \__scripture_compact_end_inner: }
+ \RenewDocumentEnvironment { flushright } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { flushright }
+ \__scripture_reference_start_peek:
+ }
+ { \__scripture_compact_end_inner: }
+ \RenewDocumentEnvironment { hanging } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { hanging }
+ \__scripture_reference_start_peek:
+ }
+ { \__scripture_compact_end_inner: }
+ \RenewDocumentEnvironment { midparachap } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { midparachap }
+ \cs_set_eq:cN { end ~ } \__scripture_mid_para_chap_end:n
+ \__scripture_reference_start_peek:
+ }
+ { \__scripture_compact_end_inner: }
+ \RenewDocumentEnvironment { narrow } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { narrow }
+ \__scripture_reference_start_peek:
+ }
+ { \__scripture_compact_end_inner: }
+ \RenewDocumentEnvironment { poetry } { o }
+ {
+ \str_set:Nn \l__scripture_currenvir_str { poetry }
+ \__scripture_reference_start_peek:
+ }
+ { \__scripture_compact_end_inner: }
\cs_set_eq:NN \\ \unskip
- \cs_set_eq:NN \par \relax
+ \cs_set_eq:NN \par \__scripture_compact_par:
\cs_set_eq:NN \extraskip \relax
\cs_set_eq:NN \nohang \relax
\cs_set:Npn \selah
@@ -1805,14 +3241,13 @@
\c_space_tl
##1
}
- \mode_leave_vertical:
}
- \ignorespaces
+ \__scripture_reference_start_peek:
}
{
- \bool_if:NT \l__scripture_compact_bool
- { \cs_set_eq:NN \par \endgraf }
- \__scripture_end:n { #1 }
+ \bool_lazy_or:nnT \l__scripture_compact_bool \l__scripture_verse_para_bool
+ { \cs_set_eq:NN \par \para_end: }
+ \__scripture_end:
}
%%
%%
More information about the tex-live-commits
mailing list.