texlive[76010] Master/texmf-dist: scripture (9aug25)

commits+karl at tug.org commits+karl at tug.org
Sat Aug 9 21:36:29 CEST 2025


Revision: 76010
          https://tug.org/svn/texlive?view=revision&revision=76010
Author:   karl
Date:     2025-08-09 21:36:29 +0200 (Sat, 09 Aug 2025)
Log Message:
-----------
scripture (9aug25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/scripture/scripture.pdf
    trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx
    trunk/Master/texmf-dist/source/latex/scripture/scripture.ins
    trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty

Modified: trunk/Master/texmf-dist/doc/latex/scripture/scripture.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx	2025-08-09 19:36:18 UTC (rev 76009)
+++ trunk/Master/texmf-dist/source/latex/scripture/scripture.dtx	2025-08-09 19:36:29 UTC (rev 76010)
@@ -241,10 +241,12 @@
 %   based environment}
 % \changes{v2.0}{2023/12/27}{Bug fixes}
 % \changes{v2.1}{2025/01/02}{Bug fixes}
+% \changes{v2.2}{2025/08/09}{Support footnotes}
+% \changes{v2.2}{2025/08/09}{Bug fixes}
 %
 % \title{The \pkg{scripture} package}
 % \author{David Purton\thanks{Email: \url{dcpurton at marshwiggle.net}}}
-% \date{2025/01/02 v2.1}
+% \date{2025/08/09 v2.2}
 %
 % \maketitle
 %
@@ -298,6 +300,15 @@
 %     instead.
 % \end{itemize}
 %
+% The code which attempts to avoid drop chapters clashing with text is also a
+% bit fragile and can easily break, especially when there are unexpected
+% paragraph breaks.
+%
+% Footnotes are supported, but as the \env{midparachap} environment is a
+% implemented with a \cs{vbox}, footnotes will vanish. In this case you must
+% use \cs{footnotemark} and then \cs{footnotetext} after the \env{midparachap}
+% environment.
+%
 % The \env{poetry} environment uses \cs{obeylines}. This means that it can not
 % be placed in the argument of a macro. If you want to use the \env{poetry}
 % environment in a \pkg{beamer} slide, you must use the \texttt{fragile} option
@@ -393,10 +404,13 @@
 % \end{scripture}
 % \end{scriptureexample}
 %
-% \begin{function}{\ch, \ch*}
+% \changes{v2.2}{2025/03/02}{Add auto chapter numbering}
+% \begin{function}{\ch, \ch*, \newch, \newch*}
 %   \begin{syntax}
 %     |\ch|\oarg{letter}\marg{chapter number}
 %     |\ch*|\oarg{letter}\marg{chapter number}
+%     |\newch|\oarg{letter}
+%     |\newch*|\oarg{letter}
 %   \end{syntax}
 %   Format a chapter number. By default these are formatted using drop text
 %   taking up two lines and the text is separated from the chapter number by a
@@ -408,6 +422,10 @@
 %   attempts to add sufficient space for the dropped chapter when its
 %   paragraph contains only one line. The starred version suppresses this
 %   behaviour.
+%
+%   \cs{newch} and \cs{newch*} behave similarly except that the chapter number
+%   is automatically incremented. The initial chapter can be set by passing
+%   \opt{chapter} to the \env{scirpture} environment.
 % \end{function}
 %
 % \begin{scriptureexample}[lefthand ratio=0.55]
@@ -871,11 +889,17 @@
 % perish but have eternal life.}.
 % \end{scriptureexample}
 %
-% \begin{function}{\vs}
+% \changes{v2.2}{2025/03/02}{Add auto verse numbering}
+% \begin{function}{\vs, \newvs}
 %   \begin{syntax}
 %     |\vs|\marg{verse number}
+%     |\newvs|
 %   \end{syntax}
 %   Format a verse number. By default these are formatted using a superscript.
+%
+%   \cs{newvs} behaves similarly except that the verse number is automatically
+%   incremented. The initial verse can be set by passing \opt{verse} to the
+%   \env{scirpture} environment.
 % \end{function}
 %
 % \subsubsection{Environments}
@@ -1329,6 +1353,27 @@
 %   \meta{|skip|} inserted below the \env{scripture} environment.
 % \end{option}
 %
+% \changes{v2.2}{2025/03/02}{Add \opt{book} option}
+% \begin{option}[added=2025-03-02]{book}
+%   \begin{syntax}
+%     book = name\hfill Default: \emph{Empty}
+%   \end{syntax}
+%   Initialise the book name for the current quotation.
+%
+%   See also \opt{chapter} and \opt{verse}.
+% \end{option}
+%
+% \changes{v2.2}{2025/03/02}{Add \opt{chapter} option}
+% \begin{option}[added=2025-03-02]{chapter}
+%   \begin{syntax}
+%     chapter = \meta{integer}\hfill Default: 1
+%   \end{syntax}
+%   Initialise the chapter number when using automatic chapter numbering with
+%   \cs{newch}.
+%
+%   See also \opt{book} and \opt{verse}.
+% \end{option}
+%
 % \changes{v2.1}{2024/12/30}{Add \opt{chapter/align} option}
 % \begin{option}[added=2024-12-30]{chapter/align}
 %   \begin{syntax}
@@ -2396,6 +2441,17 @@
 %   pushed to the following line.
 % \end{option}
 %
+% \changes{v2.2}{2025/03/02}{Add \opt{verse} option}
+% \begin{option}[added=2025-03-02]{verse}
+%   \begin{syntax}
+%     verse = \meta{integer}\hfill Default: 1
+%   \end{syntax}
+%   Initialise the chapter number when using automatic verse numbering with
+%   \cs{newvs}.
+%
+%   See also \opt{book} and \opt{chapter}.
+% \end{option}
+%
 % \changes{v1.2}{2022/09/07}{Add \opt{verse/colour} option}
 % \begin{option}[added=2022-09-07]{verse/colour, verse/color}
 %   \begin{syntax}
@@ -3180,7 +3236,7 @@
 %
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}[2022-11-01]
-\ProvidesExplPackage{scripture}{2025/01/02}{2.1}
+\ProvidesExplPackage{scripture}{2025/08/09}{2.2}
   {Format Scripture Quotations (DCP)}
 %    \end{macrocode}
 %
@@ -3279,6 +3335,9 @@
     , belowskip                   .tl_set:N           = \l_@@_belowskip_tl
     , belowskip                   .value_required:n   = true
     , belowskip                   .initial:n          = \c_zero_skip
+    , book                        .tl_gset:N          = \g_@@_book_tl
+    , book                        .value_required:n   = true
+    , book                        .initial:n          =
     , colour                      .tl_set:N           = \l_@@_colour_tl
     , colour                      .value_required:n   = true
     , colour                      .initial:n          = .
@@ -3286,6 +3345,9 @@
     , compact                     .bool_set:N         = \l_@@_compact_bool
     , compact                     .default:n          = true
     , compact                     .initial:n          = false
+    , chapter                     .int_gset:N         = \g_@@_chapter_int
+    , chapter                     .value_required:n   = true
+    , chapter                     .initial:n          = \c_one_int
     , chapter / align             .choices:nn         = { left, right }
                                                         {
                                                           \tl_if_exist:NF \l_@@_chapter_align_tl
@@ -3557,6 +3619,9 @@
     , textright / sep             .tl_set:N           = \l_@@_text_right_sep_tl
     , textright / sep             .value_required:n   = true
     , textright / sep             .initial:n          = 1em
+    , verse                       .int_gset:N         = \g_@@_verse_int
+    , verse                       .value_required:n   = true
+    , verse                       .initial:n          = \c_one_int
     , verse / colour              .tl_set:N           = \l_@@_verse_colour_tl
     , verse / colour              .value_required:n   = true
     , verse / colour              .initial:n          = .
@@ -3736,8 +3801,10 @@
     , after                       =
     , before                      =
     , belowskip                   = \c_zero_skip
+    , book                        =
     , colour                      = .
     , compact                     = false
+    , chapter                     = \c_one_int
     , chapter / align             = left
     , chapter / font              = \bfseries
     , chapter / colour            = .
@@ -3796,6 +3863,7 @@
     , selah / format              = #1
     , selah / sep                 = 1em
     , textright / sep             = 1em
+    , verse                       = \c_one_int
     , verse / colour              = .
     , verse / first               = false
     , verse / firstformat         = #1
@@ -3905,6 +3973,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\g_@@_first_verse_set_bool}
+%   Set to \val{true} when the first \cs{ch} or \cs{vs} has been set. This is
+%   used to ensure automatic chapter and verse numbering starts at the right
+%   place.
+%    \begin{macrocode}
+\bool_new:N \g_@@_first_verse_set_bool
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\g_@@_mode_vertical_inner_bool}
 %   Whether an inner environment is starting in vertical mode. This flag is
 %   only used with the \opt{compact} and \opt{verse/para} options.
