Окружающая среда не прерывается с концом страницы

Окружающая среда не прерывается с концом страницы
\documentclass{article}
\usepackage{lipsum}

\usepackage{titlesec}
\titleformat{\section}
  {\normalfont\scshape}
  {\thesection}
  {1em}
  {}
\titlespacing*{\section}
  {0pt}
  {2ex plus 1ex minus .2ex}
  {1ex plus .2ex}

\makeatletter
\newenvironment{myquote}[1]{%
  \small\par\addvspace{3ex}
  \if@nobreak
    % we're at the start of a section
    % add the indent
    \if@afterindent\else\hspace*{\parindent}\fi
    % and instruct LaTeX to reset \@afterheading at the end
    \def\reset@nobreakatend{\@afterheading}%
  \else
    \def\reset@nobreakatend{}%
  \fi
  \begin{minipage}{\dimexpr\linewidth -2\parindent\relax}%
    \def\myquoteauthorname{#1}%
  }{%
    \par\vspace{1ex}
    \noindent
    \hspace*{0.25\linewidth}%
      \rule{0.5\linewidth }{.4pt}
    \par\addvspace{1ex}
    \centering
    \textsc{\myquoteauthorname}\par\vspace{3ex}
  \end{minipage}
  \par\nobreak\reset@nobreakatend}
\makeatother

\begin{document}

\begin{myquote}{---test}
\lipsum[1-4]
\end{myquote}

\begin{myquote}{---test-2}
\lipsum[3-4]
\end{myquote}

\end{document}

введите описание изображения здесь

В приведенном выше MWE (код щедро предложенныйот @egreg) вторая myquoteсреда продолжает переполняться на той же странице вместо того, чтобы переходить на следующую страницу. Как можно отредактировать среду myquoteтак, чтобы она красиво прерывалась и продолжалась на следующей странице. (Возможно ли иметь опцию, что если она собирается прерываться, она должна начинаться со следующей страницы.)

Связанный контент