diff options
author | Karl Berry <karl@freefriends.org> | 2023-12-28 23:07:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-12-28 23:07:42 +0000 |
commit | cb908e7527b1723a5913ed8ee0b7d76448c1c0f6 (patch) | |
tree | 3b94e39657c439466d5fc4b8443b5a5565190bc1 /Master | |
parent | 46927a6f33d9a63981a79f9489ccd9d5cca8c65e (diff) |
scripture (27dec23)
git-svn-id: svn://tug.org/texlive/trunk@69232 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/scripture/scripture.pdf | bin | 956076 -> 965221 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/scripture/scripture.dtx | 1627 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/scripture/scripture.sty | 1282 |
3 files changed, 1490 insertions, 1419 deletions
diff --git a/Master/texmf-dist/doc/latex/scripture/scripture.pdf b/Master/texmf-dist/doc/latex/scripture/scripture.pdf Binary files differindex 6d1f35df3c1..4dbb9323b11 100644 --- a/Master/texmf-dist/doc/latex/scripture/scripture.pdf +++ b/Master/texmf-dist/doc/latex/scripture/scripture.pdf diff --git a/Master/texmf-dist/source/latex/scripture/scripture.dtx b/Master/texmf-dist/source/latex/scripture/scripture.dtx index c54a361a5af..f4a4f6c6a08 100644 --- a/Master/texmf-dist/source/latex/scripture/scripture.dtx +++ b/Master/texmf-dist/source/latex/scripture/scripture.dtx @@ -185,10 +185,13 @@ % \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} +% based environment} +% \changes{v2.0}{2023/12/27}{Bug fixes} % % \title{The \pkg{scripture} package} % \author{David Purton\thanks{Email: \url{dcpurton@marshwiggle.net}}} -% \date{2023/01/08 v1.3} +% \date{2023/12/27 v2.0} % % \maketitle % @@ -248,7 +251,7 @@ % more stretchable space on the page before the incorrect break is enough to % obtain acceptable output. % -% At least version 2022-06-01 of the \LaTeX\ format is required. +% At least version 2022-11-01 of the \LaTeX\ format is required. % % \section{Documentation} % @@ -301,6 +304,37 @@ % % \subsubsection{Functions} % +% \changes{v1.3}{2022/11/15}{Add feature to highlight translator added words} +% \begin{function}[added=2022-11-15]{\added} +% \begin{syntax} +% |\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} +% function. The font and format can be set using the \opt{added/font} and +% \opt{added/format} options. +% \end{function} +% +% \begin{scriptureexample} +% \begin{verbatim} +% \begin{scripture}[John 1:18][verse/font=\bfseries, +% verse/format=#1, verse/sep=0.5em, version=KJV] +% \vs{18}No man hath seen God at any time, the +% only begotten Son, which is in the bosom of the +% Father, he hath declared \added{him}. +% \end{scripture} +% \end{verbatim} +% +% \tcblower +% +% \begin{scripture}[John 1:18][verse/font=\bfseries, +% verse/format=#1, verse/sep=0.5em, version=KJV] +% \vs{18}No man hath seen God at any time, the +% only begotten Son, which is in the bosom of the +% Father, he hath declared \added{him}. +% \end{scripture} +% \end{scriptureexample} +% % \begin{function}{\ch, \ch*} % \begin{syntax} % |\ch|\marg{chapter number} @@ -409,37 +443,6 @@ % \end{scripture} % \end{scriptureexample} % -% \changes{v1.3}{2022/11/15}{Add feature to highlight translator added words} -% \begin{function}[added=2022-11-15]{\added} -% \begin{syntax} -% |\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} -% function. The font and format can be set using the \opt{added/font} and -% \opt{added/format} options. -% \end{function} -% -% \begin{scriptureexample} -% \begin{verbatim} -% \begin{scripture}[John 1:18][verse/font=\bfseries, -% verse/format=#1, verse/sep=0.5em, version=KJV] -% \vs{18}No man hath seen God at any time, the -% only begotten Son, which is in the bosom of the -% Father, he hath declared \added{him}. -% \end{scripture} -% \end{verbatim} -% -% \tcblower -% -% \begin{scripture}[John 1:18][verse/font=\bfseries, -% verse/format=#1, verse/sep=0.5em, version=KJV] -% \vs{18}No man hath seen God at any time, the -% only begotten Son, which is in the bosom of the -% Father, he hath declared \added{him}. -% \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} @@ -592,14 +595,6 @@ % \end{scripture} % \end{scriptureexample} % -% \begin{function}{\scripturesetup} -% \begin{syntax} -% |\scripturesetup|\marg{options} -% \end{syntax} -% Set default format for quotations. See section \ref{options} for -% supported formatting \meta{|options|}. -% \end{function} -% % \changes{v1.1}{2022/08/07}{Add \cs{scripturecurrentchapter} and % \cs{scripturecurrentverse} variables} % \begin{function}[added=2022-08-07]{\scripturecurrentchapter, @@ -614,6 +609,25 @@ % example. % \end{function} % +% \begin{function}{\scripturesetup} +% \begin{syntax} +% |\scripturesetup|\marg{options} +% \end{syntax} +% Set default format for quotations. See section \ref{options} for +% supported formatting \meta{|options|}. +% \end{function} +% +% \changes{v2.0}{2023/12/27}{Add \cs{scripturestyle} function} +% \begin{function}[added=2023/12/27]{\scripturestyle, \scripturestyle*} +% \begin{syntax} +% |\scripturestyle|\marg{name}\marg{options} +% |\scripturestyle*|\marg{name}\marg{options} +% \end{syntax} +% Set \meta{|options|} which are saved as style with \meta{|name|}. These +% can later be set with the \opt{style} option. The starred version appends +% \meta{|options|} to an existing style rather than overwriting all options. +% \end{function} +% % \changes{v1.1}{2022/07/29}{Add \cs{selah} function} % \begin{function}[added=2022-07-29]{\selah} % \begin{syntax} @@ -645,14 +659,6 @@ % \end{scripture} % \end{scriptureexample} % -% \begin{function}{\scripturesetup} -% \begin{syntax} -% |\scripturesetup|\marg{options} -% \end{syntax} -% Set default format for quotations. See section \ref{options} for -% supported formatting \meta{|options|}. -% \end{function} -% % \changes{v1.2}{2022/08/30}{Add \cs{textright} function} % \begin{function}[added=2022-08-30]{\textright} % \begin{syntax} @@ -693,15 +699,16 @@ % \end{syntax} % \cs{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 changes the -% defaults of some options as follows: +% 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: % \begin{itemize} -% \item \opt{compact} is set -% \item \opt{reference/align} is set to |inline| -% \item \opt{reference/sep} is set to |0.5em| -% \item \opt{reference/format} is set to |(#1)| -% \item \opt{version/format} is set to |#1| +% \item \opt{inline/reference/format} +% \item \opt{inline/reference/sep} +% \item \opt{inline/version/delim} +% \item \opt{inline/version/format} % \end{itemize} +% Other \val{reference} and \val{version} options are inherited. % % This function is equivalent to using the \env{scripture} environment with % the \opt{inline} option. @@ -925,7 +932,8 @@ % \end{environment} % % \noindent Environment for typesetting narrow sections of scripture -% quotations. +% quotations. If there is no blank line before the start of a \env{narrow} +% environment the indent will be suppressed. % % See section \ref{narrowoptions} for supported formatting \meta{|options|}. % @@ -939,6 +947,7 @@ % % \vs{19}The field commander said to them, `Tell % Hezekiah: +% % \begin{narrow} % `\thinspace``This is what the great king, the % king of Assyria, says: on what are you basing @@ -957,6 +966,7 @@ % % \vs{19}The field commander said to them, `Tell % Hezekiah: +% % \begin{narrow} % `\thinspace``This is what the great king, the % king of Assyria, says: on what are you basing @@ -1090,8 +1100,7 @@ % \lhead{\textbf{\rightmark}} % \rhead{\textbf{\leftmark} \textbar\ \thepage} % \begin{document} -% \noindent -% \begin{scripture} +% \begin{scripture}[][noindent] % \vs{45}Instead he went out and began to talk % freely, spreading the news. As a result, Jesus % could no longer enter a town openly but stayed @@ -1113,8 +1122,7 @@ % % \rule[2mm]{\linewidth}{0.4pt} % -% \noindent -% \begin{scripture} +% \begin{scripture}[][noindent] % \vs{45}Instead he went out and began to talk % freely, spreading the news. As a result, Jesus % could no longer enter a town openly but stayed @@ -1139,13 +1147,6 @@ % \cs{scripturesetup}|{|\meta{|options|}|}|. Local formatting \meta{|options|} % can be set by passing them to the various environments described above. % -% \textbf{Note:} It's not possible to pass non-expandable macros as key-value -% options to the optional argument of \cs{usepackage}. So if you want to set -% |font=|\cs{bfseries} as the default, you must use -% \cs{scripturesetup}|{font=|\cs{bfseries}|}|. It is not possible to use -% \cs{usepackage}|[font=|\cs{bfseries}|]{scripture}| (you will get a compile -% error). -% % \begin{option}{aboveskip} % \begin{syntax} % aboveskip = \meta{skip} \hfill Default: 0pt @@ -1409,19 +1410,20 @@ % \changes{v1.3}{2023/01/07}{Add \opt{inline} option} % \begin{option}[added=2023-01-07]{inline} % \begin{syntax} -% inline +% 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 changes the defaults of some -% other options as follows: +% and |\,''|, respectively. This option also sets the \opt{compact} option +% set sets the \val{reference} inline. The reference format can be +% controlled using the following options: % \begin{itemize} -% \item \opt{compact} is set -% \item \opt{reference/align} is set to |inline| -% \item \opt{reference/sep} is set to |0.5em| -% \item \opt{reference/format} is set to |(#1)| -% \item \opt{version/format} is set to |#1| +% \item \opt{inline/reference/format} +% \item \opt{inline/reference/sep} +% \item \opt{inline/version/delim} +% \item \opt{inline/version/format} % \end{itemize} +% Other \val{reference} and \val{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 @@ -1448,6 +1450,43 @@ % (if specified). % \end{option} % +% \changes{v2.0}{2023/12/27}{Add \opt{inline/reference/format} option} +% \begin{option}[added=2023-12-27]{inline/reference/format} +% \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). +% \end{option} +% +% \changes{v2.0}{2023/12/27}{Add \opt{inline/reference/sep} option} +% \begin{option}[added=2023-12-27]{inline/reference/sep} +% \begin{syntax} +% 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}. +% \end{option} +% +% \changes{v2.0}{2023/12/27}{Add \opt{inline/version/delim} option} +% \begin{option}[added=2023-12-27]{inline/version/delim} +% \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. +% \end{option} +% +% \changes{v2.0}{2023/12/27}{Add \opt{inline/version/format} option} +% \begin{option}[added=2023-12-27]{inline/version/format} +% \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}. +% \end{option} +% % \begin{option}{indent} % \begin{syntax} % indent = \meta{boolean} \hfill Default: true @@ -1578,10 +1617,10 @@ % \changes{v1.3}{2023/01/08}{Add \opt{reference/align} option} % \begin{option}[added=2023-01-08]{reference/align} % \begin{syntax} -% reference/align = inline \textbar\ left \textbar\ right \hfill Default: right +% reference/align = left \textbar\ right \hfill Default: right % \end{syntax} -% Set the alignment of the reference. For |left| and |right| the reference -% will not break across lines, but a line break is permitted for |inline|. +% Set the alignment of the reference. Note that in neither case will the +% reference break across lines. % \end{option} % % \changes{v1.2}{2022/09/07}{Add \opt{reference/colour} option} @@ -1669,6 +1708,15 @@ % \meta{|text|} used to for \cs{selah} in a \env{poetry} environment. % \end{option} % +% \changes{v2.0}{2023/12/27}{Add \opt{style} option} +% \begin{option}[added=2023/12/27]{style} +% \begin{syntax} +% style = \meta{name} +% \end{syntax} +% Set options previously saved with \cs{scripturestyle}. An error occurs if +% the style isn't defined. +% \end{option} +% % \changes{v1.2}{2022/08/30}{Add \opt{textright/sep} option} % \begin{option}[added=2022-08-30]{textright/sep} % \begin{syntax} @@ -1814,7 +1862,7 @@ % \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.05 em +% verse/sep = \meta{dimen} \hfill Default: 0.05em % \end{syntax} % \meta{|dimen|} used to separate a \cs{vs} from the following text. % \end{option} @@ -2211,8 +2259,8 @@ % \end{macrocode} % % \begin{macrocode} -\NeedsTeXFormat{LaTeX2e}[2022-06-01] -\ProvidesExplPackage{scripture}{2023/01/08}{1.3} +\NeedsTeXFormat{LaTeX2e}[2022-11-01] +\ProvidesExplPackage{scripture}{2023/12/27}{2.0} {Format Scripture Quotations (DCP)} % \end{macrocode} % @@ -2247,6 +2295,16 @@ have~been~loaded~and~set~up.~Ignoring~option~language=#1. } % \end{macrocode} % +% Error if an unknown \opt{style} is requested. +% +% \begin{macrocode} +\msg_new:nnnn { scripture } { unknown-style } + { Style~#1~not~defined. } + { You~have~requested~style=#1,~but~it~has~not~been~defined.~ + You~can~define~it~using~\token_to_str:N \scripturestyle.~ + Ignoring~option~style=#1. } +% \end{macrocode} +% % \subsection{Options} % % Key-value settings for the \env{scripture} environment and its inner @@ -2254,284 +2312,293 @@ % \begin{macrocode} \keys_define:nn { scripture } { - , aboveskip .tl_set:N = \l_@@_aboveskip_tl - , aboveskip .value_required:n = true - , aboveskip .initial:n = \c_zero_skip - , added / font .tl_set:N = \l_@@_added_font_tl - , added / font .value_required:n = true - , added / font .initial:n = - , added / format .cs_set:Np = \@@_added_format:n #1 - , added / format .value_required:n = true - , added / format .initial:n = \emph { #1 } - , belowskip .tl_set:N = \l_@@_belowskip_tl - , belowskip .value_required:n = true - , belowskip .initial:n = \c_zero_skip - , colour .tl_set:N = \l_@@_colour_tl - , colour .value_required:n = true - , colour .initial:n = . - , color .meta:n = { colour = { #1 } } - , compact .bool_set:N = \l_@@_compact_bool - , compact .default:n = true - , compact .initial:n = false - , chapter / font .tl_set:N = \l_@@_chap_font_tl - , chapter / font .value_required:n = true - , chapter / font .initial:n = \bfseries - , chapter / colour .tl_set:N = \l_@@_chapter_colour_tl - , chapter / colour .value_required:n = true - , chapter / colour .initial:n = . - , chapter / color .meta:n = { chapter / colour = { #1 } } - , chapter / drop .bool_set:N = \l_@@_chap_drop_bool - , chapter / drop .default:n = true - , chapter / drop .initial:n = true - , chapter / format .cs_set:Np = \@@_chap_format:n #1 - , chapter / format .value_required:n = true - , chapter / format .initial:n = #1 - , chapter / hide .bool_set_inverse:N = \l_@@_chap_show_bool - , chapter / hide .default:n = true - , chapter / nodrop .bool_set_inverse:N = \l_@@_chap_drop_bool - , chapter / nodrop .default: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 / show .bool_set:N = \l_@@_chap_show_bool - , chapter / show .default:n = true - , chapter / show .initial:n = true - , chapter / showverse .bool_set:N = \l_@@_chap_show_verse_bool - , chapter / showverse .default:n = true - , chapter / showverse .initial:n = false - , extraskip .tl_set:N = \l_@@_extraskip_tl - , extraskip .value_required:n = true - , extraskip .initial:n = \medskipamount - , font .tl_set:N = \l_@@_font_tl - , font .value_required:n = true - , font .initial:n = - , indent .bool_set:N = \l_@@_indent_bool - , indent .default:n = true - , indent .initial:n = true - , _inline .bool_set:N = \l_@@_inline_bool - , _inline .initial:n = false - , inline .meta:n = { - _inline = true , - compact , - reference / format = (##1) , - reference / align = inline , - reference / sep = 0.5 em, - version / format = ##1 - } - , inline .value_forbidden:n = true - , inline / begin .tl_set:N = \l_@@_inline_begin_tl - , inline / begin .value_required:n = true - , inline / begin .initial:n = ``\, - , inline / end .tl_set:N = \l_@@_inline_end_tl - , inline / end .value_required:n = true - , inline / end .initial:n = \,'' - , language .tl_set:N = \l_@@_language_tl - , language .value_required:n = true - , language .initial:n = - , language / variant .tl_set:N = \l_@@_language_variant_tl - , language / variant .value_required:n = true - , language / variant .initial:n = - , leftmargin .tl_set:N = \l_@@_leftmargin_tl - , leftmargin .value_required:n = true - , leftmargin .initial:n = \c_zero_dim - , name / font .tl_set:N = \l_@@_name_font_tl - , name / font .value_required:n = true - , name / font .initial:n = \scshape - , name / format .cs_set:Np = \@@_name_format:n #1 - , name / format .value_required:n = true - , name / format .initial:n = #1 - , noindent .bool_set_inverse:N = \l_@@_indent_bool - , noindent .default:n = true - , parindent .tl_set:N = \l_@@_parindent_tl - , parindent .value_required:n = true - , parindent .initial:n = \parindent - , parskip .tl_set:N = \l_@@_parskip_tl - , parskip .value_required:n = true - , parskip .initial:n = \parskip - , redletter .bool_set:N = \l_@@_red_letter_bool - , redletter .default:n = true - , redletter .initial:n = false - , redletter / colour .tl_set:N = \l_@@_red_letter_colour_tl - , redletter / colour .value_required:n = true - , redletter / colour .initial:n = red!80!black - , redletter / color .meta:n = { redletter / colour = { #1 } } - , reference / align .choices:nn = { inline, left, right } - { - \tl_if_exist:NF \l_@@_ref_align_tl - { \tl_new:N \l_@@_ref_align_tl } - \tl_set_eq:NN \l_@@_ref_align_tl \l_keys_choice_tl - } - , reference / align .value_required:n = true - , reference / align .initial:n = right - , reference / colour .tl_set:N = \l_@@_ref_colour_tl - , reference / colour .value_required:n = true - , reference / colour .initial:n = . - , reference / color .meta:n = { reference / colour = { #1 } } - , reference / font .tl_set:N = \l_@@_ref_font_tl - , reference / font .value_required:n = true - , reference / font .initial:n = \bfseries - , reference / format .cs_set:Np = \@@_ref_format:n #1 - , reference / format .value_required:n = true - , reference / format .initial:n = #1 - , reference / newline .meta:n = { reference / sep = \linewidth } - , reference / newline .value_forbidden:n = true - , reference / sep .tl_set:N = \l_@@_ref_sep_tl - , reference / sep .value_required:n = true - , reference / sep .initial:n = 2 em - , rightmargin .tl_set:N = \l_@@_rightmargin_tl - , rightmargin .value_required:n = true - , rightmargin .initial:n = \c_zero_dim - , selah / text .tl_set:N = \l_@@_selah_text_tl - , selah / text .value_required:n = true - , selah / text .initial:n = Selah - , selah / font .tl_set:N = \l_@@_selah_font_tl - , selah / font .value_required:n = true - , selah / font .initial:n = \itshape - , selah / format .cs_set:Np = \@@_selah_format:n #1 - , selah / format .value_required:n = true - , 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 - , textright / sep .tl_set:N = \l_@@_text_right_sep_tl - , textright / sep .value_required:n = true - , textright / sep .initial:n = 1 em - , verse / colour .tl_set:N = \l_@@_verse_colour_tl - , verse / colour .value_required:n = true - , verse / colour .initial:n = . - , verse / color .meta:n = { verse / colour = { #1 } } - , verse / first .bool_set:N = \l_@@_verse_first_bool - , verse / first .default:n = true - , verse / first .initial:n = false - , verse / firstformat .cs_set:Np = \@@_verse_first_format:n #1 - , verse / firstformat .value_required:n = true - , verse / firstformat .initial:n = #1 - , verse / firstsep .tl_set:N = \l_@@_verse_first_sep_tl - , verse / firstsep .value_required:n = true - , verse / firstsep .initial:n = 0.5em - , verse / font .tl_set:N = \l_@@_verse_font_tl - , verse / font .value_required:n = true - , verse / font .initial:n = - , verse / format .cs_set:Np = \@@_verse_format:n #1 - , verse / format .value_required:n = true - , verse / format .initial:n = \textsuperscript{#1} - , verse / hide .bool_set_inverse:N = \l_@@_verse_show_bool - , verse / hide .default:n = true - , verse / sep .tl_set:N = \l_@@_verse_sep_tl - , verse / sep .value_required:n = true - , verse / sep .initial:n = 0.05 em - , verse / show .bool_set:N = \l_@@_verse_show_bool - , verse / show .default:n = true - , verse / show .initial:n = true - , version .tl_set:N = \l_@@_version_tl - , version .value_required:n = true - , version .initial:n = - , version / delim .tl_set:N = \l_@@_version_delim_tl - , version / delim .value_required:n = true - , version / delim .initial:n = \c_space_tl - , version / format .cs_set:Np = \@@_version_format:n #1 - , version / format .value_required:n = true - , version / format .initial:n = (#1) + , aboveskip .tl_set:N = \l_@@_aboveskip_tl + , aboveskip .value_required:n = true + , aboveskip .initial:n = \c_zero_skip + , added / font .tl_set:N = \l_@@_added_font_tl + , added / font .value_required:n = true + , added / font .initial:n = + , added / format .cs_set:Np = \@@_added_format:n #1 + , added / format .value_required:n = true + , added / format .initial:n = \emph { #1 } + , belowskip .tl_set:N = \l_@@_belowskip_tl + , belowskip .value_required:n = true + , belowskip .initial:n = \c_zero_skip + , colour .tl_set:N = \l_@@_colour_tl + , colour .value_required:n = true + , colour .initial:n = . + , color .meta:n = { colour = { #1 } } + , compact .bool_set:N = \l_@@_compact_bool + , compact .default:n = true + , compact .initial:n = false + , chapter / font .tl_set:N = \l_@@_chap_font_tl + , chapter / font .value_required:n = true + , chapter / font .initial:n = \bfseries + , chapter / colour .tl_set:N = \l_@@_chapter_colour_tl + , chapter / colour .value_required:n = true + , chapter / colour .initial:n = . + , chapter / color .meta:n = { chapter / colour = { #1 } } + , chapter / drop .bool_set:N = \l_@@_chap_drop_bool + , chapter / drop .default:n = true + , chapter / drop .initial:n = true + , chapter / format .cs_set:Np = \@@_chap_format:n #1 + , chapter / format .value_required:n = true + , chapter / format .initial:n = #1 + , chapter / hide .bool_set_inverse:N = \l_@@_chap_show_bool + , chapter / hide .default:n = true + , chapter / nodrop .bool_set_inverse:N = \l_@@_chap_drop_bool + , chapter / nodrop .default: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 / show .bool_set:N = \l_@@_chap_show_bool + , chapter / show .default:n = true + , chapter / show .initial:n = true + , chapter / showverse .bool_set:N = \l_@@_chap_show_verse_bool + , chapter / showverse .default:n = true + , chapter / showverse .initial:n = false + , extraskip .tl_set:N = \l_@@_extraskip_tl + , extraskip .value_required:n = true + , extraskip .initial:n = \medskipamount + , font .tl_set:N = \l_@@_font_tl + , font .value_required:n = true + , font .initial:n = + , indent .bool_set:N = \l_@@_indent_bool + , indent .default:n = true + , indent .initial:n = true + , inline .bool_set:N = \l_@@_inline_bool + , inline .default:n = true + , inline .initial:n = false + , inline / begin .tl_set:N = \l_@@_inline_begin_tl + , inline / begin .value_required:n = true + , inline / begin .initial:n = ``\, + , inline / end .tl_set:N = \l_@@_inline_end_tl + , inline / end .value_required:n = true + , 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 / 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 + , inline / version / format .cs_set:Np = \@@_inline_version_format:n #1 + , inline / version / format .value_required:n = true + , inline / version / format .initial:n = #1 + , language .tl_set:N = \l_@@_language_tl + , language .value_required:n = true + , language .initial:n = + , language / variant .tl_set:N = \l_@@_language_variant_tl + , language / variant .value_required:n = true + , language / variant .initial:n = + , leftmargin .tl_set:N = \l_@@_leftmargin_tl + , leftmargin .value_required:n = true + , leftmargin .initial:n = \c_zero_dim + , name / font .tl_set:N = \l_@@_name_font_tl + , name / font .value_required:n = true + , name / font .initial:n = \scshape + , name / format .cs_set:Np = \@@_name_format:n #1 + , name / format .value_required:n = true + , name / format .initial:n = #1 + , noindent .bool_set_inverse:N = \l_@@_indent_bool + , noindent .default:n = true + , parindent .tl_set:N = \l_@@_parindent_tl + , parindent .value_required:n = true + , parindent .initial:n = \parindent + , parskip .tl_set:N = \l_@@_parskip_tl + , parskip .value_required:n = true + , parskip .initial:n = \parskip + , redletter .bool_set:N = \l_@@_red_letter_bool + , redletter .default:n = true + , redletter .initial:n = false + , redletter / colour .tl_set:N = \l_@@_red_letter_colour_tl + , redletter / colour .value_required:n = true + , redletter / colour .initial:n = red!80!black + , redletter / color .meta:n = { redletter / colour = { #1 } } + , reference / align .choices:nn = { left, right } + { + \tl_if_exist:NF \l_@@_ref_align_tl + { \tl_new:N \l_@@_ref_align_tl } + \tl_set_eq:NN \l_@@_ref_align_tl \l_keys_choice_tl + } + , reference / align .value_required:n = true + , reference / align .initial:n = right + , reference / colour .tl_set:N = \l_@@_ref_colour_tl + , reference / colour .value_required:n = true + , reference / colour .initial:n = . + , reference / color .meta:n = { reference / colour = { #1 } } + , reference / font .tl_set:N = \l_@@_ref_font_tl + , reference / font .value_required:n = true + , reference / font .initial:n = \bfseries + , reference / format .cs_set:Np = \@@_ref_format:n #1 + , reference / format .value_required:n = true + , reference / format .initial:n = #1 + , reference / newline .meta:n = { reference / sep = \linewidth } + , reference / newline .value_forbidden:n = true + , reference / sep .tl_set:N = \l_@@_ref_sep_tl + , reference / sep .value_required:n = true + , reference / sep .initial:n = 2 em + , rightmargin .tl_set:N = \l_@@_rightmargin_tl + , rightmargin .value_required:n = true + , rightmargin .initial:n = \c_zero_dim + , selah / text .tl_set:N = \l_@@_selah_text_tl + , selah / text .value_required:n = true + , selah / text .initial:n = Selah + , selah / font .tl_set:N = \l_@@_selah_font_tl + , selah / font .value_required:n = true + , selah / font .initial:n = \itshape + , selah / format .cs_set:Np = \@@_selah_format:n #1 + , selah / format .value_required:n = true + , 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 + , style .choice: + , style / unknown .code:n = \msg_error:nnx + { scripture } + { unknown-style } + { \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 + , verse / colour .tl_set:N = \l_@@_verse_colour_tl + , verse / colour .value_required:n = true + , verse / colour .initial:n = . + , verse / color .meta:n = { verse / colour = { #1 } } + , verse / first .bool_set:N = \l_@@_verse_first_bool + , verse / first .default:n = true + , verse / first .initial:n = false + , verse / firstformat .cs_set:Np = \@@_verse_first_format:n #1 + , verse / firstformat .value_required:n = true + , verse / firstformat .initial:n = #1 + , verse / firstsep .tl_set:N = \l_@@_verse_first_sep_tl + , verse / firstsep .value_required:n = true + , verse / firstsep .initial:n = 0.5em + , verse / font .tl_set:N = \l_@@_verse_font_tl + , verse / font .value_required:n = true + , verse / font .initial:n = + , verse / format .cs_set:Np = \@@_verse_format:n #1 + , verse / format .value_required:n = true + , verse / format .initial:n = \textsuperscript{#1} + , verse / hide .bool_set_inverse:N = \l_@@_verse_show_bool + , verse / hide .default:n = true + , verse / sep .tl_set:N = \l_@@_verse_sep_tl + , verse / sep .value_required:n = true + , verse / sep .initial:n = 0.05 em + , verse / show .bool_set:N = \l_@@_verse_show_bool + , verse / show .default:n = true + , verse / show .initial:n = true + , version .tl_set:N = \l_@@_version_tl + , version .value_required:n = true + , version .initial:n = + , version / delim .tl_set:N = \l_@@_version_delim_tl + , version / delim .value_required:n = true + , version / delim .initial:n = \c_space_tl + , version / format .cs_set:Np = \@@_version_format:n #1 + , version / format .value_required:n = true + , version / format .initial:n = (#1) % \end{macrocode} % Options for the \env{center} environment. % \begin{macrocode} - , center / aboveskip .tl_set:N = \l_@@_center_aboveskip_tl - , center / aboveskip .value_required:n = true - , center / aboveskip .initial:n = \medskipamount - , center / belowskip .tl_set:N = \l_@@_center_belowskip_tl - , center / belowskip .value_required:n = true - , center / belowskip .initial:n = \medskipamount - , center / leftmargin .tl_set:N = \l_@@_center_leftmargin_tl - , center / leftmargin .value_required:n = true - , center / leftmargin .initial:n = \c_zero_dim - , center / rightmargin .tl_set:N = \l_@@_center_rightmargin_tl - , center / rightmargin .value_required:n = true - , center / rightmargin .initial:n = \c_zero_dim + , center / aboveskip .tl_set:N = \l_@@_center_aboveskip_tl + , center / aboveskip .value_required:n = true + , center / aboveskip .initial:n = \medskipamount + , center / belowskip .tl_set:N = \l_@@_center_belowskip_tl + , center / belowskip .value_required:n = true + , center / belowskip .initial:n = \medskipamount + , center / leftmargin .tl_set:N = \l_@@_center_leftmargin_tl + , center / leftmargin .value_required:n = true + , center / leftmargin .initial:n = \c_zero_dim + , center / rightmargin .tl_set:N = \l_@@_center_rightmargin_tl + , center / rightmargin .value_required:n = true + , center / rightmargin .initial:n = \c_zero_dim % \end{macrocode} % Options for the \env{flushright} environment. % \begin{macrocode} - , flushright / aboveskip .tl_set:N = \l_@@_flushright_aboveskip_tl - , flushright / aboveskip .value_required:n = true - , flushright / aboveskip .initial:n = \medskipamount - , flushright / belowskip .tl_set:N = \l_@@_flushright_belowskip_tl - , flushright / belowskip .value_required:n = true - , flushright / belowskip .initial:n = \medskipamount - , flushright / leftmargin .tl_set:N = \l_@@_flushright_leftmargin_tl - , flushright / leftmargin .value_required:n = true - , flushright / leftmargin .initial:n = \c_zero_dim - , flushright / rightmargin .tl_set:N = \l_@@_flushright_rightmargin_tl - , flushright / rightmargin .value_required:n = true - , flushright / rightmargin .initial:n = \c_zero_dim + , flushright / aboveskip .tl_set:N = \l_@@_flushright_aboveskip_tl + , flushright / aboveskip .value_required:n = true + , flushright / aboveskip .initial:n = \medskipamount + , flushright / belowskip .tl_set:N = \l_@@_flushright_belowskip_tl + , flushright / belowskip .value_required:n = true + , flushright / belowskip .initial:n = \medskipamount + , flushright / leftmargin .tl_set:N = \l_@@_flushright_leftmargin_tl + , flushright / leftmargin .value_required:n = true + , flushright / leftmargin .initial:n = \c_zero_dim + , flushright / rightmargin .tl_set:N = \l_@@_flushright_rightmargin_tl + , flushright / rightmargin .value_required:n = true + , flushright / rightmargin .initial:n = \c_zero_dim % \end{macrocode} % Options for the \env{hanging} environment. % \begin{macrocode} - , hanging / aboveskip .tl_set:N = \l_@@_hanging_aboveskip_tl - , hanging / aboveskip .value_required:n = true - , hanging / aboveskip .initial:n = \medskipamount - , hanging / belowskip .tl_set:N = \l_@@_hanging_belowskip_tl - , hanging / belowskip .value_required:n = true - , hanging / belowskip .initial:n = \medskipamount - , hanging / hang .tl_set:N = \l_@@_hanging_hang_tl - , hanging / hang .value_required:n = true - , hanging / hang .initial:n = 2 em - , hanging / leftmargin .tl_set:N = \l_@@_hanging_leftmargin_tl - , hanging / leftmargin .value_required:n = true - , hanging / leftmargin .initial:n = 1 em - , hanging / rightmargin .tl_set:N = \l_@@_hanging_rightmargin_tl - , hanging / rightmargin .value_required:n = true - , hanging / rightmargin .initial:n = \c_zero_dim + , hanging / aboveskip .tl_set:N = \l_@@_hanging_aboveskip_tl + , hanging / aboveskip .value_required:n = true + , hanging / aboveskip .initial:n = \medskipamount + , hanging / belowskip .tl_set:N = \l_@@_hanging_belowskip_tl + , hanging / belowskip .value_required:n = true + , hanging / belowskip .initial:n = \medskipamount + , hanging / hang .tl_set:N = \l_@@_hanging_hang_tl + , hanging / hang .value_required:n = true + , hanging / hang .initial:n = 2 em + , hanging / leftmargin .tl_set:N = \l_@@_hanging_leftmargin_tl + , hanging / leftmargin .value_required:n = true + , hanging / leftmargin .initial:n = 1 em + , hanging / rightmargin .tl_set:N = \l_@@_hanging_rightmargin_tl + , hanging / rightmargin .value_required:n = true + , hanging / rightmargin .initial:n = \c_zero_dim % \end{macrocode} % Options for the mid-paragraph chapters (including the \env{midparachap} environment). % \begin{macrocode} - , midparachap / hideverse .bool_set_inverse:N = \l_@@_midparachap_show_verse_bool - , midparachap / hideverse .default:n = true - , midparachap / showverse .bool_set:N = \l_@@_midparachap_show_verse_bool - , midparachap / showverse .default:n = true - , midparachap / showverse .initial:n = true + , midparachap / hideverse .bool_set_inverse:N = \l_@@_midparachap_show_verse_bool + , midparachap / hideverse .default:n = true + , midparachap / showverse .bool_set:N = \l_@@_midparachap_show_verse_bool + , midparachap / showverse .default:n = true + , midparachap / showverse .initial:n = true % \end{macrocode} % Options for the \env{narrow} environment. % \begin{macrocode} - , narrow / aboveskip .tl_set:N = \l_@@_narrow_aboveskip_tl - , narrow / aboveskip .value_required:n = true - , narrow / aboveskip .initial:n = \medskipamount - , narrow / belowskip .tl_set:N = \l_@@_narrow_belowskip_tl - , narrow / belowskip .value_required:n = true - , 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 / rightmargin .tl_set:N = \l_@@_narrow_rightmargin_tl - , narrow / rightmargin .value_required:n = true - , narrow / rightmargin .initial:n = 1 em + , narrow / aboveskip .tl_set:N = \l_@@_narrow_aboveskip_tl + , narrow / aboveskip .value_required:n = true + , narrow / aboveskip .initial:n = \medskipamount + , narrow / belowskip .tl_set:N = \l_@@_narrow_belowskip_tl + , narrow / belowskip .value_required:n = true + , 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 / rightmargin .tl_set:N = \l_@@_narrow_rightmargin_tl + , narrow / rightmargin .value_required:n = true + , narrow / rightmargin .initial:n = 1 em % \end{macrocode} % Options for the \env{poetry} environment. % \begin{macrocode} - , poetry / aboveskip .tl_set:N = \l_@@_poetry_aboveskip_tl - , poetry / aboveskip .value_required:n = true - , poetry / aboveskip .initial:n = \medskipamount - , poetry / belowskip .tl_set:N = \l_@@_poetry_belowskip_tl - , poetry / belowskip .value_required:n = true - , 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 / indent .tl_set:N = \l_@@_poetry_indent_tl - , poetry / indent .value_required:n = true - , poetry / indent .initial:n = 1 em - , poetry / leftmargin .tl_set:N = \l_@@_poetry_leftmargin_tl - , poetry / leftmargin .value_required:n = true - , poetry / leftmargin .initial:n = 1 em - , poetry / rightmargin .tl_set:N = \l_@@_poetry_rightmargin_tl - , poetry / rightmargin .value_required:n = true - , poetry / rightmargin .initial:n = \c_zero_dim - , poetry / verse / left .bool_set_inverse:N = \l_@@_poetry_verse_right_bool - , poetry / verse / left .default:n = true - , poetry / verse / right .bool_set:N = \l_@@_poetry_verse_right_bool - , poetry / verse / right .default:n = true - , 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 / aboveskip .tl_set:N = \l_@@_poetry_aboveskip_tl + , poetry / aboveskip .value_required:n = true + , poetry / aboveskip .initial:n = \medskipamount + , poetry / belowskip .tl_set:N = \l_@@_poetry_belowskip_tl + , poetry / belowskip .value_required:n = true + , 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 / indent .tl_set:N = \l_@@_poetry_indent_tl + , poetry / indent .value_required:n = true + , poetry / indent .initial:n = 1 em + , poetry / leftmargin .tl_set:N = \l_@@_poetry_leftmargin_tl + , poetry / leftmargin .value_required:n = true + , poetry / leftmargin .initial:n = 1 em + , poetry / rightmargin .tl_set:N = \l_@@_poetry_rightmargin_tl + , poetry / rightmargin .value_required:n = true + , poetry / rightmargin .initial:n = \c_zero_dim + , poetry / verse / left .bool_set_inverse:N = \l_@@_poetry_verse_right_bool + , poetry / verse / left .default:n = true + , poetry / verse / right .bool_set:N = \l_@@_poetry_verse_right_bool + , poetry / verse / right .default:n = true + , 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 } % \end{macrocode} % Process package options. @@ -2539,6 +2606,30 @@ \ProcessKeyOptions % \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 +% than replaced. +% \begin{macrocode} +\cs_new_protected:Nn \@@_setup_style:nnn + { + \bool_if:NTF #1 + { + \tl_if_exist:cF { g__@@_style_ #2 _tl } + { \tl_new:c { g__@@_style_ #2 _tl } } + \@@_setup_style:nne \c_false_bool { #2 } + { \tl_use:c { g__@@_style_ #2 _tl } , #3 } + } + { + \tl_gset:cn { g__@@_style_ #2 _tl } { #3 } + \keys_define:nn { scripture } + { style / #2 .meta:n = { #3 } } + } + } +\cs_generate_variant:Nn \@@_setup_style:nnn { nne } +% \end{macrocode} +% \end{macro} +% % \subsection{Hooks} % % \begin{hooks}{scripture/chap/before, scripture/chap/after, @@ -2570,6 +2661,64 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\g_@@_prev_inner_below_skip} +% Save the last below skip of an inner environment so it can be removed if +% the main scripture environment ends with and inner environment. +% \begin{macrocode} +\skip_new:N \g_@@_prev_inner_below_skip +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l_@@_outer_itemindent_dim} +% Holds the \cs{itemindent} of the outer list. Used to calculate the +% \cs{itemindent} to retain correct indenting when a list environment is +% the first thing in an outer list. +% \begin{macrocode} +\dim_new:N \l_@@_outer_itemindent_dim +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_setup_list_noindent:n} +% Set \cs{noindent} to do a negative horizontal skip a list is the first +% item in a list then restore it at the end of the paragraph. This allows +% \cs{itemindent} to be set to a negative value and still have \cs{noindent} +% behave as expected. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_setup_list_noindent:n + { + \legacy_if:nT {@newlist} + { + \cs_set_protected_nopar:Npn \noindent + { + \skip_horizontal:n { -#1 } + } + \hook_gput_next_code:nn { para / end } + { + \cs_gset_eq:NN \noindent \tex_noindent:D + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_skip_diff:NN} +% Find the difference between two skips while avoiding negative stretch and +% shrink components. +% \begin{macrocode} +\cs_new_protected:Nn \@@_skip_diff:NN + { + \skip_eval:n + { + \dim_eval:n { \dimexpr #1 - \dimexpr #2 } + ~ plus ~ + \dim_max:nn { \gluestretch #1 - \gluestretch #2 } \c_zero_dim + ~ minus ~ + \dim_max:nn { \glueshrink #1 - \glueshrink #2 } \c_zero_dim + } + } +% \end{macrocode} +% \end{macro} +% % \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 @@ -2656,7 +2805,8 @@ % \begin{macrocode} \tl_if_empty:NF \l_@@_version_tl { - \l_@@_version_delim_tl + \tl_if_empty:nF { #1 } + { \l_@@_version_delim_tl } \@@_version_format:n { \l_@@_version_tl } } } @@ -2674,30 +2824,21 @@ { \@@_format_full_ref:n { #1 } } -% \end{macrocode} -% Since the \env{poetry} environment uses \cs{@@_obeylines:} there is always -% an extra \cs{parskip} when a \env{scripture} quotation ends with a -% \env{poetry} -% environment. -% \begin{macrocode} - \bool_if:NT \g_@@_poetry_end_bool - { \skip_vertical:n { -\parskip } } \dim_compare:nNnT { \box_wd:N \l_@@_ref_box + \g_@@_final_line_dim + \l_@@_ref_sep_tl } > \linewidth - { \skip_vertical:N \baselineskip } -% \end{macrocode} -% If a \env{scripture} quotation ends with an inner environment, there will -% be an extra space of \cs{baselineskip}. -% \begin{macrocode} - \int_compare:nNnT \prevgraf = \c_zero_int - { \skip_vertical:n { -\baselineskip } } - \tl_if_eq:NnT \l_@@_ref_align_tl { right } + { + \skip_vertical:N \baselineskip + \tl_if_eq:NnT \l_@@_ref_align_tl { left } + { + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \skip_vertical:N \baselineskip } + } + } + \tl_if_eq:NnTF \l_@@_ref_align_tl { right } { \hfill } - \tl_if_eq:NnT \l_@@_ref_align_tl { left } { - \mode_leave_vertical: \dim_compare:nNnT { \box_wd:N \l_@@_ref_box + \g_@@_final_line_dim + \l_@@_ref_sep_tl } < @@ -2798,7 +2939,7 @@ { \msg_warning:nnx { scripture } - { language-waning } + { language-warning } { \l_@@_language_tl } } } @@ -2893,8 +3034,7 @@ \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 + \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 } @@ -2926,9 +3066,7 @@ \hook_use:n { scripture / chap / after } \group_end: \bool_if:NT \l_@@_chap_show_verse_bool - { - \@@_verse_output:n { 1 } - } + { \@@_verse_output:n { 1 } } } % \end{macrocode} % \end{macro} @@ -2995,13 +3133,13 @@ } \hook_gput_next_code:nn { para / before } { - \int_compare:nNnT - \g_@@_chap_par_prevgraf_int = 1 - { \extraskip } - \int_gzero:N \g_@@_chap_par_prevgraf_int - \int_compare:nNnT - \@listdepth > \c_zero_int - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } + \legacy_if:nF { @newlist } + { + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \extraskip } + \int_gzero:N \g_@@_chap_par_prevgraf_int + } + \parshape 1 ~ \@totalleftmargin ~ \linewidth } } % \end{macrocode} @@ -3103,14 +3241,10 @@ } $$ \@@_reset_spacing: - \dim_compare:nNnT \g_@@_final_line_dim > \linewidth - { - \dim_gset_eq:NN \g_@@_final_line_dim \linewidth - } + \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 } - { - \skip_vertical:n { -\baselineskip - \parskip } - } + { \skip_vertical:n { -\baselineskip - \parskip } } } % \end{macrocode} % \end{macro} @@ -3132,12 +3266,69 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\g_@@_start_bool} -% Flag indicating whether we are currently setting the first paragraph in a -% \env{scripture} environment. If this is \val{true}, any \opt{aboveskip} -% for an inner environment will be ignored. +% \begin{macro}{\@@_added:n} +% Mark text as added. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_added:n + { + \group_begin: + \l_@@_added_font_tl + \@@_added_format:n { #1 } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_name:n} +% Output divine name. % \begin{macrocode} -\bool_new:N \g_@@_start_bool +\cs_new_protected_nopar:Nn \@@_name:n + { + \group_begin: + \l_@@_name_font_tl + \@@_name_format:n { #1 } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_no_first_verse:} +% Suppress special formatting for first verse if active. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_no_first_verse: + { + \bool_set_true:N \l_@@_no_verse_first_bool + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_ch:nn} +% Print a chapter number in the main scripture environment. +% \begin{macrocode} +\cs_new_protected:Nn \@@_ch_output:nn + { + \bool_if:NTF \l_@@_chap_show_bool + { + \bool_if:NTF \l_@@_chap_drop_bool + { + \@@_chap:n { #2 } + \bool_if:nTF { #1 } + { + \hook_gput_next_code:nn { para / after } + { + \int_gzero:N \g_@@_chap_par_prevgraf_int + \int_gzero:N \g_@@_mid_para_chap_prevgraf_int + } + } + { + \hook_gput_next_code:nn { para / after } + { \int_gset_eq:NN \g_@@_mid_para_chap_prevgraf_int \prevgraf } + } + } + { \@@_nodrop_chap:n { #2 } } + } + { \@@_nodrop_chap:n { #2 } } + } % \end{macrocode} % \end{macro} % @@ -3146,6 +3337,7 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_begin:n { + \cs_set_eq:NN \@@_noindent_saved: \noindent \bool_if:NT \l_@@_active_bool { \msg_error:nn { scripture } { nested-environment } @@ -3157,131 +3349,74 @@ \keys_set:nn { scripture } { #1 } } \@@_select_language: -% \end{macrocode} -% If the \env{scripture} environment begins immediately after an \cs{item}, -% then insert a new paragraph and apply a negative skip. Life is much easier -% if all paragraphs in a \env{scripture} are the same rather than the first -% one being in the first paragraph of an \cs{item}. -% \begin{macrocode} - \legacy_if:nT { @newlist } - { - \strut - \par - \vspace* { \dim_eval:n { -\baselineskip - \parskip } } - } - \mode_if_vertical:T - { - \addvspace { \l_@@_aboveskip_tl } - } - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l_@@_chap_show_bool - { - \bool_if:NTF \l_@@_chap_drop_bool - { - \@@_chap:n { ##2 } - \bool_if:nT { ##1 } - { - \hook_gput_next_code:nn { para / after } - { \int_gzero:N \g_@@_chap_par_prevgraf_int } - } - } - { \@@_nodrop_chap:n { ##2 } } - } - { \@@_nodrop_chap:n { ##2 } } - } + \int_gzero:N \g_@@_chap_par_prevgraf_int % \end{macrocode} % Empty \cs{everydisplay} to ensure it isn't interring with spacing. % \begin{macrocode} \everydisplay { } \int_set:Nn \predisplaypenalty { 10000 } \int_set_eq:NN \postdisplaypenalty \@lowpenalty - \bool_gset_true:N \g_@@_start_bool + \int_set:Nn \@beginparpenalty { -\@lowpenalty } + \int_set_eq:NN \@endparpenalty \@lowpenalty \bool_gset_false:N \g_@@_poetry_end_bool - \dim_set_eq:NN \parindent \l_@@_parindent_tl \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_eq:NN \vs \@@_verse_output:n - \cs_set_protected_nopar:Npn \added ##1 - { - \group_begin: - \l_@@_added_font_tl - \@@_added_format:n { ##1 } - \group_end: - } - \cs_set_protected_nopar:Npn \name ##1 - { - \group_begin: - \l_@@_name_font_tl - \@@_name_format:n { ##1 } - \group_end: - } - \cs_set_protected_nopar:Npn \nofirstverse - { - \bool_set_true:N \l_@@_no_verse_first_bool - } - \cs_set_protected_nopar:Npn \LORD - { - \name { Lord } - } - \cs_set_protected_nopar:Npn \GOD - { - \name { God } - } + \cs_set_eq:NN \added \@@_added:n + \cs_set_eq:NN \name \@@_name:n + \cs_set_protected_nopar:Npn \LORD { \name { Lord } } + \cs_set_protected_nopar:Npn \GOD { \name { God } } + \cs_set_eq:NN \nofirstverse \@@_no_first_verse: \cs_set_protected_nopar:Npn \textright ##1 - { - \@@_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } - } + { \@@_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } } \hook_gclear_next_code:n { para / before } - \skip_set:Nn \l_@@_parskip_correction_skip { \parskip - \l_@@_parskip_tl } - \mode_if_vertical:T - { - \addvspace { \l_@@_parskip_correction_skip } - } - \skip_set_eq:NN \parskip \l_@@_parskip_tl \l_@@_font_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 } } + \bool_if:NTF \l_@@_inline_bool + { \l_@@_inline_begin_tl } { - \color_select:n { scripture default colour } - } -% \end{macrocode} -% For left and right margins, use \cs{parshape} is already in a list, -% otherwise use \cs{leftskip} and \cs{rightskip} -% \begin{macrocode} - \bool_lazy_or:nnT - { \dim_compare_p:n { \l_@@_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l_@@_rightmargin_tl > 0pt } } - { - \dim_sub:Nn \linewidth - { \l_@@_leftmargin_tl + \l_@@_rightmargin_tl } - \int_compare:nNnTF - \@listdepth > \c_zero_int - { - \dim_add:Nn \@totalleftmargin \l_@@_leftmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - { - \dim_add:Nn \leftskip \l_@@_leftmargin_tl - \dim_add:Nn \rightskip \l_@@_rightmargin_tl - } - } - \bool_if:NF \l_@@_indent_bool - { - \hook_gput_next_code:nn { para / begin } + \legacy_if:nTF { @newlist } + { \dim_set_eq:NN \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } + \list { } { - \bool_lazy_any:nT + \dim_set_eq:NN \leftmargin \l_@@_leftmargin_tl + \dim_set_eq:NN \rightmargin \l_@@_rightmargin_tl + \dim_set:Nn \itemindent { \l_@@_parindent_tl - \l_@@_outer_itemindent_dim } + \dim_set_eq:NN \listparindent \l_@@_parindent_tl + \skip_zero:N \partopsep + \skip_set_eq:NN \parsep \l_@@_parskip_tl + \dim_compare:nNnTF \parskip > \l_@@_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \l_@@_parindent_tl } + \bool_if:NF \l_@@_indent_bool { - { \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 } } + \hook_gput_next_code:nn { para / begin } + { + \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 } + { \noindent } + { \para_omit_indent: } + } + } } - { \para_omit_indent: } } - } - \bool_if:NT \l_@@_inline_bool - { \l_@@_inline_begin_tl } + \dim_set_eq:NN \parindent \l_@@_parindent_tl + \item + \relax + } } % \end{macrocode} % \end{macro} @@ -3291,105 +3426,67 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_end:n { - \tl_if_eq:NnTF \l_@@_ref_align_tl { inline } + \bool_if:NTF \l_@@_inline_bool { - \bool_lazy_or:nnF + \unskip + \@@_red_letter_off: + \l_@@_inline_end_tl + \bool_lazy_or:nnTF { \tl_if_novalue_p:n { #1 } } { \tl_if_empty_p:n { #1 } } { - \unskip - \@@_red_letter_off: - \bool_if:NT \l_@@_inline_bool - { \l_@@_inline_end_tl } + \tl_if_empty:NF \l_@@_version_tl + { + \skip_horizontal:N \l_@@_ref_sep_tl + \@@_format_full_ref:n { } + } + } + { \skip_horizontal:N \l_@@_ref_sep_tl \@@_format_full_ref:n { #1 } } } { + \@@_red_letter_off: + \skip_zero:N \parskip + \int_set:Nn \postdisplaypenalty { 10000 } + \@@_calc_final_line_length: + \dim_gsub:Nn \g_@@_final_line_dim \@totalleftmargin + \dim_compare:nNnTF \@outerparskip > \l_@@_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_belowskip_tl \@outerparskip } } % \end{macrocode} -% Normally \cs{unskip} does not work in vertical mode, but there are some -% situations where it does work. The following condition is true if the -% \env{scripture} environment has ended with one of its internal -% environments. This removes any unwanted \opt{belowskip} if present and -% leaves the previously calculated line length of the final paragraph intact. +% If a \env{scripture} quotation ends with an inner environment, remove the +% below skip of the inner environment. % \begin{macrocode} - \mode_if_vertical:TF - { - \unskip - \unskip - } - { - \tl_if_novalue:nTF { #1 } - { \int_zero:N \postdisplaypenalty } - { \int_set_eq:NN \postdisplaypenalty \@highpenalty } - \@@_calc_final_line_length: - } -% \end{macrocode} -% Restore left margin by resetting the \cs{parshape} if in a list -% based environment, otherwise the space required for the reference is -% incorrectly calculated. -% \begin{macrocode} - \bool_lazy_or:nnTF - { \dim_compare_p:n { \l_@@_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l_@@_rightmargin_tl > 0pt } } - { - \dim_add:Nn \linewidth \l_@@_leftmargin_tl - \int_compare:nNnT - \@listdepth > \c_zero_int - { - \dim_sub:Nn \@totalleftmargin \l_@@_leftmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - } - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } - \@@_red_letter_off: - \bool_lazy_or:nnF - { \tl_if_novalue_p:n { #1 } } - { \tl_if_empty_p:n { #1 } } - { \@@_reference:n { #1 } } - \par + \int_compare:nNnT \prevgraf = \c_zero_int + { \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_empty:NTF \l_@@_version_tl + { \hbox:n { } } + { \@@_reference:n { } } + } + { \@@_reference:n { #1 } } % \end{macrocode} -% Restore right margin by resetting the \cs{parshape} if in a \LaTeX{} list -% based environment, since only the left margin was restored above. +% Set \val{@noparlist} to \val{false} to ensure \cs{topsep} is always added +% \env{scripture} environment % \begin{macrocode} - \bool_lazy_or:nnT - { \dim_compare_p:n { \l_@@_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l_@@_rightmargin_tl > 0pt } } - { - \int_compare:nNnT - \@listdepth > \c_zero_int - { - \dim_add:Nn \linewidth \l_@@_rightmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - } - \dim_compare:nNnTF - { \glueexpr \l_@@_belowskip_tl } > \parskip - { - \addvspace - { - \skip_eval:n { \l_@@_belowskip_tl - \parskip } - } - } - { - \addvspace { \l_@@_belowskip_tl } - } + \@noparlistfalse + \endlist } + \cs_set_eq:NN \noindent \@@_noindent_saved: } % \end{macrocode} % \end{macro} % % \subsection{Scripture internal environments} % -% \begin{macro}{\l_@@_delta_below_skip} -% Correction to \tn{@topsepadd} for internal environments. This enables a -% different \opt{aboveskip} and \opt{belowskip} which are normally the -% same for \LaTeX{} lists. -% \begin{macrocode} -\skip_new:N \l_@@_delta_below_skip -% \end{macrocode} -% \end{macro} -% % \subsubsection{The \env{center} environment} % % \begin{macro}{\@@_center_begin:n} @@ -3409,41 +3506,29 @@ { scripture / center } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_center_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_center_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_center_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_center_aboveskip_tl - } - \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_@@_center_leftmargin_tl + \dim_set_eq:NN \rightmargin \l_@@_center_rightmargin_tl + \dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim } + \dim_zero:N \listparindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \leftmargin - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l_@@_center_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_center_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \c_zero_dim } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \centering \item \relax @@ -3456,9 +3541,12 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_center_end: { - \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth } + \dim_compare:nNnTF \@outerparskip > \l_@@_center_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_center_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -3483,43 +3571,29 @@ { scripture / flushright } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_flushright_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_flushright_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_flushright_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_flushright_aboveskip_tl - } - \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_@@_flushright_leftmargin_tl \dim_set_eq:NN \rightmargin \l_@@_flushright_rightmargin_tl + \dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim } + \dim_zero:N \listparindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \leftmargin - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l_@@_flushright_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_flushright_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \c_zero_dim } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \raggedleft \item \relax @@ -3532,9 +3606,12 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_flushright_end: { - \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth } + \dim_compare:nNnTF \@outerparskip > \l_@@_flushright_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_flushright_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -3549,6 +3626,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_hanging_ch:n} +% Position a chapter in a \env{hanging} environment. +% \begin{macrocode} +\cs_new_protected:Nn \@@_hanging_ch:n + { + \bool_if:NTF \l_@@_chap_show_bool + { + \bool_if:NTF \l_@@_chap_drop_bool + { \@@_hanging_chap:n { #1 } } + { \@@_nodrop_chap:n { #1 } } + } + { \@@_nodrop_chap:n { #1 } } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_hanging_chap:n} % Position a drop chapter in a \env{hanging} environment. % \begin{macrocode} @@ -3587,17 +3680,15 @@ } ~ \@totalleftmargin ~ \linewidth } - \mode_if_vertical:T + \tl_set:Nx \l_@@_chap_sep_tl { - \tl_set:Nx \l_@@_chap_sep_tl + \dim_eval:n { - \dim_eval:n - { - \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim - } + \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim } - \@@_nohang: } + \par + \@@_nohang: \hbox_set:Nn \l_@@_chap_box { \box_move_down:nn @@ -3652,7 +3743,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Nn \@@_nohang: { - \para_raw_noindent: + \noindent \hbox_to_wd:nn { \l_@@_hanging_parindent_saved_dim } { } } % \end{macrocode} @@ -3675,58 +3766,33 @@ { scripture / hanging } { #1 } } - \mode_if_horizontal:T - { \par } + \DeclareDocumentCommand { \ch } { sm } { \@@_hanging_ch:n { ##2 } } + \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 } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_hanging_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool - { - \dim_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_hanging_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_hanging_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_hanging_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int - } - \dim_set:Nn \leftmargin - { \l_@@_hanging_leftmargin_tl + \l_@@_hanging_hang_tl } + \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 - \dim_set:Nn \itemindent { -\l_@@_hanging_hang_tl } + \dim_set:Nn \itemindent { -\l_@@_hanging_hang_tl - \l_@@_outer_itemindent_dim } \dim_set:Nn \listparindent { -\l_@@_hanging_hang_tl } \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \labelsep - \dim_set_eq:NN \l_@@_hanging_parindent_saved_dim \parindent - } - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l_@@_chap_show_bool - { - \bool_if:NTF \l_@@_chap_drop_bool - { \@@_hanging_chap:n { ##2 } } - { \@@_nodrop_chap:n { ##2 } } - } - { \@@_nodrop_chap:n { ##2 } } + \dim_compare:nNnTF \parskip > \l_@@_hanging_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_hanging_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { -\l_@@_hanging_hang_tl } } - \cs_set_eq:NN \vs \@@_hanging_verse:n - \cs_set_eq:NN \nohang \@@_nohang: + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \item \relax } @@ -3739,8 +3805,11 @@ \cs_new_protected:Nn \@@_hanging_end: { \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > \l_@@_hanging_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_hanging_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -3782,6 +3851,14 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\l_@@_mid_para_chap_totalleftmargin_dim} +% Save the \cs{@totalleftmargin} before starting a \env{midparachap} +% environment. +% \begin{macrocode} +\dim_new:N \l_@@_mid_para_chap_totalleftmargin_dim +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\g_@@_mid_para_chap_prevgraf_int} % Store the \cs{prevgraf} of the final paragraph in a \env{midparachap} % environment. @@ -3888,6 +3965,11 @@ \par \bool_set_true:N \l_@@_mid_para_chap_bool \@@_vbox_set_top:Nw \l_@@_mid_para_chap_box + \dim_zero:N \leftskip + \dim_zero:N \rightskip + \dim_set_eq:NN \l_@@_mid_para_chap_totalleftmargin_dim \@totalleftmargin + \dim_zero:N \@totalleftmargin + \dim_set_eq:NN \hsize \linewidth \skip_zero:N \parskip } % \end{macrocode} @@ -3899,7 +3981,6 @@ \cs_new_protected:Nn \@@_mid_para_chap_end: { \par - \int_gset_eq:NN \g_@@_mid_para_chap_prevgraf_int \prevgraf \dim_gset_eq:NN \g_@@_mid_para_chap_prevdepth_dim \prevdepth \box_set_to_last:N \l_@@_mid_para_chap_line_box \hbox_set:Nn \l_@@_mid_para_chap_snap_box @@ -3909,7 +3990,8 @@ \unskip \unpenalty } - \dim_gset:Nn \g_@@_final_line_dim { \box_wd:N \l_@@_mid_para_chap_snap_box } + \dim_gset:Nn \g_@@_final_line_dim + { \box_wd:N \l_@@_mid_para_chap_snap_box + \l_@@_mid_para_chap_totalleftmargin_dim } \box_clear:N \l_@@_mid_para_chap_snap_box \nointerlineskip \int_compare:nNnT @@ -3961,9 +4043,7 @@ \hook_gput_next_code:nn { para / before } { \int_gzero:N \g_@@_chap_par_prevgraf_int - \int_compare:nNnT - \@listdepth > \c_zero_int - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } + \parshape 1 ~ \@totalleftmargin ~ \linewidth } } % \end{macrocode} @@ -3988,44 +4068,39 @@ { scripture / narrow } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_narrow_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool + %\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 { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool + \dim_set:Nn \itemindent { \parindent - \l_@@_outer_itemindent_dim } + \@@_setup_list_noindent:n { \parindent } } { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_narrow_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_narrow_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_narrow_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int + \dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim } + \@@_setup_list_noindent:n { \c_zero_dim } } - \dim_set_eq:NN \leftmargin \l_@@_narrow_leftmargin_tl - \dim_set_eq:NN \rightmargin \l_@@_narrow_rightmargin_tl - \dim_set_eq:NN \listparindent \parindent - \dim_set_eq:NN \itemindent \parindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l_@@_narrow_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_narrow_aboveskip_tl \parskip } } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \item \relax } @@ -4038,8 +4113,11 @@ \cs_new_protected:Nn \@@_narrow_end: { \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > \l_@@_narrow_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_narrow_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -4153,9 +4231,25 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_poetry_chap:n} +% \begin{macro}{\@@_poetry_ch:n} % Position a chapter in a \env{poetry} environment. % \begin{macrocode} +\cs_new_protected:Nn \@@_poetry_ch:n + { + \bool_if:NTF \l_@@_chap_show_bool + { + \bool_if:NTF \l_@@_chap_drop_bool + { \@@_poetry_chap:n { #1 } } + { \@@_poetry_nodrop_chap:n { #1 } } + } + { \@@_poetry_nodrop_chap:n { #1 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_poetry_chap:n} +% Position a drop chapter in a \env{poetry} environment. +% \begin{macrocode} \cs_new_protected:Nn \@@_poetry_chap:n { \@@_drop_chap_set_up:n { #1 } @@ -4437,62 +4531,35 @@ } \bool_set_true:N \l_@@_active_inner_bool \tl_set:Nn \l_@@_currenvir_str { poetry } - \mode_if_horizontal:T - { \par } + \bool_gset_false:N \g_@@_poetry_midparachap_show_verse_bool + \DeclareDocumentCommand { \ch } { sm } { \@@_poetry_ch:n { ##2 } } + \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 } } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_poetry_belowskip_tl - \bool_if:NTF \g_@@_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_poetry_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_poetry_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_poetry_aboveskip_tl - } - \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_@@_poetry_leftmargin_tl \dim_set_eq:NN \rightmargin \l_@@_poetry_rightmargin_tl - \dim_set_eq:NN \itemindent \l_@@_poetry_indent_tl + \dim_set:Nn \itemindent { \l_@@_poetry_indent_tl - \l_@@_outer_itemindent_dim } \dim_set_eq:NN \listparindent \l_@@_poetry_indent_tl \skip_zero:N \parsep \skip_zero:N \partopsep - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > { \l_@@_poetry_aboveskip_tl } + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_poetry_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \l_@@_poetry_indent_tl } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \raggedright - \dim_set_eq:NN \listparindent \l_@@_poetry_indent_tl \dim_set_eq:NN \parindent \l_@@_poetry_indent_tl - \bool_gset_false:N \g_@@_poetry_midparachap_show_verse_bool - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l_@@_chap_show_bool - { - \bool_if:NTF \l_@@_chap_drop_bool - { \@@_poetry_chap:n { ##2 } } - { \@@_poetry_nodrop_chap:n { ##2 } } - } - { \@@_poetry_nodrop_chap:n { ##2 } } - } - \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 } - } \item \relax \cs_set_eq:NN \@@_tmp_para_end: \par @@ -4509,8 +4576,11 @@ \cs_new_protected:Nn \@@_poetry_end: { \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > { \l_@@_poetry_belowskip_tl } + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_poetry_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist \bool_gset_true:N \g_@@_poetry_end_bool \hook_gput_next_code:nn { para / begin } @@ -4544,6 +4614,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\scripturestyle} +% \begin{arguments} +% \item \meta{|name|} of the style. +% \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. +% \begin{macrocode} +\NewDocumentCommand { \scripturestyle } { s m m } + { + \@@_setup_style:nnn { #1 } { #2 } { #3 } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\textscripture} % \begin{arguments} % \item \meta{|reference|} of quotation. @@ -4553,7 +4639,7 @@ % Set an inline quotation. This is equivalent to calling the % \env{scripture} environment with the \opt{inline} option set. % \begin{macrocode} -\NewDocumentCommand { \textscripture } { oo+m } +\NewDocumentCommand { \textscripture } { o o +m } { \tl_if_novalue:nTF { #2 } { @@ -4575,7 +4661,7 @@ % \end{arguments} % Format a scripture quotation with optional reference. % \begin{macrocode} -\NewDocumentEnvironment { scripture } { oo } +\NewDocumentEnvironment { scripture } { o o } { \@@_begin:n { #2 } % \end{macrocode} @@ -4676,6 +4762,11 @@ \tl_set:Nn \l_@@_belowskip_tl { 0pt } \tl_set:Nn \l_@@_leftmargin_tl { 0pt } \tl_set:Nn \l_@@_rightmargin_tl { 0pt } + \cs_set_eq:NN \@@_ref_format:n \@@_inline_ref_format:n + \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_true:N \l_@@_compact_bool } \bool_if:NT \l_@@_compact_bool { @@ -4707,11 +4798,7 @@ } \mode_leave_vertical: } - \peek_remove_spaces:n - { - \peek_meaning:NF \begin - { \bool_gset_false:N \g_@@_start_bool } - } + \ignorespaces } { \bool_if:NT \l_@@_compact_bool diff --git a/Master/texmf-dist/tex/latex/scripture/scripture.sty b/Master/texmf-dist/tex/latex/scripture/scripture.sty index 3d03ee0825a..5cdbca4dce9 100644 --- a/Master/texmf-dist/tex/latex/scripture/scripture.sty +++ b/Master/texmf-dist/tex/latex/scripture/scripture.sty @@ -24,8 +24,8 @@ %% This work consists of the files scripture.ins, scripture.dtx, README.md, %% and the derived files scripture.sty and scripture.pdf %% -\NeedsTeXFormat{LaTeX2e}[2022-06-01] -\ProvidesExplPackage{scripture}{2023/01/08}{1.3} +\NeedsTeXFormat{LaTeX2e}[2022-11-01] +\ProvidesExplPackage{scripture}{2023/12/27}{2.0} {Format Scripture Quotations (DCP)} \msg_new:nnnn { scripture } { nested-environment } { Nesting~of~scripture~environments~not~supported. } @@ -39,275 +39,332 @@ { 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 } { unknown-style } + { Style~#1~not~defined. } + { You~have~requested~style=#1,~but~it~has~not~been~defined.~ + You~can~define~it~using~\token_to_str:N \scripturestyle.~ + Ignoring~option~style=#1. } \keys_define:nn { scripture } { - , aboveskip .tl_set:N = \l__scripture_aboveskip_tl - , aboveskip .value_required:n = true - , aboveskip .initial:n = \c_zero_skip - , added / font .tl_set:N = \l__scripture_added_font_tl - , added / font .value_required:n = true - , added / font .initial:n = - , added / format .cs_set:Np = \__scripture_added_format:n #1 - , added / format .value_required:n = true - , added / format .initial:n = \emph { #1 } - , belowskip .tl_set:N = \l__scripture_belowskip_tl - , belowskip .value_required:n = true - , belowskip .initial:n = \c_zero_skip - , colour .tl_set:N = \l__scripture_colour_tl - , colour .value_required:n = true - , colour .initial:n = . - , color .meta:n = { colour = { #1 } } - , compact .bool_set:N = \l__scripture_compact_bool - , compact .default:n = true - , compact .initial:n = false - , chapter / font .tl_set:N = \l__scripture_chap_font_tl - , chapter / font .value_required:n = true - , chapter / font .initial:n = \bfseries - , chapter / colour .tl_set:N = \l__scripture_chapter_colour_tl - , chapter / colour .value_required:n = true - , chapter / colour .initial:n = . - , chapter / color .meta:n = { chapter / colour = { #1 } } - , chapter / drop .bool_set:N = \l__scripture_chap_drop_bool - , chapter / drop .default:n = true - , chapter / drop .initial:n = true - , chapter / format .cs_set:Np = \__scripture_chap_format:n #1 - , chapter / format .value_required:n = true - , chapter / format .initial:n = #1 - , chapter / hide .bool_set_inverse:N = \l__scripture_chap_show_bool - , chapter / hide .default:n = true - , chapter / nodrop .bool_set_inverse:N = \l__scripture_chap_drop_bool - , chapter / nodrop .default: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 / show .bool_set:N = \l__scripture_chap_show_bool - , chapter / show .default:n = true - , chapter / show .initial:n = true - , chapter / showverse .bool_set:N = \l__scripture_chap_show_verse_bool - , chapter / showverse .default:n = true - , chapter / showverse .initial:n = false - , extraskip .tl_set:N = \l__scripture_extraskip_tl - , extraskip .value_required:n = true - , extraskip .initial:n = \medskipamount - , font .tl_set:N = \l__scripture_font_tl - , font .value_required:n = true - , font .initial:n = - , indent .bool_set:N = \l__scripture_indent_bool - , indent .default:n = true - , indent .initial:n = true - , _inline .bool_set:N = \l__scripture_inline_bool - , _inline .initial:n = false - , inline .meta:n = { - _inline = true , - compact , - reference / format = (##1) , - reference / align = inline , - reference / sep = 0.5 em, - version / format = ##1 - } - , inline .value_forbidden:n = true - , inline / begin .tl_set:N = \l__scripture_inline_begin_tl - , inline / begin .value_required:n = true - , inline / begin .initial:n = ``\, - , inline / end .tl_set:N = \l__scripture_inline_end_tl - , inline / end .value_required:n = true - , inline / end .initial:n = \,'' - , language .tl_set:N = \l__scripture_language_tl - , language .value_required:n = true - , language .initial:n = - , language / variant .tl_set:N = \l__scripture_language_variant_tl - , language / variant .value_required:n = true - , language / variant .initial:n = - , leftmargin .tl_set:N = \l__scripture_leftmargin_tl - , leftmargin .value_required:n = true - , leftmargin .initial:n = \c_zero_dim - , name / font .tl_set:N = \l__scripture_name_font_tl - , name / font .value_required:n = true - , name / font .initial:n = \scshape - , name / format .cs_set:Np = \__scripture_name_format:n #1 - , name / format .value_required:n = true - , name / format .initial:n = #1 - , noindent .bool_set_inverse:N = \l__scripture_indent_bool - , noindent .default:n = true - , parindent .tl_set:N = \l__scripture_parindent_tl - , parindent .value_required:n = true - , parindent .initial:n = \parindent - , parskip .tl_set:N = \l__scripture_parskip_tl - , parskip .value_required:n = true - , parskip .initial:n = \parskip - , redletter .bool_set:N = \l__scripture_red_letter_bool - , redletter .default:n = true - , redletter .initial:n = false - , redletter / colour .tl_set:N = \l__scripture_red_letter_colour_tl - , redletter / colour .value_required:n = true - , redletter / colour .initial:n = red!80!black - , redletter / color .meta:n = { redletter / colour = { #1 } } - , reference / align .choices:nn = { inline, left, right } - { - \tl_if_exist:NF \l__scripture_ref_align_tl - { \tl_new:N \l__scripture_ref_align_tl } - \tl_set_eq:NN \l__scripture_ref_align_tl \l_keys_choice_tl - } - , reference / align .value_required:n = true - , reference / align .initial:n = right - , reference / colour .tl_set:N = \l__scripture_ref_colour_tl - , reference / colour .value_required:n = true - , reference / colour .initial:n = . - , reference / color .meta:n = { reference / colour = { #1 } } - , reference / font .tl_set:N = \l__scripture_ref_font_tl - , reference / font .value_required:n = true - , reference / font .initial:n = \bfseries - , reference / format .cs_set:Np = \__scripture_ref_format:n #1 - , reference / format .value_required:n = true - , reference / format .initial:n = #1 - , reference / newline .meta:n = { reference / sep = \linewidth } - , reference / newline .value_forbidden:n = true - , reference / sep .tl_set:N = \l__scripture_ref_sep_tl - , reference / sep .value_required:n = true - , reference / sep .initial:n = 2 em - , rightmargin .tl_set:N = \l__scripture_rightmargin_tl - , rightmargin .value_required:n = true - , rightmargin .initial:n = \c_zero_dim - , selah / text .tl_set:N = \l__scripture_selah_text_tl - , selah / text .value_required:n = true - , selah / text .initial:n = Selah - , selah / font .tl_set:N = \l__scripture_selah_font_tl - , selah / font .value_required:n = true - , selah / font .initial:n = \itshape - , selah / format .cs_set:Np = \__scripture_selah_format:n #1 - , selah / format .value_required:n = true - , 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 - , textright / sep .tl_set:N = \l__scripture_text_right_sep_tl - , textright / sep .value_required:n = true - , textright / sep .initial:n = 1 em - , verse / colour .tl_set:N = \l__scripture_verse_colour_tl - , verse / colour .value_required:n = true - , verse / colour .initial:n = . - , verse / color .meta:n = { verse / colour = { #1 } } - , verse / first .bool_set:N = \l__scripture_verse_first_bool - , verse / first .default:n = true - , verse / first .initial:n = false - , verse / firstformat .cs_set:Np = \__scripture_verse_first_format:n #1 - , verse / firstformat .value_required:n = true - , verse / firstformat .initial:n = #1 - , verse / firstsep .tl_set:N = \l__scripture_verse_first_sep_tl - , verse / firstsep .value_required:n = true - , verse / firstsep .initial:n = 0.5em - , verse / font .tl_set:N = \l__scripture_verse_font_tl - , verse / font .value_required:n = true - , verse / font .initial:n = - , verse / format .cs_set:Np = \__scripture_verse_format:n #1 - , verse / format .value_required:n = true - , verse / format .initial:n = \textsuperscript{#1} - , verse / hide .bool_set_inverse:N = \l__scripture_verse_show_bool - , verse / hide .default:n = true - , verse / sep .tl_set:N = \l__scripture_verse_sep_tl - , verse / sep .value_required:n = true - , verse / sep .initial:n = 0.05 em - , verse / show .bool_set:N = \l__scripture_verse_show_bool - , verse / show .default:n = true - , verse / show .initial:n = true - , version .tl_set:N = \l__scripture_version_tl - , version .value_required:n = true - , version .initial:n = - , version / delim .tl_set:N = \l__scripture_version_delim_tl - , version / delim .value_required:n = true - , version / delim .initial:n = \c_space_tl - , version / format .cs_set:Np = \__scripture_version_format:n #1 - , version / format .value_required:n = true - , version / format .initial:n = (#1) - , center / aboveskip .tl_set:N = \l__scripture_center_aboveskip_tl - , center / aboveskip .value_required:n = true - , center / aboveskip .initial:n = \medskipamount - , center / belowskip .tl_set:N = \l__scripture_center_belowskip_tl - , center / belowskip .value_required:n = true - , center / belowskip .initial:n = \medskipamount - , center / leftmargin .tl_set:N = \l__scripture_center_leftmargin_tl - , center / leftmargin .value_required:n = true - , center / leftmargin .initial:n = \c_zero_dim - , center / rightmargin .tl_set:N = \l__scripture_center_rightmargin_tl - , center / rightmargin .value_required:n = true - , center / rightmargin .initial:n = \c_zero_dim - , flushright / aboveskip .tl_set:N = \l__scripture_flushright_aboveskip_tl - , flushright / aboveskip .value_required:n = true - , flushright / aboveskip .initial:n = \medskipamount - , flushright / belowskip .tl_set:N = \l__scripture_flushright_belowskip_tl - , flushright / belowskip .value_required:n = true - , flushright / belowskip .initial:n = \medskipamount - , flushright / leftmargin .tl_set:N = \l__scripture_flushright_leftmargin_tl - , flushright / leftmargin .value_required:n = true - , flushright / leftmargin .initial:n = \c_zero_dim - , flushright / rightmargin .tl_set:N = \l__scripture_flushright_rightmargin_tl - , flushright / rightmargin .value_required:n = true - , flushright / rightmargin .initial:n = \c_zero_dim - , hanging / aboveskip .tl_set:N = \l__scripture_hanging_aboveskip_tl - , hanging / aboveskip .value_required:n = true - , hanging / aboveskip .initial:n = \medskipamount - , hanging / belowskip .tl_set:N = \l__scripture_hanging_belowskip_tl - , hanging / belowskip .value_required:n = true - , hanging / belowskip .initial:n = \medskipamount - , hanging / hang .tl_set:N = \l__scripture_hanging_hang_tl - , hanging / hang .value_required:n = true - , hanging / hang .initial:n = 2 em - , hanging / leftmargin .tl_set:N = \l__scripture_hanging_leftmargin_tl - , hanging / leftmargin .value_required:n = true - , hanging / leftmargin .initial:n = 1 em - , hanging / rightmargin .tl_set:N = \l__scripture_hanging_rightmargin_tl - , hanging / rightmargin .value_required:n = true - , hanging / rightmargin .initial:n = \c_zero_dim - , 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 - , midparachap / showverse .default:n = true - , midparachap / showverse .initial:n = true - , narrow / aboveskip .tl_set:N = \l__scripture_narrow_aboveskip_tl - , narrow / aboveskip .value_required:n = true - , narrow / aboveskip .initial:n = \medskipamount - , narrow / belowskip .tl_set:N = \l__scripture_narrow_belowskip_tl - , narrow / belowskip .value_required:n = true - , 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 / rightmargin .tl_set:N = \l__scripture_narrow_rightmargin_tl - , narrow / rightmargin .value_required:n = true - , narrow / rightmargin .initial:n = 1 em - , poetry / aboveskip .tl_set:N = \l__scripture_poetry_aboveskip_tl - , poetry / aboveskip .value_required:n = true - , poetry / aboveskip .initial:n = \medskipamount - , poetry / belowskip .tl_set:N = \l__scripture_poetry_belowskip_tl - , poetry / belowskip .value_required:n = true - , 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 / indent .tl_set:N = \l__scripture_poetry_indent_tl - , poetry / indent .value_required:n = true - , poetry / indent .initial:n = 1 em - , poetry / leftmargin .tl_set:N = \l__scripture_poetry_leftmargin_tl - , poetry / leftmargin .value_required:n = true - , poetry / leftmargin .initial:n = 1 em - , poetry / rightmargin .tl_set:N = \l__scripture_poetry_rightmargin_tl - , poetry / rightmargin .value_required:n = true - , poetry / rightmargin .initial:n = \c_zero_dim - , poetry / verse / left .bool_set_inverse:N = \l__scripture_poetry_verse_right_bool - , poetry / verse / left .default:n = true - , poetry / verse / right .bool_set:N = \l__scripture_poetry_verse_right_bool - , poetry / verse / right .default:n = true - , 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 + , aboveskip .tl_set:N = \l__scripture_aboveskip_tl + , aboveskip .value_required:n = true + , aboveskip .initial:n = \c_zero_skip + , added / font .tl_set:N = \l__scripture_added_font_tl + , added / font .value_required:n = true + , added / font .initial:n = + , added / format .cs_set:Np = \__scripture_added_format:n #1 + , added / format .value_required:n = true + , added / format .initial:n = \emph { #1 } + , belowskip .tl_set:N = \l__scripture_belowskip_tl + , belowskip .value_required:n = true + , belowskip .initial:n = \c_zero_skip + , colour .tl_set:N = \l__scripture_colour_tl + , colour .value_required:n = true + , colour .initial:n = . + , color .meta:n = { colour = { #1 } } + , compact .bool_set:N = \l__scripture_compact_bool + , compact .default:n = true + , compact .initial:n = false + , chapter / font .tl_set:N = \l__scripture_chap_font_tl + , chapter / font .value_required:n = true + , chapter / font .initial:n = \bfseries + , chapter / colour .tl_set:N = \l__scripture_chapter_colour_tl + , chapter / colour .value_required:n = true + , chapter / colour .initial:n = . + , chapter / color .meta:n = { chapter / colour = { #1 } } + , chapter / drop .bool_set:N = \l__scripture_chap_drop_bool + , chapter / drop .default:n = true + , chapter / drop .initial:n = true + , chapter / format .cs_set:Np = \__scripture_chap_format:n #1 + , chapter / format .value_required:n = true + , chapter / format .initial:n = #1 + , chapter / hide .bool_set_inverse:N = \l__scripture_chap_show_bool + , chapter / hide .default:n = true + , chapter / nodrop .bool_set_inverse:N = \l__scripture_chap_drop_bool + , chapter / nodrop .default: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 / show .bool_set:N = \l__scripture_chap_show_bool + , chapter / show .default:n = true + , chapter / show .initial:n = true + , chapter / showverse .bool_set:N = \l__scripture_chap_show_verse_bool + , chapter / showverse .default:n = true + , chapter / showverse .initial:n = false + , extraskip .tl_set:N = \l__scripture_extraskip_tl + , extraskip .value_required:n = true + , extraskip .initial:n = \medskipamount + , font .tl_set:N = \l__scripture_font_tl + , font .value_required:n = true + , font .initial:n = + , indent .bool_set:N = \l__scripture_indent_bool + , indent .default:n = true + , indent .initial:n = true + , inline .bool_set:N = \l__scripture_inline_bool + , inline .default:n = true + , 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 / end .tl_set:N = \l__scripture_inline_end_tl + , inline / end .value_required:n = true + , 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 / 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 + , inline / version / format .cs_set:Np = \__scripture_inline_version_format:n #1 + , inline / version / format .value_required:n = true + , inline / version / format .initial:n = #1 + , language .tl_set:N = \l__scripture_language_tl + , language .value_required:n = true + , language .initial:n = + , language / variant .tl_set:N = \l__scripture_language_variant_tl + , language / variant .value_required:n = true + , language / variant .initial:n = + , leftmargin .tl_set:N = \l__scripture_leftmargin_tl + , leftmargin .value_required:n = true + , leftmargin .initial:n = \c_zero_dim + , name / font .tl_set:N = \l__scripture_name_font_tl + , name / font .value_required:n = true + , name / font .initial:n = \scshape + , name / format .cs_set:Np = \__scripture_name_format:n #1 + , name / format .value_required:n = true + , name / format .initial:n = #1 + , noindent .bool_set_inverse:N = \l__scripture_indent_bool + , noindent .default:n = true + , parindent .tl_set:N = \l__scripture_parindent_tl + , parindent .value_required:n = true + , parindent .initial:n = \parindent + , parskip .tl_set:N = \l__scripture_parskip_tl + , parskip .value_required:n = true + , parskip .initial:n = \parskip + , redletter .bool_set:N = \l__scripture_red_letter_bool + , redletter .default:n = true + , redletter .initial:n = false + , redletter / colour .tl_set:N = \l__scripture_red_letter_colour_tl + , redletter / colour .value_required:n = true + , redletter / colour .initial:n = red!80!black + , redletter / color .meta:n = { redletter / colour = { #1 } } + , reference / align .choices:nn = { left, right } + { + \tl_if_exist:NF \l__scripture_ref_align_tl + { \tl_new:N \l__scripture_ref_align_tl } + \tl_set_eq:NN \l__scripture_ref_align_tl \l_keys_choice_tl + } + , reference / align .value_required:n = true + , reference / align .initial:n = right + , reference / colour .tl_set:N = \l__scripture_ref_colour_tl + , reference / colour .value_required:n = true + , reference / colour .initial:n = . + , reference / color .meta:n = { reference / colour = { #1 } } + , reference / font .tl_set:N = \l__scripture_ref_font_tl + , reference / font .value_required:n = true + , reference / font .initial:n = \bfseries + , reference / format .cs_set:Np = \__scripture_ref_format:n #1 + , reference / format .value_required:n = true + , reference / format .initial:n = #1 + , reference / newline .meta:n = { reference / sep = \linewidth } + , reference / newline .value_forbidden:n = true + , reference / sep .tl_set:N = \l__scripture_ref_sep_tl + , reference / sep .value_required:n = true + , reference / sep .initial:n = 2 em + , rightmargin .tl_set:N = \l__scripture_rightmargin_tl + , rightmargin .value_required:n = true + , rightmargin .initial:n = \c_zero_dim + , selah / text .tl_set:N = \l__scripture_selah_text_tl + , selah / text .value_required:n = true + , selah / text .initial:n = Selah + , selah / font .tl_set:N = \l__scripture_selah_font_tl + , selah / font .value_required:n = true + , selah / font .initial:n = \itshape + , selah / format .cs_set:Np = \__scripture_selah_format:n #1 + , selah / format .value_required:n = true + , 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 + , style .choice: + , style / unknown .code:n = \msg_error:nnx + { scripture } + { unknown-style } + { \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 + , verse / colour .tl_set:N = \l__scripture_verse_colour_tl + , verse / colour .value_required:n = true + , verse / colour .initial:n = . + , verse / color .meta:n = { verse / colour = { #1 } } + , verse / first .bool_set:N = \l__scripture_verse_first_bool + , verse / first .default:n = true + , verse / first .initial:n = false + , verse / firstformat .cs_set:Np = \__scripture_verse_first_format:n #1 + , verse / firstformat .value_required:n = true + , verse / firstformat .initial:n = #1 + , verse / firstsep .tl_set:N = \l__scripture_verse_first_sep_tl + , verse / firstsep .value_required:n = true + , verse / firstsep .initial:n = 0.5em + , verse / font .tl_set:N = \l__scripture_verse_font_tl + , verse / font .value_required:n = true + , verse / font .initial:n = + , verse / format .cs_set:Np = \__scripture_verse_format:n #1 + , verse / format .value_required:n = true + , verse / format .initial:n = \textsuperscript{#1} + , verse / hide .bool_set_inverse:N = \l__scripture_verse_show_bool + , verse / hide .default:n = true + , verse / sep .tl_set:N = \l__scripture_verse_sep_tl + , verse / sep .value_required:n = true + , verse / sep .initial:n = 0.05 em + , verse / show .bool_set:N = \l__scripture_verse_show_bool + , verse / show .default:n = true + , verse / show .initial:n = true + , version .tl_set:N = \l__scripture_version_tl + , version .value_required:n = true + , version .initial:n = + , version / delim .tl_set:N = \l__scripture_version_delim_tl + , version / delim .value_required:n = true + , version / delim .initial:n = \c_space_tl + , version / format .cs_set:Np = \__scripture_version_format:n #1 + , version / format .value_required:n = true + , version / format .initial:n = (#1) + , center / aboveskip .tl_set:N = \l__scripture_center_aboveskip_tl + , center / aboveskip .value_required:n = true + , center / aboveskip .initial:n = \medskipamount + , center / belowskip .tl_set:N = \l__scripture_center_belowskip_tl + , center / belowskip .value_required:n = true + , center / belowskip .initial:n = \medskipamount + , center / leftmargin .tl_set:N = \l__scripture_center_leftmargin_tl + , center / leftmargin .value_required:n = true + , center / leftmargin .initial:n = \c_zero_dim + , center / rightmargin .tl_set:N = \l__scripture_center_rightmargin_tl + , center / rightmargin .value_required:n = true + , center / rightmargin .initial:n = \c_zero_dim + , flushright / aboveskip .tl_set:N = \l__scripture_flushright_aboveskip_tl + , flushright / aboveskip .value_required:n = true + , flushright / aboveskip .initial:n = \medskipamount + , flushright / belowskip .tl_set:N = \l__scripture_flushright_belowskip_tl + , flushright / belowskip .value_required:n = true + , flushright / belowskip .initial:n = \medskipamount + , flushright / leftmargin .tl_set:N = \l__scripture_flushright_leftmargin_tl + , flushright / leftmargin .value_required:n = true + , flushright / leftmargin .initial:n = \c_zero_dim + , flushright / rightmargin .tl_set:N = \l__scripture_flushright_rightmargin_tl + , flushright / rightmargin .value_required:n = true + , flushright / rightmargin .initial:n = \c_zero_dim + , hanging / aboveskip .tl_set:N = \l__scripture_hanging_aboveskip_tl + , hanging / aboveskip .value_required:n = true + , hanging / aboveskip .initial:n = \medskipamount + , hanging / belowskip .tl_set:N = \l__scripture_hanging_belowskip_tl + , hanging / belowskip .value_required:n = true + , hanging / belowskip .initial:n = \medskipamount + , hanging / hang .tl_set:N = \l__scripture_hanging_hang_tl + , hanging / hang .value_required:n = true + , hanging / hang .initial:n = 2 em + , hanging / leftmargin .tl_set:N = \l__scripture_hanging_leftmargin_tl + , hanging / leftmargin .value_required:n = true + , hanging / leftmargin .initial:n = 1 em + , hanging / rightmargin .tl_set:N = \l__scripture_hanging_rightmargin_tl + , hanging / rightmargin .value_required:n = true + , hanging / rightmargin .initial:n = \c_zero_dim + , 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 + , midparachap / showverse .default:n = true + , midparachap / showverse .initial:n = true + , narrow / aboveskip .tl_set:N = \l__scripture_narrow_aboveskip_tl + , narrow / aboveskip .value_required:n = true + , narrow / aboveskip .initial:n = \medskipamount + , narrow / belowskip .tl_set:N = \l__scripture_narrow_belowskip_tl + , narrow / belowskip .value_required:n = true + , 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 / rightmargin .tl_set:N = \l__scripture_narrow_rightmargin_tl + , narrow / rightmargin .value_required:n = true + , narrow / rightmargin .initial:n = 1 em + , poetry / aboveskip .tl_set:N = \l__scripture_poetry_aboveskip_tl + , poetry / aboveskip .value_required:n = true + , poetry / aboveskip .initial:n = \medskipamount + , poetry / belowskip .tl_set:N = \l__scripture_poetry_belowskip_tl + , poetry / belowskip .value_required:n = true + , 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 / indent .tl_set:N = \l__scripture_poetry_indent_tl + , poetry / indent .value_required:n = true + , poetry / indent .initial:n = 1 em + , poetry / leftmargin .tl_set:N = \l__scripture_poetry_leftmargin_tl + , poetry / leftmargin .value_required:n = true + , poetry / leftmargin .initial:n = 1 em + , poetry / rightmargin .tl_set:N = \l__scripture_poetry_rightmargin_tl + , poetry / rightmargin .value_required:n = true + , poetry / rightmargin .initial:n = \c_zero_dim + , poetry / verse / left .bool_set_inverse:N = \l__scripture_poetry_verse_right_bool + , poetry / verse / left .default:n = true + , poetry / verse / right .bool_set:N = \l__scripture_poetry_verse_right_bool + , poetry / verse / right .default:n = true + , 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 } \ProcessKeyOptions +\cs_new_protected:Nn \__scripture_setup_style:nnn + { + \bool_if:NTF #1 + { + \tl_if_exist:cF { g__scripture_style_ #2 _tl } + { \tl_new:c { g__scripture_style_ #2 _tl } } + \__scripture_setup_style:nne \c_false_bool { #2 } + { \tl_use:c { g__scripture_style_ #2 _tl } , #3 } + } + { + \tl_gset:cn { g__scripture_style_ #2 _tl } { #3 } + \keys_define:nn { scripture } + { style / #2 .meta:n = { #3 } } + } + } +\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 } \bool_new:N \l__scripture_active_bool \bool_new:N \l__scripture_active_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} + { + \cs_set_protected_nopar:Npn \noindent + { + \skip_horizontal:n { -#1 } + } + \hook_gput_next_code:nn { para / end } + { + \cs_gset_eq:NN \noindent \tex_noindent:D + } + } + } +\cs_new_protected:Nn \__scripture_skip_diff:NN + { + \skip_eval:n + { + \dim_eval:n { \dimexpr #1 - \dimexpr #2 } + ~ plus ~ + \dim_max:nn { \gluestretch #1 - \gluestretch #2 } \c_zero_dim + ~ minus ~ + \dim_max:nn { \glueshrink #1 - \glueshrink #2 } \c_zero_dim + } + } \cs_new_protected:Nn \__scripture_extra_skip: { \int_compare:nNnT @@ -363,7 +420,8 @@ #1 \tl_if_empty:NF \l__scripture_version_tl { - \l__scripture_version_delim_tl + \tl_if_empty:nF { #1 } + { \l__scripture_version_delim_tl } \__scripture_version_format:n { \l__scripture_version_tl } } } @@ -375,20 +433,21 @@ { \__scripture_format_full_ref:n { #1 } } - \bool_if:NT \g__scripture_poetry_end_bool - { \skip_vertical:n { -\parskip } } \dim_compare:nNnT { \box_wd:N \l__scripture_ref_box + \g__scripture_final_line_dim + \l__scripture_ref_sep_tl } > \linewidth - { \skip_vertical:N \baselineskip } - \int_compare:nNnT \prevgraf = \c_zero_int - { \skip_vertical:n { -\baselineskip } } - \tl_if_eq:NnT \l__scripture_ref_align_tl { right } + { + \skip_vertical:N \baselineskip + \tl_if_eq:NnT \l__scripture_ref_align_tl { left } + { + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \skip_vertical:N \baselineskip } + } + } + \tl_if_eq:NnTF \l__scripture_ref_align_tl { right } { \hfill } - \tl_if_eq:NnT \l__scripture_ref_align_tl { left } { - \mode_leave_vertical: \dim_compare:nNnT { \box_wd:N \l__scripture_ref_box + \g__scripture_final_line_dim + \l__scripture_ref_sep_tl } < @@ -461,7 +520,7 @@ { \msg_warning:nnx { scripture } - { language-waning } + { language-warning } { \l__scripture_language_tl } } } @@ -508,8 +567,7 @@ \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 + \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 } @@ -535,9 +593,7 @@ \hook_use:n { scripture / chap / after } \group_end: \bool_if:NT \l__scripture_chap_show_verse_bool - { - \__scripture_verse_output:n { 1 } - } + { \__scripture_verse_output:n { 1 } } } \cs_new_protected:Nn \__scripture_nodrop_chap:n { @@ -592,13 +648,13 @@ } \hook_gput_next_code:nn { para / before } { - \int_compare:nNnT - \g__scripture_chap_par_prevgraf_int = 1 - { \extraskip } - \int_gzero:N \g__scripture_chap_par_prevgraf_int - \int_compare:nNnT - \@listdepth > \c_zero_int - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } + \legacy_if:nF { @newlist } + { + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \extraskip } + \int_gzero:N \g__scripture_chap_par_prevgraf_int + } + \parshape 1 ~ \@totalleftmargin ~ \linewidth } } \bool_new:N \l__scripture_verse_par_start_bool @@ -665,20 +721,58 @@ } $$ \__scripture_reset_spacing: - \dim_compare:nNnT \g__scripture_final_line_dim > \linewidth - { - \dim_gset_eq:NN \g__scripture_final_line_dim \linewidth - } + \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 } - { - \skip_vertical:n { -\baselineskip - \parskip } - } + { \skip_vertical:n { -\baselineskip - \parskip } } } \str_new:N \l__scripture_currenvir_str \skip_new:N \l__scripture_parskip_correction_skip -\bool_new:N \g__scripture_start_bool +\cs_new_protected_nopar:Nn \__scripture_added:n + { + \group_begin: + \l__scripture_added_font_tl + \__scripture_added_format:n { #1 } + \group_end: + } +\cs_new_protected_nopar:Nn \__scripture_name:n + { + \group_begin: + \l__scripture_name_font_tl + \__scripture_name_format:n { #1 } + \group_end: + } +\cs_new_protected_nopar:Nn \__scripture_no_first_verse: + { + \bool_set_true:N \l__scripture_no_verse_first_bool + } +\cs_new_protected:Nn \__scripture_ch_output:nn + { + \bool_if:NTF \l__scripture_chap_show_bool + { + \bool_if:NTF \l__scripture_chap_drop_bool + { + \__scripture_chap:n { #2 } + \bool_if:nTF { #1 } + { + \hook_gput_next_code:nn { para / after } + { + \int_gzero:N \g__scripture_chap_par_prevgraf_int + \int_gzero:N \g__scripture_mid_para_chap_prevgraf_int + } + } + { + \hook_gput_next_code:nn { para / after } + { \int_gset_eq:NN \g__scripture_mid_para_chap_prevgraf_int \prevgraf } + } + } + { \__scripture_nodrop_chap:n { #2 } } + } + { \__scripture_nodrop_chap:n { #2 } } + } \cs_new_protected:Nn \__scripture_begin:n { + \cs_set_eq:NN \__scripture_noindent_saved: \noindent \bool_if:NT \l__scripture_active_bool { \msg_error:nn { scripture } { nested-environment } @@ -690,191 +784,122 @@ \keys_set:nn { scripture } { #1 } } \__scripture_select_language: - \legacy_if:nT { @newlist } - { - \strut - \par - \vspace* { \dim_eval:n { -\baselineskip - \parskip } } - } - \mode_if_vertical:T - { - \addvspace { \l__scripture_aboveskip_tl } - } - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l__scripture_chap_show_bool - { - \bool_if:NTF \l__scripture_chap_drop_bool - { - \__scripture_chap:n { ##2 } - \bool_if:nT { ##1 } - { - \hook_gput_next_code:nn { para / after } - { \int_gzero:N \g__scripture_chap_par_prevgraf_int } - } - } - { \__scripture_nodrop_chap:n { ##2 } } - } - { \__scripture_nodrop_chap:n { ##2 } } - } + \int_gzero:N \g__scripture_chap_par_prevgraf_int \everydisplay { } \int_set:Nn \predisplaypenalty { 10000 } \int_set_eq:NN \postdisplaypenalty \@lowpenalty - \bool_gset_true:N \g__scripture_start_bool + \int_set:Nn \@beginparpenalty { -\@lowpenalty } + \int_set_eq:NN \@endparpenalty \@lowpenalty \bool_gset_false:N \g__scripture_poetry_end_bool - \dim_set_eq:NN \parindent \l__scripture_parindent_tl \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_eq:NN \vs \__scripture_verse_output:n - \cs_set_protected_nopar:Npn \added ##1 - { - \group_begin: - \l__scripture_added_font_tl - \__scripture_added_format:n { ##1 } - \group_end: - } - \cs_set_protected_nopar:Npn \name ##1 - { - \group_begin: - \l__scripture_name_font_tl - \__scripture_name_format:n { ##1 } - \group_end: - } - \cs_set_protected_nopar:Npn \nofirstverse - { - \bool_set_true:N \l__scripture_no_verse_first_bool - } - \cs_set_protected_nopar:Npn \LORD - { - \name { Lord } - } - \cs_set_protected_nopar:Npn \GOD - { - \name { God } - } + \cs_set_eq:NN \added \__scripture_added: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 } } + \cs_set_eq:NN \nofirstverse \__scripture_no_first_verse: \cs_set_protected_nopar:Npn \textright ##1 - { - \__scripture_text_right:nn { \l__scripture_text_right_sep_tl } { ##1 } - } + { \__scripture_text_right:nn { \l__scripture_text_right_sep_tl } { ##1 } } \hook_gclear_next_code:n { para / before } - \skip_set:Nn \l__scripture_parskip_correction_skip { \parskip - \l__scripture_parskip_tl } - \mode_if_vertical:T - { - \addvspace { \l__scripture_parskip_correction_skip } - } - \skip_set_eq:NN \parskip \l__scripture_parskip_tl \l__scripture_font_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 } } + \bool_if:NTF \l__scripture_inline_bool + { \l__scripture_inline_begin_tl } { - \color_select:n { scripture default colour } - } - \bool_lazy_or:nnT - { \dim_compare_p:n { \l__scripture_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l__scripture_rightmargin_tl > 0pt } } - { - \dim_sub:Nn \linewidth - { \l__scripture_leftmargin_tl + \l__scripture_rightmargin_tl } - \int_compare:nNnTF - \@listdepth > \c_zero_int - { - \dim_add:Nn \@totalleftmargin \l__scripture_leftmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - { - \dim_add:Nn \leftskip \l__scripture_leftmargin_tl - \dim_add:Nn \rightskip \l__scripture_rightmargin_tl - } - } - \bool_if:NF \l__scripture_indent_bool - { - \hook_gput_next_code:nn { para / begin } + \legacy_if:nTF { @newlist } + { \dim_set_eq:NN \l__scripture_outer_itemindent_dim \itemindent } + { \dim_zero:N \l__scripture_outer_itemindent_dim } + \list { } { - \bool_lazy_any:nT + \dim_set_eq:NN \leftmargin \l__scripture_leftmargin_tl + \dim_set_eq:NN \rightmargin \l__scripture_rightmargin_tl + \dim_set:Nn \itemindent { \l__scripture_parindent_tl - \l__scripture_outer_itemindent_dim } + \dim_set_eq:NN \listparindent \l__scripture_parindent_tl + \skip_zero:N \partopsep + \skip_set_eq:NN \parsep \l__scripture_parskip_tl + \dim_compare:nNnTF \parskip > \l__scripture_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \__scripture_skip_diff:NN \l__scripture_aboveskip_tl \parskip } } + \__scripture_setup_list_noindent:n { \l__scripture_parindent_tl } + \bool_if:NF \l__scripture_indent_bool { - { \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 } } + \hook_gput_next_code:nn { para / begin } + { + \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 } + { \noindent } + { \para_omit_indent: } + } + } } - { \para_omit_indent: } } - } - \bool_if:NT \l__scripture_inline_bool - { \l__scripture_inline_begin_tl } + \dim_set_eq:NN \parindent \l__scripture_parindent_tl + \item + \relax + } } \cs_new_protected:Nn \__scripture_end:n { - \tl_if_eq:NnTF \l__scripture_ref_align_tl { inline } + \bool_if:NTF \l__scripture_inline_bool { - \bool_lazy_or:nnF + \unskip + \__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 } } { - \unskip - \__scripture_red_letter_off: - \bool_if:NT \l__scripture_inline_bool - { \l__scripture_inline_end_tl } + \tl_if_empty:NF \l__scripture_version_tl + { + \skip_horizontal:N \l__scripture_ref_sep_tl + \__scripture_format_full_ref:n { } + } + } + { \skip_horizontal:N \l__scripture_ref_sep_tl \__scripture_format_full_ref:n { #1 } } } { - \mode_if_vertical:TF - { - \unskip - \unskip - } - { - \tl_if_novalue:nTF { #1 } - { \int_zero:N \postdisplaypenalty } - { \int_set_eq:NN \postdisplaypenalty \@highpenalty } - \__scripture_calc_final_line_length: - } - \bool_lazy_or:nnTF - { \dim_compare_p:n { \l__scripture_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l__scripture_rightmargin_tl > 0pt } } - { - \dim_add:Nn \linewidth \l__scripture_leftmargin_tl - \int_compare:nNnT - \@listdepth > \c_zero_int - { - \dim_sub:Nn \@totalleftmargin \l__scripture_leftmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - } - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } - \__scripture_red_letter_off: - \bool_lazy_or:nnF - { \tl_if_novalue_p:n { #1 } } - { \tl_if_empty_p:n { #1 } } - { \__scripture_reference:n { #1 } } - \par - \bool_lazy_or:nnT - { \dim_compare_p:n { \l__scripture_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l__scripture_rightmargin_tl > 0pt } } - { - \int_compare:nNnT - \@listdepth > \c_zero_int - { - \dim_add:Nn \linewidth \l__scripture_rightmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - } - \dim_compare:nNnTF - { \glueexpr \l__scripture_belowskip_tl } > \parskip - { - \addvspace - { - \skip_eval:n { \l__scripture_belowskip_tl - \parskip } - } - } - { - \addvspace { \l__scripture_belowskip_tl } - } + \__scripture_red_letter_off: + \skip_zero:N \parskip + \int_set:Nn \postdisplaypenalty { 10000 } + \__scripture_calc_final_line_length: + \dim_gsub:Nn \g__scripture_final_line_dim \@totalleftmargin + \dim_compare:nNnTF \@outerparskip > \l__scripture_belowskip_tl + { \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 } } + \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_empty:NTF \l__scripture_version_tl + { \hbox:n { } } + { \__scripture_reference:n { } } + } + { \__scripture_reference:n { #1 } } + \@noparlistfalse + \endlist } + \cs_set_eq:NN \noindent \__scripture_noindent_saved: } -\skip_new:N \l__scripture_delta_below_skip \cs_new_protected:Nn \__scripture_center_begin:n { \bool_if:NT \l__scripture_active_inner_bool @@ -889,47 +914,38 @@ { scripture / center } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent } + { \dim_zero:N \l__scripture_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_center_belowskip_tl - \bool_if:NTF \g__scripture_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l__scripture_delta_below_skip \parskip - \bool_gset_false:N \g__scripture_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l__scripture_center_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l__scripture_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l__scripture_center_aboveskip_tl - \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_center_aboveskip_tl - } - \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_center_leftmargin_tl + \dim_set_eq:NN \rightmargin \l__scripture_center_rightmargin_tl + \dim_set:Nn \itemindent { -\l__scripture_outer_itemindent_dim } + \dim_zero:N \listparindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \leftmargin - \dim_zero:N \labelsep - } + \dim_compare:nNnTF \parskip > \l__scripture_center_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \__scripture_skip_diff:NN \l__scripture_center_aboveskip_tl \parskip } } + \__scripture_setup_list_noindent:n { \c_zero_dim } + } + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g__scripture_chap_par_prevgraf_int \centering \item \relax } \cs_new_protected:Nn \__scripture_center_end: { - \__scripture_calc_final_line_length: - \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_gset:Nn \g__scripture_final_line_dim { \@totalleftmargin + \linewidth } + \dim_compare:nNnTF \@outerparskip > \l__scripture_center_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \__scripture_skip_diff:NN \l__scripture_center_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } \cs_new_protected:Nn \__scripture_flushright_begin:n @@ -946,52 +962,51 @@ { scripture / flushright } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent } + { \dim_zero:N \l__scripture_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_flushright_belowskip_tl - \bool_if:NTF \g__scripture_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l__scripture_delta_below_skip \parskip - \bool_gset_false:N \g__scripture_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l__scripture_flushright_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l__scripture_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l__scripture_flushright_aboveskip_tl - \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_flushright_aboveskip_tl - } - \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_flushright_leftmargin_tl \dim_set_eq:NN \rightmargin \l__scripture_flushright_rightmargin_tl + \dim_set:Nn \itemindent { -\l__scripture_outer_itemindent_dim } + \dim_zero:N \listparindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \leftmargin - \dim_zero:N \labelsep - } + \dim_compare:nNnTF \parskip > \l__scripture_flushright_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \__scripture_skip_diff:NN \l__scripture_flushright_aboveskip_tl \parskip } } + \__scripture_setup_list_noindent:n { \c_zero_dim } + } + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g__scripture_chap_par_prevgraf_int \raggedleft \item \relax } \cs_new_protected:Nn \__scripture_flushright_end: { - \__scripture_calc_final_line_length: - \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_gset:Nn \g__scripture_final_line_dim { \@totalleftmargin + \linewidth } + \dim_compare:nNnTF \@outerparskip > \l__scripture_flushright_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \__scripture_skip_diff:NN \l__scripture_flushright_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } \dim_new:N \l__scripture_hanging_parindent_saved_dim +\cs_new_protected:Nn \__scripture_hanging_ch:n + { + \bool_if:NTF \l__scripture_chap_show_bool + { + \bool_if:NTF \l__scripture_chap_drop_bool + { \__scripture_hanging_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 } @@ -1027,17 +1042,15 @@ } ~ \@totalleftmargin ~ \linewidth } - \mode_if_vertical:T + \tl_set:Nx \l__scripture_chap_sep_tl { - \tl_set:Nx \l__scripture_chap_sep_tl + \dim_eval:n { - \dim_eval:n - { - \l__scripture_chap_sep_tl + \l__scripture_hanging_parindent_saved_dim - } + \l__scripture_chap_sep_tl + \l__scripture_hanging_parindent_saved_dim } - \__scripture_nohang: } + \par + \__scripture_nohang: \hbox_set:Nn \l__scripture_chap_box { \box_move_down:nn @@ -1078,7 +1091,7 @@ } \cs_new_protected_nopar:Nn \__scripture_nohang: { - \para_raw_noindent: + \noindent \hbox_to_wd:nn { \l__scripture_hanging_parindent_saved_dim } { } } \cs_new_protected:Nn \__scripture_hanging_begin:n @@ -1095,63 +1108,41 @@ { scripture / hanging } { #1 } } - \mode_if_horizontal:T - { \par } + \DeclareDocumentCommand { \ch } { sm } { \__scripture_hanging_ch:n { ##2 } } + \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 } \list { } { - \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_hanging_belowskip_tl - \bool_if:NTF \g__scripture_start_bool - { - \dim_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l__scripture_delta_below_skip \parskip - \bool_gset_false:N \g__scripture_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l__scripture_hanging_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l__scripture_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l__scripture_hanging_aboveskip_tl - \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_hanging_aboveskip_tl - } - \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g__scripture_chap_par_prevgraf_int - } - \dim_set:Nn \leftmargin - { \l__scripture_hanging_leftmargin_tl + \l__scripture_hanging_hang_tl } + \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 - \dim_set:Nn \itemindent { -\l__scripture_hanging_hang_tl } + \dim_set:Nn \itemindent { -\l__scripture_hanging_hang_tl - \l__scripture_outer_itemindent_dim } \dim_set:Nn \listparindent { -\l__scripture_hanging_hang_tl } \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \labelsep - \dim_set_eq:NN \l__scripture_hanging_parindent_saved_dim \parindent - } - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l__scripture_chap_show_bool - { - \bool_if:NTF \l__scripture_chap_drop_bool - { \__scripture_hanging_chap:n { ##2 } } - { \__scripture_nodrop_chap:n { ##2 } } - } - { \__scripture_nodrop_chap:n { ##2 } } - } - \cs_set_eq:NN \vs \__scripture_hanging_verse:n - \cs_set_eq:NN \nohang \__scripture_nohang: + \dim_compare:nNnTF \parskip > \l__scripture_hanging_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \__scripture_skip_diff:NN \l__scripture_hanging_aboveskip_tl \parskip } } + \__scripture_setup_list_noindent:n { -\l__scripture_hanging_hang_tl } + } + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g__scripture_chap_par_prevgraf_int \item \relax } \cs_new_protected:Nn \__scripture_hanging_end: { \__scripture_calc_final_line_length: - \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > \l__scripture_hanging_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \__scripture_skip_diff:NN \l__scripture_hanging_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } \cs_new_protected:Npn \__scripture_vbox_set_top:Nw #1 @@ -1163,6 +1154,7 @@ \bool_new:N \l__scripture_mid_para_chap_bool \box_new:N \l__scripture_mid_para_chap_line_box \dim_new:N \g__scripture_mid_para_chap_prevdepth_dim +\dim_new:N \l__scripture_mid_para_chap_totalleftmargin_dim \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 @@ -1233,12 +1225,16 @@ \par \bool_set_true:N \l__scripture_mid_para_chap_bool \__scripture_vbox_set_top:Nw \l__scripture_mid_para_chap_box + \dim_zero:N \leftskip + \dim_zero:N \rightskip + \dim_set_eq:NN \l__scripture_mid_para_chap_totalleftmargin_dim \@totalleftmargin + \dim_zero:N \@totalleftmargin + \dim_set_eq:NN \hsize \linewidth \skip_zero:N \parskip } \cs_new_protected:Nn \__scripture_mid_para_chap_end: { \par - \int_gset_eq:NN \g__scripture_mid_para_chap_prevgraf_int \prevgraf \dim_gset_eq:NN \g__scripture_mid_para_chap_prevdepth_dim \prevdepth \box_set_to_last:N \l__scripture_mid_para_chap_line_box \hbox_set:Nn \l__scripture_mid_para_chap_snap_box @@ -1248,7 +1244,8 @@ \unskip \unpenalty } - \dim_gset:Nn \g__scripture_final_line_dim { \box_wd:N \l__scripture_mid_para_chap_snap_box } + \dim_gset:Nn \g__scripture_final_line_dim + { \box_wd:N \l__scripture_mid_para_chap_snap_box + \l__scripture_mid_para_chap_totalleftmargin_dim } \box_clear:N \l__scripture_mid_para_chap_snap_box \nointerlineskip \int_compare:nNnT @@ -1297,9 +1294,7 @@ \hook_gput_next_code:nn { para / before } { \int_gzero:N \g__scripture_chap_par_prevgraf_int - \int_compare:nNnT - \@listdepth > \c_zero_int - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } + \parshape 1 ~ \@totalleftmargin ~ \linewidth } } \cs_new_protected:Nn \__scripture_narrow_begin:n @@ -1316,49 +1311,47 @@ { scripture / narrow } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent } + { \dim_zero:N \l__scripture_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_narrow_belowskip_tl - \bool_if:NTF \g__scripture_start_bool + %\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 { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l__scripture_delta_below_skip \parskip - \bool_gset_false:N \g__scripture_start_bool + \dim_set:Nn \itemindent { \parindent - \l__scripture_outer_itemindent_dim } + \__scripture_setup_list_noindent:n { \parindent } } { - \dim_compare:nTF - { \parskip >= \glueexpr \l__scripture_narrow_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l__scripture_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l__scripture_narrow_aboveskip_tl - \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_narrow_aboveskip_tl - } - \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g__scripture_chap_par_prevgraf_int + \dim_set:Nn \itemindent { -\l__scripture_outer_itemindent_dim } + \__scripture_setup_list_noindent:n { \c_zero_dim } } - \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 - \dim_set_eq:NN \itemindent \parindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l__scripture_narrow_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \__scripture_skip_diff:NN \l__scripture_narrow_aboveskip_tl \parskip } } } + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g__scripture_chap_par_prevgraf_int \item \relax } \cs_new_protected:Nn \__scripture_narrow_end: { \__scripture_calc_final_line_length: - \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > \l__scripture_narrow_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \__scripture_skip_diff:NN \l__scripture_narrow_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } \hook_new:n { scripture / poetry / para / after } @@ -1407,6 +1400,16 @@ { \__scripture_selah_format:n { \l__scripture_selah_text_tl } } \group_end: } +\cs_new_protected:Nn \__scripture_poetry_ch:n + { + \bool_if:NTF \l__scripture_chap_show_bool + { + \bool_if:NTF \l__scripture_chap_drop_bool + { \__scripture_poetry_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 } @@ -1640,62 +1643,35 @@ } \bool_set_true:N \l__scripture_active_inner_bool \tl_set:Nn \l__scripture_currenvir_str { poetry } - \mode_if_horizontal:T - { \par } + \bool_gset_false:N \g__scripture_poetry_midparachap_show_verse_bool + \DeclareDocumentCommand { \ch } { sm } { \__scripture_poetry_ch:n { ##2 } } + \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 } } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent } + { \dim_zero:N \l__scripture_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_poetry_belowskip_tl - \bool_if:NTF \g__scripture_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l__scripture_delta_below_skip \parskip - \bool_gset_false:N \g__scripture_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l__scripture_poetry_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l__scripture_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l__scripture_poetry_aboveskip_tl - \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_poetry_aboveskip_tl - } - \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_poetry_leftmargin_tl \dim_set_eq:NN \rightmargin \l__scripture_poetry_rightmargin_tl - \dim_set_eq:NN \itemindent \l__scripture_poetry_indent_tl + \dim_set:Nn \itemindent { \l__scripture_poetry_indent_tl - \l__scripture_outer_itemindent_dim } \dim_set_eq:NN \listparindent \l__scripture_poetry_indent_tl \skip_zero:N \parsep \skip_zero:N \partopsep - \dim_zero:N \labelsep - } + \dim_compare:nNnTF \parskip > { \l__scripture_poetry_aboveskip_tl } + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \__scripture_skip_diff:NN \l__scripture_poetry_aboveskip_tl \parskip } } + \__scripture_setup_list_noindent:n { \l__scripture_poetry_indent_tl } + } + \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g__scripture_chap_par_prevgraf_int \raggedright - \dim_set_eq:NN \listparindent \l__scripture_poetry_indent_tl \dim_set_eq:NN \parindent \l__scripture_poetry_indent_tl - \bool_gset_false:N \g__scripture_poetry_midparachap_show_verse_bool - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l__scripture_chap_show_bool - { - \bool_if:NTF \l__scripture_chap_drop_bool - { \__scripture_poetry_chap:n { ##2 } } - { \__scripture_poetry_nodrop_chap:n { ##2 } } - } - { \__scripture_poetry_nodrop_chap:n { ##2 } } - } - \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 } - } \item \relax \cs_set_eq:NN \__scripture_tmp_para_end: \par @@ -1706,8 +1682,11 @@ \cs_new_protected:Nn \__scripture_poetry_end: { \__scripture_calc_final_line_length: - \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > { \l__scripture_poetry_belowskip_tl } + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \__scripture_skip_diff:NN \l__scripture_poetry_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g__scripture_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist \bool_gset_true:N \g__scripture_poetry_end_bool \hook_gput_next_code:nn { para / begin } @@ -1719,7 +1698,11 @@ { \keys_set:nn { scripture } { #1 } } -\NewDocumentCommand { \textscripture } { oo+m } +\NewDocumentCommand { \scripturestyle } { s m m } + { + \__scripture_setup_style:nnn { #1 } { #2 } { #3 } + } +\NewDocumentCommand { \textscripture } { o o +m } { \tl_if_novalue:nTF { #2 } { @@ -1731,7 +1714,7 @@ #3 \end { scripture } } -\NewDocumentEnvironment { scripture } { oo } +\NewDocumentEnvironment { scripture } { o o } { \__scripture_begin:n { #2 } \DeclareDocumentEnvironment { center } { o } @@ -1788,6 +1771,11 @@ \tl_set:Nn \l__scripture_belowskip_tl { 0pt } \tl_set:Nn \l__scripture_leftmargin_tl { 0pt } \tl_set:Nn \l__scripture_rightmargin_tl { 0pt } + \cs_set_eq:NN \__scripture_ref_format:n \__scripture_inline_ref_format:n + \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_true:N \l__scripture_compact_bool } \bool_if:NT \l__scripture_compact_bool { @@ -1819,11 +1807,7 @@ } \mode_leave_vertical: } - \peek_remove_spaces:n - { - \peek_meaning:NF \begin - { \bool_gset_false:N \g__scripture_start_bool } - } + \ignorespaces } { \bool_if:NT \l__scripture_compact_bool |