@@ -3953,15 +4030,21 @@
             \skip_horizontal:n { -#1 }
             \bool_if:NT \l_@@_verse_para_bool
               {
-                \peek_meaning:NTF \vs
+                \peek_analysis_map_inline:n
                   {
-                    \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
-                    \@@_set_pilcrow_hook:
+                    \bool_lazy_or:nnTF
+                      { \exp_args:No \token_if_eq_meaning_p:NN { ####1 } \vs }
+                      { \exp_args:No \token_if_eq_meaning_p:NN { ####1 } \newvs }
+                      {
+                        \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+                        \@@_set_pilcrow_hook:
+                      }
+                      {
+                        \str_if_eq:VnF \l_@@_currenvir_str { poetry }
+                          { \@@_pilcrow_output: }
+                      }
+                    \peek_analysis_map_break:n { ####1 }
                   }
-                  {
-                    \str_if_eq:VnF \l_@@_currenvir_str { poetry }
-                      { \@@_pilcrow_output: }
-                  }
               }
           }
         \hook_gput_next_code:nn { para / end }
@@ -4006,7 +4089,12 @@
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_extra_skip:
   {
-    \mode_if_vertical:F \para_end:
+    \mode_if_vertical:F
+      {
+        \bool_if:NTF \l_@@_verse_para_bool
+          { \para_end: }
+          { \par }
+      }
     \int_compare:nNnT
       \g_@@_chap_par_prevgraf_int = 1
       {
@@ -4267,6 +4355,23 @@
                             \@@_reference_start_inline:
                           }
                       }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newch }
+                      {
+                        \bool_if:NTF \l_@@_ref_start_newline_bool
+                          { \@@_reference_start_newline: }
+                          {
+                            \cs_set_eq:NN \@@_temp_newch \newch
+                            \RenewDocumentCommand \newch { s o }
+                              {
+                                \tl_if_novalue:nF { ##2 }
+                                  {
+                                    \tl_set:Nn \l_@@_X_char_tl { ##2 }
+                                  }
+                                \cs_set_eq:NN \newch \@@_temp_newch
+                              }
+                            \@@_reference_start_inline:
+                          }
+                      }
                     { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                       {
                         \bool_if:NTF \l_@@_ref_start_newline_bool
@@ -4278,6 +4383,17 @@
                             \@@_reference_start_inline:
                           }
                       }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                      {
+                        \bool_if:NTF \l_@@_ref_start_newline_bool
+                          { \@@_reference_start_newline: }
+                          {
+                            \cs_set_eq:NN \@@_temp_newvs \newvs
+                            \RenewDocumentCommand \newvs { }
+                              { \cs_set_eq:NN \newvs \@@_temp_newvs }
+                            \@@_reference_start_inline:
+                          }
+                      }
                   }
                   {
                     \bool_if:NTF \l_@@_ref_start_newline_bool
@@ -4339,11 +4455,18 @@
                       }
                     { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
                       { }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newch }
+                      { }
                     { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                       {
                         \mode_if_vertical:F
                           { \@@_set_pilcrow_hook: }
                       }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                      {
+                        \mode_if_vertical:F
+                          { \@@_set_pilcrow_hook: }
+                      }
                   }
                   {
                     \bool_if:NTF \l_@@_compact_bool
@@ -4390,6 +4513,8 @@
                   { \@@_pilcrow_output: }
                 { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                   { \@@_set_pilcrow_hook: }
+                { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                  { \@@_set_pilcrow_hook: }
               }
             \peek_analysis_map_break:n { ##1 }
           }
@@ -4406,23 +4531,32 @@
     \legacy_if:nTF { @newlist }
       {
         \tex_noindent:D
-        \peek_meaning:NTF \vs
+        \peek_analysis_map_inline:n
           {
-            \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
-            \@@_set_pilcrow_hook:
+            \bool_lazy_or:nnTF
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+              { \bool_gset_true:N \g_@@_suppress_next_verse_para_bool }
+              { \@@_pilcrow_output: }
+            \peek_analysis_map_break:n { ##1 }
           }
-          { \@@_pilcrow_output: }
       }
       {
-        \peek_meaning:NTF \vs
+        \peek_analysis_map_inline:n
           {
-            \bool_if:NT \l_@@_verse_para_bool
-              { \para_end: }
-            \tex_noindent:D
-            \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
-            \@@_set_pilcrow_hook:
+            \bool_lazy_or:nnTF
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+              {
+                \bool_if:NT \l_@@_verse_para_bool
+                  { \para_end: }
+                \tex_noindent:D
+                \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+                \@@_set_pilcrow_hook:
+              }
+              { \@@_pilcrow_output: }
+            \peek_analysis_map_break:n { ##1 }
           }
-          { \@@_pilcrow_output: }
       }
   }
 %    \end{macrocode}
@@ -4464,6 +4598,8 @@
                   { \@@_pilcrow_output: }
                 { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                   { \@@_set_pilcrow_hook: }
+                { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                  { \@@_set_pilcrow_hook: }
               }
             \peek_analysis_map_break:n { ##1 }
           }
@@ -4743,14 +4879,12 @@
     \clubpenalty 10000
     \bool_if:NF \l_@@_verse_para_bool
     {
-      \hook_gput_next_code:nn { para / after }
+      \str_if_eq:VnTF \l_@@_currenvir_str { poetry }
+        { \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel }
         {
-          \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
-          \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
-            { \penalty 10000 }
-          \hook_gput_next_code:nn { para / before }
-            { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int }
+          \int_gset:Nn \g_@@_current_group_level_b_int { \currentgrouplevel + 1 }
         }
+      \@@_chap_par_save_prevgraf_at_group_level:
     }
   }
 %    \end{macrocode}
@@ -4792,14 +4926,8 @@
       { \@@_verse_output:n { 1 } }
     \bool_if:NT \l_@@_verse_para_bool
     {
-      \hook_gput_next_code:nn { para / after }
-        {
-          \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
-          \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
-            { \penalty 10000 }
-          \hook_gput_next_code:nn { para / before }
-            { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int }
-        }
+      \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel
+      \@@_chap_par_save_prevgraf_at_group_level:
     }
     \hook_gclear_next_code:n { scripture / pilcrow }
   }
@@ -4987,37 +5115,112 @@
     \bool_if:NTF \l_@@_mid_para_chap_bool
       { \@@_mid_para_drop_chap_output: }
       {
-        \para_end:
+        \bool_if:NTF \l_@@_verse_para_bool
+          { \para_end: }
+          { \par }
         \@@_drop_chap_output:
         \str_if_eq:VnF \l_@@_currenvir_str { midparachap }
           { \@@_pilcrow_output: }
       }
+    \int_gset_eq:NN \g_@@_current_group_level_a_int \currentgrouplevel
+    \@@_reset_par_at_group_level:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\g_@@_current_group_level_a_int,
+%     \g_@@_current_group_level_a_int, \g_@@_current_group_level_c_int}
+%   Track the group level so indent and spacing is correctly reset after a
+%   drop chapter even if the first paragraph of the chapter contains something
+%   like a \cs{footnote}.
+%    \begin{macrocode}
+\int_new:N \g_@@_current_group_level_a_int
+\int_new:N \g_@@_current_group_level_b_int
+\int_new:N \g_@@_current_group_level_c_int
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_reset_par_at_group_level:}
+%   This function skips over inner groups (like \cs{footnote}) before
+%   resetting the \cs{parshape} after a drop chapter.
+%    \begin{macrocode}
+\cs_new_protected:Nn \@@_reset_par_at_group_level:
+  {
     \hook_gput_next_code:nn { para / before }
       {
-        \legacy_if:nF { @newlist }
+        \int_compare:nNnTF
+          { \g_@@_current_group_level_a_int } = { \currentgrouplevel }
           {
-            \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+            \legacy_if:nF { @newlist }
               {
-                \dim_compare:nNnT \parskip < \baselineskip
+                \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
                   {
-                    \dim_compare:nNnT { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
+                    \dim_compare:nNnT \parskip < \baselineskip
                       {
-                        \hook_gput_next_code:nn { para / begin }
+                        \dim_compare:nNnT
+                          { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
                           {
-                            \para_omit_indent:
-                            \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+                            \hook_gput_next_code:nn { para / begin }
+                              {
+                                \para_omit_indent:
+                                \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+                              }
                           }
                       }
                   }
+                \int_gzero:N \g_@@_chap_par_prevgraf_int
               }
-            \int_gzero:N \g_@@_chap_par_prevgraf_int
+            \parshape 1 ~ \@totalleftmargin ~ \linewidth
           }
-        \parshape 1 ~ \@totalleftmargin ~ \linewidth
+          { \@@_reset_par_at_group_level: }
       }
   }
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_chap_par_save_prevgraf_at_group_level:}
+%   This function skips over inner groups (like \cs{footnote}) before
+%   saving the \cs{prevgraf}.
+%    \begin{macrocode}
+\cs_new_protected:Nn \@@_chap_par_save_prevgraf_at_group_level:
+  {
+    \hook_gput_next_code:nn { para / after }
+      {
+        \int_compare:nNnTF
+          { \g_@@_current_group_level_b_int } = { \currentgrouplevel }
+          {
+            \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf
+            \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
+              { \penalty 10000 }
+            \hook_gput_next_code:nn { para / before }
+              { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int }
+          }
+          { \@@_chap_par_save_prevgraf_at_group_level: }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_zero_chap_par_prevgraf_at_group_level:}
+%   This function skips over inner groups (like \cs{footnote}) before
+%   zeroing \cs{g_@@_chap_par_prevgraf_int}.
+%    \begin{macrocode}
+\cs_new_protected:Nn \@@_zero_chap_par_prevgraf_at_group_level:
+  {
+    \hook_gput_next_code:nn { para / after }
+      {
+        \int_compare:nNnTF
+          { \g_@@_current_group_level_c_int } = { \currentgrouplevel }
+          {
+            \hook_gput_next_code:nn { para / after }
+              { \int_gzero:N \g_@@_chap_par_prevgraf_int }
+          }
+          { \@@_zero_chap_par_prevgraf_at_group_level: }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsubsection{Formatting and printing verse numbers}
 %
 % \begin{macro}{\l_@@_verse_par_start_bool}
@@ -5429,6 +5632,10 @@
     \tl_if_novalue:nF { #1 }
       { \tl_set:Nn \l_@@_ref_tl { #1 } }
     \str_set:Nn \l_@@_currenvir_str { scripture }
+    \bool_gset_false:N \g_@@_first_verse_set_bool
+    \int_gset:Nn \g_@@_chapter_int \c_one_int
+    \int_gset:Nn \g_@@_verse_int \c_one_int
+    \tl_gclear:N \g_@@_book_tl
     \tl_if_novalue:nF { #2 }
       {
         \keys_set:nn { scripture } { #2 }
@@ -5465,6 +5672,29 @@
         \@@_ch_output:nn { ##1 } { ##3 }
       }
     \cs_set_eq:NN \vs \@@_verse_output:n
+    \DeclareDocumentCommand { \newch } { s o }
+      {
+        \bool_if:NTF \g_@@_first_verse_set_bool
+          {
+            \int_gincr:N \g_@@_chapter_int
+            \int_gset:Nn \g_@@_verse_int \c_one_int
+          }
+          { \bool_gset_true:N \g_@@_first_verse_set_bool }
+        \bool_if:nTF { ##1 }
+          {
+            \ch* [ ##2 ] { \int_use:N \g_@@_chapter_int }
+          }
+          {
+            \ch [ ##2 ] { \int_use:N \g_@@_chapter_int }
+          }
+      }
+    \DeclareDocumentCommand { \newvs } { }
+      {
+        \bool_if:NTF \g_@@_first_verse_set_bool
+          { \int_gincr:N \g_@@_verse_int }
+          { \bool_gset_true:N \g_@@_first_verse_set_bool }
+        \vs { \int_use:N \g_@@_verse_int }
+      }
     \cs_set_eq:NN \added \@@_added:n
     \cs_set_eq:NN \heading \@@_heading:n
     \cs_set_eq:NN \name \@@_name:n
@@ -5476,6 +5706,8 @@
     \hook_gclear_next_code:n { para / before }
     \hook_gclear_next_code:n { scripture / pilcow }
     \hook_gclear_next_code:n { scripture / poetry / pilcow }
+    \hook_gput_code:nnn { cmd / @makefntext / before } { scripture }
+      { \cs_set_eq:NN \noindent \tex_noindent:D }
     \l_@@_font_tl
     \tl_set:Ne \l_@@_parindent_tl { \dim_eval:n { \l_@@_parindent_tl } }
     \exp_args:NnV \color_set:nn { scripture default colour } \l_@@_colour_tl
@@ -5586,6 +5818,7 @@
             \skip_vertical:n { -\g_@@_prev_inner_below_skip }
           }
         \hook_gclear_next_code:n { para / before }
+        \hook_gclear_next_code:n { para / after }
         \noindent
         \bool_lazy_or:nnTF
           { \tl_if_novalue_p:n \l_@@_ref_tl }
@@ -5604,6 +5837,7 @@
         \legacy_if_set_false:n { @noparlist }
         \endlist
       }
+    \hook_gremove_code:nn { cmd / @makefntext / before } { scripture }
     \cs_set_eq:NN \noindent \@@_noindent_saved:
     \l_@@_after_tl
   }
@@ -5617,6 +5851,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_compact_end_inner:
   {
+    \hook_gclear_next_code:n { para / before }
+    \hook_gclear_next_code:n { para / begin }
     \bool_gset_false:N \g_@@_mode_vertical_inner_bool
     \str_if_eq:VnT \l_@@_ref_position_tl { start }
       {
@@ -5650,25 +5886,8 @@
         \c_space_token
         \kern 0pt
         \cs_set_eq:NN \par \relax
-        \hook_gput_next_code:nn { para / before }
-          {
-            \int_compare:nNnT \g_@@_mid_para_chap_prevgraf_int = 1
-              {
-                \dim_compare:nNnT \parskip < \baselineskip
-                  {
-                    \dim_compare:nNnT { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
-                      {
-                        \hook_gput_next_code:nn { para / begin }
-                          {
-                            \para_omit_indent:
-                            \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
-                          }
-                      }
-                  }
-              }
-            \int_gzero:N \g_@@_chap_par_prevgraf_int
-            \parshape 1 ~ \@totalleftmargin ~ \linewidth
-          }
+        \int_gset:Nn \g_@@_current_group_level_a_int { \currentgrouplevel - 1 }
+        \@@_reset_par_at_group_level:
       }
     \unskip
   }
@@ -5700,6 +5919,7 @@
       { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l_@@_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
+    \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -5752,6 +5972,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -5779,6 +6001,7 @@
       { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l_@@_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
+    \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -5831,6 +6054,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -5844,6 +6069,13 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\l_@@_hanging_chap_sep_dim}
+%   Calculated chapter separation used in the \env{hanging} environment.
+%    \begin{macrocode}
+\dim_new:N \l_@@_hanging_chap_sep_dim
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\@@_hanging_ch:n}
 %   Position a chapter in a \env{hanging} environment.
 %    \begin{macrocode}
@@ -5874,16 +6106,15 @@
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_hanging_chap:n
   {
+    \dim_set_eq:NN \l_@@_hanging_chap_sep_dim \l_@@_chap_sep_tl
     \@@_drop_chap_set_up:n { #1 }
     \dim_compare:nNnTF
-      { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } < \leftmargin
+      { \g_@@_chap_width_dim + \l_@@_hanging_chap_sep_dim } < \leftmargin
       {
         \bool_if:NT \l_@@_hanging_chapter_indent_bool
           {
-            \tl_set:Nx \l_@@_chap_sep_tl
-              {
-                \dim_eval:n { \leftmargin - \g_@@_chap_width_dim }
-              }
+            \dim_set:Nn \l_@@_hanging_chap_sep_dim
+              { \leftmargin - \g_@@_chap_width_dim }
           }
       }
       {
@@ -5891,22 +6122,22 @@
           \dim_eval:n
             {
               \@totalleftmargin - \leftmargin + \g_@@_chap_width_dim +
-              \l_@@_chap_sep_tl
+              \l_@@_hanging_chap_sep_dim
             } ~
           \dim_eval:n
             {
               \linewidth + \leftmargin - \g_@@_chap_width_dim -
-              \l_@@_chap_sep_tl
+              \l_@@_hanging_chap_sep_dim
             } ~
           \dim_eval:n
             {
               \@totalleftmargin - \leftmargin + \g_@@_chap_width_dim +
-              \l_@@_chap_sep_tl
+              \l_@@_hanging_chap_sep_dim
             } ~
           \dim_eval:n
             {
               \linewidth + \leftmargin - \g_@@_chap_width_dim -
-              \l_@@_chap_sep_tl
+              \l_@@_hanging_chap_sep_dim
             } ~
           \@totalleftmargin ~ \linewidth
       }
@@ -5913,22 +6144,17 @@
     \par
     \bool_if:NTF \l_@@_hanging_chapter_indent_bool
       {
-        \tl_set:Nx \l_@@_chap_sep_tl
-          {
-            \dim_eval:n
-              {
-                \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim
-              }
-          }
+        \dim_set:Nn \l_@@_hanging_chap_sep_dim
+          { \l_@@_hanging_chap_sep_dim + \l_@@_hanging_parindent_saved_dim }
         \@@_nohang:
       }
       {
         \mode_leave_vertical:
         \dim_compare:nNnTF
-          { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \l_@@_hanging_leftmargin_tl
+          { \g_@@_chap_width_dim + \l_@@_hanging_chap_sep_dim } > \l_@@_hanging_leftmargin_tl
           {
             \dim_compare:nNnTF
-              { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \leftmargin
+              { \g_@@_chap_width_dim + \l_@@_hanging_chap_sep_dim } > \leftmargin
               {
                 \skip_horizontal:n { \l_@@_hanging_hang_tl }
               }
@@ -5935,7 +6161,7 @@
               {
                 \skip_horizontal:n
                   {
-                    \l_@@_chap_sep_tl +
+                    \l_@@_hanging_chap_sep_dim +
                     \g_@@_chap_width_dim -
                     \l_@@_hanging_leftmargin_tl
                   }
@@ -5942,11 +6168,8 @@
               }
           }
           {
-            \tl_set:Nx \l_@@_chap_sep_tl
-              {
-                \dim_eval:n
-                  { \l_@@_hanging_leftmargin_tl - \g_@@_chap_width_dim }
-              }
+            \dim_set:Nn \l_@@_hanging_chap_sep_dim
+              { \l_@@_hanging_leftmargin_tl - \g_@@_chap_width_dim }
           }
       }
     \hbox_set:Nn \l_@@_chap_box
@@ -5957,7 +6180,7 @@
             \hbox_overlap_left:n
               {
                 \box_use:N \l_@@_chap_tmp_box
-                \skip_horizontal:N \l_@@_chap_sep_tl
+                \skip_horizontal:N \l_@@_hanging_chap_sep_dim
               }
           }
       }
@@ -5991,18 +6214,19 @@
         \int_compare:nNnTF \g_@@_chap_par_prevgraf_int = \c_one_int
           {
             \dim_compare:nNnTF
-              { \l_@@_hanging_leftmargin_tl } < { \g_@@_chap_width_dim + \l_@@_chap_sep_tl }
+              { \l_@@_hanging_leftmargin_tl } <
+                { \g_@@_chap_width_dim + \l_@@_hanging_chap_sep_dim }
               {
                 \parshape 2 ~
                   \dim_eval:n
                     {
                       \@totalleftmargin - \leftmargin + \g_@@_chap_width_dim +
-                      \l_@@_chap_sep_tl
+                      \l_@@_hanging_chap_sep_dim
                     } ~
                   \dim_eval:n
                     {
                       \linewidth + \leftmargin - \g_@@_chap_width_dim -
-                      \l_@@_chap_sep_tl
+                      \l_@@_hanging_chap_sep_dim
                     } ~
                   \@totalleftmargin ~ \linewidth
               }
@@ -6089,10 +6313,16 @@
       { \skip_horizontal:n { \l_@@_hanging_hang_tl } }
       { \tex_noindent:D }
     \hbox_to_wd:nn { \l_@@_hanging_parindent_saved_dim } { }
-    \peek_meaning:NT \vs
+    \peek_analysis_map_inline:n
       {
-        \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
-        \@@_set_pilcrow_hook:
+        \bool_lazy_or:nnT
+          { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+          { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+          {
+            \bool_gset_true:N \g_@@_suppress_next_verse_para_bool
+            \@@_set_pilcrow_hook:
+          }
+        \peek_analysis_map_break:n { ##1 }
       }
   }
 %    \end{macrocode}
@@ -6132,7 +6362,8 @@
       { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l_@@_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
-    \hook_gclear_next_code:n { para/ before }
+    \hook_gclear_next_code:n { para / before }
+    \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -6173,6 +6404,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -6264,6 +6497,8 @@
                   { \@@_pilcrow_output: }
                 { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                   { \@@_set_pilcrow_hook: }
+                { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                  { \@@_set_pilcrow_hook: }
               }
             \peek_analysis_map_break:n { ##1 }
           }
@@ -6429,28 +6664,8 @@
     \noindent
     \skip_horizontal:N \g_@@_final_line_dim
     \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \g_@@_mid_para_chap_prevgraf_int
-    \hook_gput_next_code:nn { para / before }
-      {
-        \legacy_if:nF { @newlist }
-          {
-            \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1
-              {
-                \dim_compare:nNnT \parskip < \baselineskip
-                  {
-                    \dim_compare:nNnT { \g_@@_chap_width_dim + \l_@@_chap_sep_tl } > \parindent
-                      {
-                        \hook_gput_next_code:nn { para / begin }
-                          {
-                            \para_omit_indent:
-                            \skip_horizontal:n {\g_@@_chap_width_dim + \l_@@_chap_sep_tl }
-                          }
-                      }
-                  }
-              }
-            \int_gzero:N \g_@@_chap_par_prevgraf_int
-          }
-        \parshape 1 ~ \@totalleftmargin ~ \linewidth
-      }
+    \int_gset:Nn \g_@@_current_group_level_a_int { \currentgrouplevel - 1 }
+    \@@_reset_par_at_group_level:
   }
 %    \end{macrocode}
 % \end{macro}
@@ -6478,6 +6693,7 @@
       { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l_@@_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
+    \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \dim_zero:N \labelsep
@@ -6527,6 +6743,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g_@@_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -6647,11 +6865,8 @@
 \cs_new_protected:Nn \@@_poetry_chap:n
   {
     \@@_drop_chap_set_up:n { #1 }
-     \hook_gput_next_code:nn { para / after }
-       {
-         \hook_gput_next_code:nn { para / after }
-           { \int_gzero:N \g_@@_chap_par_prevgraf_int }
-       }
+    \int_gset_eq:NN \g_@@_current_group_level_c_int \currentgrouplevel
+    \@@_zero_chap_par_prevgraf_at_group_level:
     \cs_if_eq:NNTF \vs \@@_poetry_mode_vertical_verse:n
       {
         \dim_zero:N \l_@@_poetry_chap_indent_dim
@@ -6810,9 +7025,9 @@
             \group_end:
             \skip_horizontal:N \l_@@_chap_sep_tl
             \hook_use:n { scripture / chap / after }
+            \bool_lazy_or:nnT \l_@@_chap_show_verse_bool \l_@@_poetry_midparachap_show_verse_bool
+              { \@@_verse_output:n { 1 } }
           }
-        \bool_lazy_or:nnT \l_@@_chap_show_verse_bool \l_@@_poetry_midparachap_show_verse_bool
-          { \@@_verse_output:n { 1 } }
       }
       {
         \hook_use:n { scripture / chap / before }
@@ -6860,6 +7075,7 @@
     \group_end:
     \bool_if:NF \g_@@_suppress_next_pilcrow_bool
       { \hook_use:n { scripture / poetry / pilcrow } }
+    \cs_set_eq:NN \vs \@@_verse_output:n
   }
 %    \end{macrocode}
 % \end{macro}
@@ -6881,6 +7097,7 @@
         \skip_horizontal:N \listparindent
       }
     \group_end:
+    \cs_set_eq:NN \vs \@@_verse_output:n
   }
 %    \end{macrocode}
 % \end{macro}
@@ -6935,6 +7152,12 @@
                 \@@_poetry_par:
                 \peek_analysis_map_break:n { ##1 }
               }
+            { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newch }
+              {
+                \bool_set_eq:NN \l_@@_poetry_midparachap_show_verse_bool \l_@@_midparachap_show_verse_bool
+                \@@_poetry_par:
+                \peek_analysis_map_break:n { ##1 }
+              }
             { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \end }
               { \peek_analysis_map_break:n { ##1 } }
             { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \extraskip }
@@ -6956,6 +7179,13 @@
                   { \noindent }
                 \peek_analysis_map_break:n { ##1 }
               }
+            { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+              {
+                \@@_poetry_par:
+                \cs_if_eq:NNT \vs \@@_poetry_mode_vertical_verse:n
+                  { \noindent }
+                \peek_analysis_map_break:n { ##1 }
+              }
             { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \@@_obeylines_eol: }
               { \cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n }
           }
@@ -6963,6 +7193,7 @@
             \@@_poetry_par:
             \cs_if_eq:NNT \vs \@@_poetry_mode_vertical_verse:n
               { \noindent }
+            \cs_set_eq:NN \vs \@@_verse_output:n
             \bool_if:NT \l_@@_verse_para_bool
               {
                 \@@_pilcrow_output:
@@ -7008,6 +7239,7 @@
       { \dim_zero:N \l_@@_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
     \cs_set_eq:NN \noindent \tex_noindent:D
+    \hook_gclear_next_code:n { para / before }
     \hook_gput_next_code:nn { scripture / poetry / pilcrow }
       {
         \@@_pilcrow_output:
@@ -7014,6 +7246,7 @@
         \bool_set_false:N \l_@@_pilcrow_bool
         \bool_set_false:N \l_@@_verse_para_bool
       }
+    \int_gset_eq:NN \g_@@_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -7059,7 +7292,10 @@
     \hook_gclear_next_code:n { scripture / poetry / pilcrow }
     \bool_gset_true:N \g_@@_poetry_end_bool
     \hook_gput_next_code:nn { para / begin }
-      { \bool_gset_false:N \g_@@_poetry_end_bool }
+      {
+        \bool_gset_false:N \g_@@_poetry_end_bool
+        \parshape 1 ~ \@totalleftmargin ~ \linewidth
+      }
   }
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/Master/texmf-dist/source/latex/scripture/scripture.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/scripture/scripture.ins	2025-08-09 19:36:18 UTC (rev 76009)
+++ trunk/Master/texmf-dist/source/latex/scripture/scripture.ins	2025-08-09 19:36:29 UTC (rev 76010)
@@ -19,7 +19,7 @@
 
 This is a generated file.
 
-Copyright (c) 2022-2023 David Purton <dcpurton at marshwiggle.net>
+Copyright (c) 2022-2025 David Purton <dcpurton at marshwiggle.net>
 
 This work may be distributed and/or modified under the conditions of
 the LaTeX Project2 Public License, either version 1.3c of this license

Modified: trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty	2025-08-09 19:36:18 UTC (rev 76009)
+++ trunk/Master/texmf-dist/tex/latex/scripture/scripture.sty	2025-08-09 19:36:29 UTC (rev 76010)
@@ -8,7 +8,7 @@
 %% 
 %% This is a generated file.
 %% 
-%% Copyright (c) 2022-2023 David Purton <dcpurton at marshwiggle.net>
+%% Copyright (c) 2022-2025 David Purton <dcpurton at marshwiggle.net>
 %% 
 %% This work may be distributed and/or modified under the conditions of
 %% the LaTeX Project2 Public License, either version 1.3c of this license
@@ -25,7 +25,7 @@
 %% and the derived files scripture.sty and scripture.pdf
 %% 
 \NeedsTeXFormat{LaTeX2e}[2022-11-01]
-\ProvidesExplPackage{scripture}{2025/01/02}{2.1}
+\ProvidesExplPackage{scripture}{2025/08/09}{2.2}
   {Format Scripture Quotations (DCP)}
 \bool_new:N \l__scripture_textdir_change_in_group_bool
 \cs_new_protected:Nn \__scripture_set_textdirection:
@@ -79,6 +79,9 @@
     , belowskip                   .tl_set:N           = \l__scripture_belowskip_tl
     , belowskip                   .value_required:n   = true
     , belowskip                   .initial:n          = \c_zero_skip
+    , book                        .tl_gset:N          = \g__scripture_book_tl
+    , book                        .value_required:n   = true
+    , book                        .initial:n          =
     , colour                      .tl_set:N           = \l__scripture_colour_tl
     , colour                      .value_required:n   = true
     , colour                      .initial:n          = .
@@ -86,6 +89,9 @@
     , compact                     .bool_set:N         = \l__scripture_compact_bool
     , compact                     .default:n          = true
     , compact                     .initial:n          = false
+    , chapter                     .int_gset:N         = \g__scripture_chapter_int
+    , chapter                     .value_required:n   = true
+    , chapter                     .initial:n          = \c_one_int
     , chapter / align             .choices:nn         = { left, right }
                                                         {
                                                           \tl_if_exist:NF \l__scripture_chapter_align_tl
@@ -357,6 +363,9 @@
     , textright / sep             .tl_set:N           = \l__scripture_text_right_sep_tl
     , textright / sep             .value_required:n   = true
     , textright / sep             .initial:n          = 1em
+    , verse                       .int_gset:N         = \g__scripture_verse_int
+    , verse                       .value_required:n   = true
+    , verse                       .initial:n          = \c_one_int
     , verse / colour              .tl_set:N           = \l__scripture_verse_colour_tl
     , verse / colour              .value_required:n   = true
     , verse / colour              .initial:n          = .
@@ -511,8 +520,10 @@
     , after                       =
     , before                      =
     , belowskip                   = \c_zero_skip
+    , book                        =
     , colour                      = .
     , compact                     = false
+    , chapter                     = \c_one_int
     , chapter / align             = left
     , chapter / font              = \bfseries
     , chapter / colour            = .
@@ -571,6 +582,7 @@
     , selah / format              = #1
     , selah / sep                 = 1em
     , textright / sep             = 1em
+    , verse                       = \c_one_int
     , verse / colour              = .
     , verse / first               = false
     , verse / firstformat         = #1
@@ -642,6 +654,7 @@
 \hook_new:n { scripture / poetry / pilcrow }
 \bool_new:N \l__scripture_active_bool
 \bool_new:N \l__scripture_active_inner_bool
+\bool_new:N \g__scripture_first_verse_set_bool
 \bool_new:N \g__scripture_mode_vertical_inner_bool
 \int_new:N \l__scripture_clubpenalty_saved_int
 \skip_new:N \g__scripture_prev_inner_below_skip
@@ -655,15 +668,21 @@
             \skip_horizontal:n { -#1 }
             \bool_if:NT \l__scripture_verse_para_bool
               {
-                \peek_meaning:NTF \vs
+                \peek_analysis_map_inline:n
                   {
-                    \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
-                    \__scripture_set_pilcrow_hook:
+                    \bool_lazy_or:nnTF
+                      { \exp_args:No \token_if_eq_meaning_p:NN { ####1 } \vs }
+                      { \exp_args:No \token_if_eq_meaning_p:NN { ####1 } \newvs }
+                      {
+                        \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+                        \__scripture_set_pilcrow_hook:
+                      }
+                      {
+                        \str_if_eq:VnF \l__scripture_currenvir_str { poetry }
+                          { \__scripture_pilcrow_output: }
+                      }
+                    \peek_analysis_map_break:n { ####1 }
                   }
-                  {
-                    \str_if_eq:VnF \l__scripture_currenvir_str { poetry }
-                      { \__scripture_pilcrow_output: }
-                  }
               }
           }
         \hook_gput_next_code:nn { para / end }
@@ -691,7 +710,12 @@
   }
 \cs_new_protected:Nn \__scripture_extra_skip:
   {
-    \mode_if_vertical:F \para_end:
+    \mode_if_vertical:F
+      {
+        \bool_if:NTF \l__scripture_verse_para_bool
+          { \para_end: }
+          { \par }
+      }
     \int_compare:nNnT
       \g__scripture_chap_par_prevgraf_int = 1
       {
@@ -902,6 +926,23 @@
                             \__scripture_reference_start_inline:
                           }
                       }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newch }
+                      {
+                        \bool_if:NTF \l__scripture_ref_start_newline_bool
+                          { \__scripture_reference_start_newline: }
+                          {
+                            \cs_set_eq:NN \__scripture_temp_newch \newch
+                            \RenewDocumentCommand \newch { s o }
+                              {
+                                \tl_if_novalue:nF { ##2 }
+                                  {
+                                    \tl_set:Nn \l__scripture_X_char_tl { ##2 }
+                                  }
+                                \cs_set_eq:NN \newch \__scripture_temp_newch
+                              }
+                            \__scripture_reference_start_inline:
+                          }
+                      }
                     { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                       {
                         \bool_if:NTF \l__scripture_ref_start_newline_bool
@@ -913,6 +954,17 @@
                             \__scripture_reference_start_inline:
                           }
                       }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                      {
+                        \bool_if:NTF \l__scripture_ref_start_newline_bool
+                          { \__scripture_reference_start_newline: }
+                          {
+                            \cs_set_eq:NN \__scripture_temp_newvs \newvs
+                            \RenewDocumentCommand \newvs { }
+                              { \cs_set_eq:NN \newvs \__scripture_temp_newvs }
+                            \__scripture_reference_start_inline:
+                          }
+                      }
                   }
                   {
                     \bool_if:NTF \l__scripture_ref_start_newline_bool
@@ -974,11 +1026,18 @@
                       }
                     { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \ch }
                       { }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newch }
+                      { }
                     { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                       {
                         \mode_if_vertical:F
                           { \__scripture_set_pilcrow_hook: }
                       }
+                    { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                      {
+                        \mode_if_vertical:F
+                          { \__scripture_set_pilcrow_hook: }
+                      }
                   }
                   {
                     \bool_if:NTF \l__scripture_compact_bool
@@ -1019,6 +1078,8 @@
                   { \__scripture_pilcrow_output: }
                 { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                   { \__scripture_set_pilcrow_hook: }
+                { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                  { \__scripture_set_pilcrow_hook: }
               }
             \peek_analysis_map_break:n { ##1 }
           }
@@ -1029,23 +1090,32 @@
     \legacy_if:nTF { @newlist }
       {
         \tex_noindent:D
-        \peek_meaning:NTF \vs
+        \peek_analysis_map_inline:n
           {
-            \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
-            \__scripture_set_pilcrow_hook:
+            \bool_lazy_or:nnTF
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+              { \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool }
+              { \__scripture_pilcrow_output: }
+            \peek_analysis_map_break:n { ##1 }
           }
-          { \__scripture_pilcrow_output: }
       }
       {
-        \peek_meaning:NTF \vs
+        \peek_analysis_map_inline:n
           {
-            \bool_if:NT \l__scripture_verse_para_bool
-              { \para_end: }
-            \tex_noindent:D
-            \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
-            \__scripture_set_pilcrow_hook:
+            \bool_lazy_or:nnTF
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+              { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+              {
+                \bool_if:NT \l__scripture_verse_para_bool
+                  { \para_end: }
+                \tex_noindent:D
+                \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+                \__scripture_set_pilcrow_hook:
+              }
+              { \__scripture_pilcrow_output: }
+            \peek_analysis_map_break:n { ##1 }
           }
-          { \__scripture_pilcrow_output: }
       }
   }
 \bool_new:N \g__scripture_para_mode_vertical_bool
@@ -1066,6 +1136,8 @@
                   { \__scripture_pilcrow_output: }
                 { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                   { \__scripture_set_pilcrow_hook: }
+                { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                  { \__scripture_set_pilcrow_hook: }
               }
             \peek_analysis_map_break:n { ##1 }
           }
@@ -1230,14 +1302,12 @@
     \clubpenalty 10000
     \bool_if:NF \l__scripture_verse_para_bool
     {
-      \hook_gput_next_code:nn { para / after }
+      \str_if_eq:VnTF \l__scripture_currenvir_str { poetry }
+        { \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel }
         {
-          \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
-          \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
-            { \penalty 10000 }
-          \hook_gput_next_code:nn { para / before }
-            { \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int }
+          \int_gset:Nn \g__scripture_current_group_level_b_int { \currentgrouplevel + 1 }
         }
+      \__scripture_chap_par_save_prevgraf_at_group_level:
     }
   }
 \cs_new_protected:Nn \__scripture_drop_chap_output:
@@ -1273,14 +1343,8 @@
       { \__scripture_verse_output:n { 1 } }
     \bool_if:NT \l__scripture_verse_para_bool
     {
-      \hook_gput_next_code:nn { para / after }
-        {
-          \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
-          \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
-            { \penalty 10000 }
-          \hook_gput_next_code:nn { para / before }
-            { \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int }
-        }
+      \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel
+      \__scripture_chap_par_save_prevgraf_at_group_level:
     }
     \hook_gclear_next_code:n { scripture / pilcrow }
   }
@@ -1450,34 +1514,79 @@
     \bool_if:NTF \l__scripture_mid_para_chap_bool
       { \__scripture_mid_para_drop_chap_output: }
       {
-        \para_end:
+        \bool_if:NTF \l__scripture_verse_para_bool
+          { \para_end: }
+          { \par }
         \__scripture_drop_chap_output:
         \str_if_eq:VnF \l__scripture_currenvir_str { midparachap }
           { \__scripture_pilcrow_output: }
       }
+    \int_gset_eq:NN \g__scripture_current_group_level_a_int \currentgrouplevel
+    \__scripture_reset_par_at_group_level:
+  }
+\int_new:N \g__scripture_current_group_level_a_int
+\int_new:N \g__scripture_current_group_level_b_int
+\int_new:N \g__scripture_current_group_level_c_int
+\cs_new_protected:Nn \__scripture_reset_par_at_group_level:
+  {
     \hook_gput_next_code:nn { para / before }
       {
-        \legacy_if:nF { @newlist }
+        \int_compare:nNnTF
+          { \g__scripture_current_group_level_a_int } = { \currentgrouplevel }
           {
-            \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+            \legacy_if:nF { @newlist }
               {
-                \dim_compare:nNnT \parskip < \baselineskip
+                \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
                   {
-                    \dim_compare:nNnT { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
+                    \dim_compare:nNnT \parskip < \baselineskip
                       {
-                        \hook_gput_next_code:nn { para / begin }
+                        \dim_compare:nNnT
+                          { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
                           {
-                            \para_omit_indent:
-                            \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+                            \hook_gput_next_code:nn { para / begin }
+                              {
+                                \para_omit_indent:
+                                \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+                              }
                           }
                       }
                   }
+                \int_gzero:N \g__scripture_chap_par_prevgraf_int
               }
-            \int_gzero:N \g__scripture_chap_par_prevgraf_int
+            \parshape 1 ~ \@totalleftmargin ~ \linewidth
           }
-        \parshape 1 ~ \@totalleftmargin ~ \linewidth
+          { \__scripture_reset_par_at_group_level: }
       }
   }
+\cs_new_protected:Nn \__scripture_chap_par_save_prevgraf_at_group_level:
+  {
+    \hook_gput_next_code:nn { para / after }
+      {
+        \int_compare:nNnTF
+          { \g__scripture_current_group_level_b_int } = { \currentgrouplevel }
+          {
+            \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \prevgraf
+            \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
+              { \penalty 10000 }
+            \hook_gput_next_code:nn { para / before }
+              { \int_set_eq:NN \clubpenalty \l__scripture_clubpenalty_saved_int }
+          }
+          { \__scripture_chap_par_save_prevgraf_at_group_level: }
+      }
+  }
+\cs_new_protected:Nn \__scripture_zero_chap_par_prevgraf_at_group_level:
+  {
+    \hook_gput_next_code:nn { para / after }
+      {
+        \int_compare:nNnTF
+          { \g__scripture_current_group_level_c_int } = { \currentgrouplevel }
+          {
+            \hook_gput_next_code:nn { para / after }
+              { \int_gzero:N \g__scripture_chap_par_prevgraf_int }
+          }
+          { \__scripture_zero_chap_par_prevgraf_at_group_level: }
+      }
+  }
 \bool_new:N \l__scripture_verse_par_start_bool
 \bool_new:N \l__scripture_no_verse_first_bool
 \bool_new:N \g__scripture_suppress_next_verse_para_bool
@@ -1751,6 +1860,10 @@
     \tl_if_novalue:nF { #1 }
       { \tl_set:Nn \l__scripture_ref_tl { #1 } }
     \str_set:Nn \l__scripture_currenvir_str { scripture }
+    \bool_gset_false:N \g__scripture_first_verse_set_bool
+    \int_gset:Nn \g__scripture_chapter_int \c_one_int
+    \int_gset:Nn \g__scripture_verse_int \c_one_int
+    \tl_gclear:N \g__scripture_book_tl
     \tl_if_novalue:nF { #2 }
       {
         \keys_set:nn { scripture } { #2 }
@@ -1784,6 +1897,29 @@
         \__scripture_ch_output:nn { ##1 } { ##3 }
       }
     \cs_set_eq:NN \vs \__scripture_verse_output:n
+    \DeclareDocumentCommand { \newch } { s o }
+      {
+        \bool_if:NTF \g__scripture_first_verse_set_bool
+          {
+            \int_gincr:N \g__scripture_chapter_int
+            \int_gset:Nn \g__scripture_verse_int \c_one_int
+          }
+          { \bool_gset_true:N \g__scripture_first_verse_set_bool }
+        \bool_if:nTF { ##1 }
+          {
+            \ch* [ ##2 ] { \int_use:N \g__scripture_chapter_int }
+          }
+          {
+            \ch [ ##2 ] { \int_use:N \g__scripture_chapter_int }
+          }
+      }
+    \DeclareDocumentCommand { \newvs } { }
+      {
+        \bool_if:NTF \g__scripture_first_verse_set_bool
+          { \int_gincr:N \g__scripture_verse_int }
+          { \bool_gset_true:N \g__scripture_first_verse_set_bool }
+        \vs { \int_use:N \g__scripture_verse_int }
+      }
     \cs_set_eq:NN \added \__scripture_added:n
     \cs_set_eq:NN \heading \__scripture_heading:n
     \cs_set_eq:NN \name \__scripture_name:n
@@ -1795,6 +1931,8 @@
     \hook_gclear_next_code:n { para / before }
     \hook_gclear_next_code:n { scripture / pilcow }
     \hook_gclear_next_code:n { scripture / poetry / pilcow }
+    \hook_gput_code:nnn { cmd / @makefntext / before } { scripture }
+      { \cs_set_eq:NN \noindent \tex_noindent:D }
     \l__scripture_font_tl
     \tl_set:Ne \l__scripture_parindent_tl { \dim_eval:n { \l__scripture_parindent_tl } }
     \exp_args:NnV \color_set:nn { scripture default colour } \l__scripture_colour_tl
@@ -1895,6 +2033,7 @@
             \skip_vertical:n { -\g__scripture_prev_inner_below_skip }
           }
         \hook_gclear_next_code:n { para / before }
+        \hook_gclear_next_code:n { para / after }
         \noindent
         \bool_lazy_or:nnTF
           { \tl_if_novalue_p:n \l__scripture_ref_tl }
@@ -1909,11 +2048,14 @@
         \legacy_if_set_false:n { @noparlist }
         \endlist
       }
+    \hook_gremove_code:nn { cmd / @makefntext / before } { scripture }
     \cs_set_eq:NN \noindent \__scripture_noindent_saved:
     \l__scripture_after_tl
   }
 \cs_new_protected:Nn \__scripture_compact_end_inner:
   {
+    \hook_gclear_next_code:n { para / before }
+    \hook_gclear_next_code:n { para / begin }
     \bool_gset_false:N \g__scripture_mode_vertical_inner_bool
     \str_if_eq:VnT \l__scripture_ref_position_tl { start }
       {
@@ -1947,25 +2089,8 @@
         \c_space_token
         \kern 0pt
         \cs_set_eq:NN \par \relax
-        \hook_gput_next_code:nn { para / before }
-          {
-            \int_compare:nNnT \g__scripture_mid_para_chap_prevgraf_int = 1
-              {
-                \dim_compare:nNnT \parskip < \baselineskip
-                  {
-                    \dim_compare:nNnT { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
-                      {
-                        \hook_gput_next_code:nn { para / begin }
-                          {
-                            \para_omit_indent:
-                            \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
-                          }
-                      }
-                  }
-              }
-            \int_gzero:N \g__scripture_chap_par_prevgraf_int
-            \parshape 1 ~ \@totalleftmargin ~ \linewidth
-          }
+        \int_gset:Nn \g__scripture_current_group_level_a_int { \currentgrouplevel - 1 }
+        \__scripture_reset_par_at_group_level:
       }
     \unskip
   }
@@ -1987,6 +2112,7 @@
       { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l__scripture_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
+    \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -2033,6 +2159,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 \cs_new_protected:Nn \__scripture_flushright_begin:n
   {
@@ -2052,6 +2180,7 @@
       { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l__scripture_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
+    \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -2098,8 +2227,11 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 \dim_new:N \l__scripture_hanging_parindent_saved_dim
+\dim_new:N \l__scripture_hanging_chap_sep_dim
 \cs_new_protected:Nn \__scripture_hanging_ch:n
   {
     \bool_gset_false:N \g__scripture_suppress_next_pilcrow_bool
@@ -2121,16 +2253,15 @@
   }
 \cs_new_protected:Nn \__scripture_hanging_chap:n
   {
+    \dim_set_eq:NN \l__scripture_hanging_chap_sep_dim \l__scripture_chap_sep_tl
     \__scripture_drop_chap_set_up:n { #1 }
     \dim_compare:nNnTF
-      { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } < \leftmargin
+      { \g__scripture_chap_width_dim + \l__scripture_hanging_chap_sep_dim } < \leftmargin
       {
         \bool_if:NT \l__scripture_hanging_chapter_indent_bool
           {
-            \tl_set:Nx \l__scripture_chap_sep_tl
-              {
-                \dim_eval:n { \leftmargin - \g__scripture_chap_width_dim }
-              }
+            \dim_set:Nn \l__scripture_hanging_chap_sep_dim
+              { \leftmargin - \g__scripture_chap_width_dim }
           }
       }
       {
@@ -2138,22 +2269,22 @@
           \dim_eval:n
             {
               \@totalleftmargin - \leftmargin + \g__scripture_chap_width_dim +
-              \l__scripture_chap_sep_tl
+              \l__scripture_hanging_chap_sep_dim
             } ~
           \dim_eval:n
             {
               \linewidth + \leftmargin - \g__scripture_chap_width_dim -
-              \l__scripture_chap_sep_tl
+              \l__scripture_hanging_chap_sep_dim
             } ~
           \dim_eval:n
             {
               \@totalleftmargin - \leftmargin + \g__scripture_chap_width_dim +
-              \l__scripture_chap_sep_tl
+              \l__scripture_hanging_chap_sep_dim
             } ~
           \dim_eval:n
             {
               \linewidth + \leftmargin - \g__scripture_chap_width_dim -
-              \l__scripture_chap_sep_tl
+              \l__scripture_hanging_chap_sep_dim
             } ~
           \@totalleftmargin ~ \linewidth
       }
@@ -2160,22 +2291,17 @@
     \par
     \bool_if:NTF \l__scripture_hanging_chapter_indent_bool
       {
-        \tl_set:Nx \l__scripture_chap_sep_tl
-          {
-            \dim_eval:n
-              {
-                \l__scripture_chap_sep_tl + \l__scripture_hanging_parindent_saved_dim
-              }
-          }
+        \dim_set:Nn \l__scripture_hanging_chap_sep_dim
+          { \l__scripture_hanging_chap_sep_dim + \l__scripture_hanging_parindent_saved_dim }
         \__scripture_nohang:
       }
       {
         \mode_leave_vertical:
         \dim_compare:nNnTF
-          { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \l__scripture_hanging_leftmargin_tl
+          { \g__scripture_chap_width_dim + \l__scripture_hanging_chap_sep_dim } > \l__scripture_hanging_leftmargin_tl
           {
             \dim_compare:nNnTF
-              { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \leftmargin
+              { \g__scripture_chap_width_dim + \l__scripture_hanging_chap_sep_dim } > \leftmargin
               {
                 \skip_horizontal:n { \l__scripture_hanging_hang_tl }
               }
@@ -2182,7 +2308,7 @@
               {
                 \skip_horizontal:n
                   {
-                    \l__scripture_chap_sep_tl +
+                    \l__scripture_hanging_chap_sep_dim +
                     \g__scripture_chap_width_dim -
                     \l__scripture_hanging_leftmargin_tl
                   }
@@ -2189,11 +2315,8 @@
               }
           }
           {
-            \tl_set:Nx \l__scripture_chap_sep_tl
-              {
-                \dim_eval:n
-                  { \l__scripture_hanging_leftmargin_tl - \g__scripture_chap_width_dim }
-              }
+            \dim_set:Nn \l__scripture_hanging_chap_sep_dim
+              { \l__scripture_hanging_leftmargin_tl - \g__scripture_chap_width_dim }
           }
       }
     \hbox_set:Nn \l__scripture_chap_box
@@ -2204,7 +2327,7 @@
             \hbox_overlap_left:n
               {
                 \box_use:N \l__scripture_chap_tmp_box
-                \skip_horizontal:N \l__scripture_chap_sep_tl
+                \skip_horizontal:N \l__scripture_hanging_chap_sep_dim
               }
           }
       }
@@ -2238,18 +2361,19 @@
         \int_compare:nNnTF \g__scripture_chap_par_prevgraf_int = \c_one_int
           {
             \dim_compare:nNnTF
-              { \l__scripture_hanging_leftmargin_tl } < { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+              { \l__scripture_hanging_leftmargin_tl } <
+                { \g__scripture_chap_width_dim + \l__scripture_hanging_chap_sep_dim }
               {
                 \parshape 2 ~
                   \dim_eval:n
                     {
                       \@totalleftmargin - \leftmargin + \g__scripture_chap_width_dim +
-                      \l__scripture_chap_sep_tl
+                      \l__scripture_hanging_chap_sep_dim
                     } ~
                   \dim_eval:n
                     {
                       \linewidth + \leftmargin - \g__scripture_chap_width_dim -
-                      \l__scripture_chap_sep_tl
+                      \l__scripture_hanging_chap_sep_dim
                     } ~
                   \@totalleftmargin ~ \linewidth
               }
@@ -2322,10 +2446,16 @@
       { \skip_horizontal:n { \l__scripture_hanging_hang_tl } }
       { \tex_noindent:D }
     \hbox_to_wd:nn { \l__scripture_hanging_parindent_saved_dim } { }
-    \peek_meaning:NT \vs
+    \peek_analysis_map_inline:n
       {
-        \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
-        \__scripture_set_pilcrow_hook:
+        \bool_lazy_or:nnT
+          { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
+          { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+          {
+            \bool_gset_true:N \g__scripture_suppress_next_verse_para_bool
+            \__scripture_set_pilcrow_hook:
+          }
+        \peek_analysis_map_break:n { ##1 }
       }
   }
 \cs_new_protected:Nn \__scripture_hanging_begin:n
@@ -2359,7 +2489,8 @@
       { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l__scripture_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
-    \hook_gclear_next_code:n { para/ before }
+    \hook_gclear_next_code:n { para / before }
+    \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -2394,6 +2525,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 \cs_new_protected:Npn \__scripture_vbox_set_top:Nw #1
   {
@@ -2424,6 +2557,8 @@
                   { \__scripture_pilcrow_output: }
                 { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \vs }
                   { \__scripture_set_pilcrow_hook: }
+                { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+                  { \__scripture_set_pilcrow_hook: }
               }
             \peek_analysis_map_break:n { ##1 }
           }
@@ -2560,28 +2695,8 @@
     \noindent
     \skip_horizontal:N \g__scripture_final_line_dim
     \int_gset_eq:NN \g__scripture_chap_par_prevgraf_int \g__scripture_mid_para_chap_prevgraf_int
-    \hook_gput_next_code:nn { para / before }
-      {
-        \legacy_if:nF { @newlist }
-          {
-            \int_compare:nNnT \g__scripture_chap_par_prevgraf_int = 1
-              {
-                \dim_compare:nNnT \parskip < \baselineskip
-                  {
-                    \dim_compare:nNnT { \g__scripture_chap_width_dim + \l__scripture_chap_sep_tl } > \parindent
-                      {
-                        \hook_gput_next_code:nn { para / begin }
-                          {
-                            \para_omit_indent:
-                            \skip_horizontal:n {\g__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
-                          }
-                      }
-                  }
-              }
-            \int_gzero:N \g__scripture_chap_par_prevgraf_int
-          }
-        \parshape 1 ~ \@totalleftmargin ~ \linewidth
-      }
+    \int_gset:Nn \g__scripture_current_group_level_a_int { \currentgrouplevel - 1 }
+    \__scripture_reset_par_at_group_level:
   }
 \cs_new_protected:Nn \__scripture_narrow_begin:n
   {
@@ -2601,6 +2716,7 @@
       { \dim_add:Nn \l__scripture_outer_itemindent_dim \itemindent }
       { \dim_zero:N \l__scripture_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
+    \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \dim_zero:N \labelsep
@@ -2644,6 +2760,8 @@
     \legacy_if_set_false:n { @noparlist }
     \endlist
     \bool_gset_true:N \g__scripture_suppress_next_pilcrow_bool
+    \hook_gput_next_code:nn { para / begin }
+      { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
   }
 \hook_new:n { scripture / poetry / para / after }
 \bool_new:N \g__scripture_poetry_end_bool
@@ -2697,11 +2815,8 @@
 \cs_new_protected:Nn \__scripture_poetry_chap:n
   {
     \__scripture_drop_chap_set_up:n { #1 }
-     \hook_gput_next_code:nn { para / after }
-       {
-         \hook_gput_next_code:nn { para / after }
-           { \int_gzero:N \g__scripture_chap_par_prevgraf_int }
-       }
+    \int_gset_eq:NN \g__scripture_current_group_level_c_int \currentgrouplevel
+    \__scripture_zero_chap_par_prevgraf_at_group_level:
     \cs_if_eq:NNTF \vs \__scripture_poetry_mode_vertical_verse:n
       {
         \dim_zero:N \l__scripture_poetry_chap_indent_dim
@@ -2842,9 +2957,9 @@
             \group_end:
             \skip_horizontal:N \l__scripture_chap_sep_tl
             \hook_use:n { scripture / chap / after }
+            \bool_lazy_or:nnT \l__scripture_chap_show_verse_bool \l__scripture_poetry_midparachap_show_verse_bool
+              { \__scripture_verse_output:n { 1 } }
           }
-        \bool_lazy_or:nnT \l__scripture_chap_show_verse_bool \l__scripture_poetry_midparachap_show_verse_bool
-          { \__scripture_verse_output:n { 1 } }
       }
       {
         \hook_use:n { scripture / chap / before }
@@ -2886,6 +3001,7 @@
     \group_end:
     \bool_if:NF \g__scripture_suppress_next_pilcrow_bool
       { \hook_use:n { scripture / poetry / pilcrow } }
+    \cs_set_eq:NN \vs \__scripture_verse_output:n
   }
 \cs_new_protected:Nn \__scripture_poetry_mode_horizontal_verse:n
   {
@@ -2901,6 +3017,7 @@
         \skip_horizontal:N \listparindent
       }
     \group_end:
+    \cs_set_eq:NN \vs \__scripture_verse_output:n
   }
 \cs_new_protected:Nn \__scripture_poetry_par:
   {
@@ -2942,6 +3059,12 @@
                 \__scripture_poetry_par:
                 \peek_analysis_map_break:n { ##1 }
               }
+            { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newch }
+              {
+                \bool_set_eq:NN \l__scripture_poetry_midparachap_show_verse_bool \l__scripture_midparachap_show_verse_bool
+                \__scripture_poetry_par:
+                \peek_analysis_map_break:n { ##1 }
+              }
             { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \end }
               { \peek_analysis_map_break:n { ##1 } }
             { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \extraskip }
@@ -2963,6 +3086,13 @@
                   { \noindent }
                 \peek_analysis_map_break:n { ##1 }
               }
+            { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \newvs }
+              {
+                \__scripture_poetry_par:
+                \cs_if_eq:NNT \vs \__scripture_poetry_mode_vertical_verse:n
+                  { \noindent }
+                \peek_analysis_map_break:n { ##1 }
+              }
             { \exp_args:No \token_if_eq_meaning_p:NN { ##1 } \__scripture_obeylines_eol: }
               { \cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n }
           }
@@ -2970,6 +3100,7 @@
             \__scripture_poetry_par:
             \cs_if_eq:NNT \vs \__scripture_poetry_mode_vertical_verse:n
               { \noindent }
+            \cs_set_eq:NN \vs \__scripture_verse_output:n
             \bool_if:NT \l__scripture_verse_para_bool
               {
                 \__scripture_pilcrow_output:
@@ -3009,6 +3140,7 @@
       { \dim_zero:N \l__scripture_outer_itemindent_dim }
     \cs_set_eq:NN \par \para_end:
     \cs_set_eq:NN \noindent \tex_noindent:D
+    \hook_gclear_next_code:n { para / before }
     \hook_gput_next_code:nn { scripture / poetry / pilcrow }
       {
         \__scripture_pilcrow_output:
@@ -3015,6 +3147,7 @@
         \bool_set_false:N \l__scripture_pilcrow_bool
         \bool_set_false:N \l__scripture_verse_para_bool
       }
+    \int_gset_eq:NN \g__scripture_current_group_level_b_int \currentgrouplevel
     \list { }
       {
         \bool_lazy_or:nnF
@@ -3054,7 +3187,10 @@
     \hook_gclear_next_code:n { scripture / poetry / pilcrow }
     \bool_gset_true:N \g__scripture_poetry_end_bool
     \hook_gput_next_code:nn { para / begin }
-      { \bool_gset_false:N \g__scripture_poetry_end_bool }
+      {
+        \bool_gset_false:N \g__scripture_poetry_end_bool
+        \parshape 1 ~ \@totalleftmargin ~ \linewidth
+      }
   }
 \cs_set_nopar:Npn \scripturecurrentchapter { }
 \cs_set_nopar:Npn \scripturecurrentverse { }



More information about the tex-live-commits mailing list.