summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
index c600d28e188..6b545c7e28d 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
@@ -41,6 +41,8 @@ sub text_wrap {
my $blocksFollow = q();
my $blocksFollowHash = \%{ ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{blocksFollow} };
+ my $headingsRegEx = q();
+
foreach my $blocksFollowEachPart ( sort keys %{$blocksFollowHash} ) {
last if ${$self}{modifyLineBreaksYamlName} eq 'sentence';
@@ -90,6 +92,9 @@ sub text_wrap {
#
$headingName = qr/\\$headingName\h*(?:\[[^]]*?\])?\h*\{[^}]*?\}\h*(?:\\label\{[^}]*?\})?/m;
+ # stored for possible use with 'after'
+ $headingsRegEx = $headingName . ( $headingsRegEx eq '' ? q() : "|$headingsRegEx" );
+
# put starred headings at the front of the regexp
if ( $headingName =~ m/\*/ ) {
$blocksFollowEachPart
@@ -332,8 +337,9 @@ sub text_wrap {
else {
my $thingToMeasure = ( split( /\R/, $textWrapBlockStorage[ $textWrapBlockCount - 1 ] ) )[-1];
$thingToMeasure =~ s/$tokens{blanklines}//;
- $thingToMeasure =~ s/$tokens{verbatim}//;
+ $thingToMeasure =~ s/$tokens{verbatim}\d+$tokens{endOfToken}//;
$thingToMeasure =~ s/$trailingCommentRegExp//;
+ $thingToMeasure =~ s/$headingsRegEx//;
$subsequentSpace = (
$textWrapBlockCount == 0