diff options
author | Karl Berry <karl@freefriends.org> | 2017-08-22 21:26:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-08-22 21:26:11 +0000 |
commit | e231f2be95092edeb9fdef8644d3703c56656433 (patch) | |
tree | 35170ff1259e003c847a2953bbd4a316ef36f8de /Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm | |
parent | 5b86a262bc6cd64f5fb9f93028dc3e2762361822 (diff) |
latexindent (22aug17)
git-svn-id: svn://tug.org/texlive/trunk@45098 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm')
-rw-r--r-- | Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm index 569cead9584..9643bf11375 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm @@ -142,19 +142,23 @@ sub find_opt_mand_arguments{ my $BodyValue = (defined ${$self}{BodyStartsOnOwnLine}) ? ${$self}{BodyStartsOnOwnLine} : "0"; $self->logger("$BodyStringLogFile = $BodyValue (in ${$self}{name}), but first argument *should* begin on its own line (see $BeginStringLogFile)") if $is_t_switch_active; - # possibly add a comment at the end of the begin statement - my $trailingCommentToken = q(); + # possibly add a comment or a blank line, depending on if BeginStartsOnOwnLine == 2 or 3 respectively + # at the end of the begin statement + my $trailingCharacterToken = q(); if(${${${$arguments}{children}}[0]}{BeginStartsOnOwnLine}==1){ $self->logger("Adding line breaks at the end of ${$self}{begin} (first argument, see $BeginStringLogFile == ${${${$arguments}{children}}[0]}{BeginStartsOnOwnLine})") if $is_t_switch_active; } elsif(${${${$arguments}{children}}[0]}{BeginStartsOnOwnLine}==2){ $self->logger("Adding a % at the end of begin, ${$self}{begin} followed by a linebreak ($BeginStringLogFile == 2)") if $is_t_switch_active; - $trailingCommentToken = "%".$self->add_comment_symbol; + $trailingCharacterToken = "%".$self->add_comment_symbol; $self->logger("Removing trailing space on ${$self}{begin}") if $is_t_switch_active; ${$self}{begin} =~ s/\h*$//s; + } elsif (${${${$arguments}{children}}[0]}{BeginStartsOnOwnLine}==3) { + $self->logger("Adding a blank line immediately ${$self}{begin} ($BeginStringLogFile==3)") if $is_t_switch_active; + $trailingCharacterToken = "\n".(${$masterSettings{modifyLineBreaks}}{preserveBlankLines}?$tokens{blanklines}:q()); } # modification - ${$self}{begin} .= "$trailingCommentToken\n"; + ${$self}{begin} .= "$trailingCharacterToken\n"; ${$self}{linebreaksAtEnd}{begin} = 1; } } |