diff options
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm')
-rw-r--r-- | Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm index a31efd1a49e..eab45a10d9a 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm @@ -18,7 +18,7 @@ use strict; use warnings; use LatexIndent::Tokens qw/%tokens/; use LatexIndent::Switches qw/$is_t_switch_active $is_m_switch_active/; -use LatexIndent::GetYamlSettings qw/%masterSettings/; +use LatexIndent::GetYamlSettings qw/%mainSettings/; use LatexIndent::LogFile qw/$logger/; use LatexIndent::Environment qw/$environmentBasicRegExp/; use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/; @@ -51,36 +51,51 @@ sub indent{ sub tasks_particular_to_each_object{ my $self = shift; + # text wrapping, remove paragraph line breaks + if ($is_m_switch_active){ + $self->yaml_get_textwrap_removeparagraphline_breaks; + } + + # option to textWrap beforeFindingChildCodeBlocks + if( $is_m_switch_active and ${$mainSettings{modifyLineBreaks}{textWrapOptions}}{beforeFindingChildCodeBlocks} == 1){ + # call the remove_paragraph_line_breaks and text_wrap routines + if(${$mainSettings{modifyLineBreaks}{removeParagraphLineBreaks}}{beforeTextWrap}){ + $self->remove_paragraph_line_breaks if ${$self}{removeParagraphLineBreaks}; + $self->text_wrap if (${$self}{textWrapOptions} and ${$mainSettings{modifyLineBreaks}{textWrapOptions}}{perCodeBlockBasis}); + } else { + $self->text_wrap if (${$self}{textWrapOptions} and ${$mainSettings{modifyLineBreaks}{textWrapOptions}}{perCodeBlockBasis}); + $self->remove_paragraph_line_breaks if ${$self}{removeParagraphLineBreaks}; + } + } + # search for environments $self->find_environments if ${$self}{body} =~ m/$environmentBasicRegExp/; # search for ifElseFi blocks $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s; - if(${$masterSettings{specialBeginEnd}}{specialBeforeCommand}){ + if(${$mainSettings{specialBeginEnd}}{specialBeforeCommand}){ # search for special begin/end $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s; # search for commands with arguments - $self->find_commands_or_key_equals_values_braces if(!$masterSettings{preambleCommandsBeforeEnvironments}); + $self->find_commands_or_key_equals_values_braces if(!$mainSettings{preambleCommandsBeforeEnvironments}); } else { # search for commands with arguments - $self->find_commands_or_key_equals_values_braces if(!$masterSettings{preambleCommandsBeforeEnvironments}); + $self->find_commands_or_key_equals_values_braces if(!$mainSettings{preambleCommandsBeforeEnvironments}); # search for special begin/end $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s; } # text wrapping, remove paragraph line breaks - if ($is_m_switch_active){ - $self->yaml_get_textwrap_removeparagraphline_breaks; - + if ($is_m_switch_active and ${$mainSettings{modifyLineBreaks}{textWrapOptions}}{beforeFindingChildCodeBlocks} == 0){ # call the remove_paragraph_line_breaks and text_wrap routines - if(${$masterSettings{modifyLineBreaks}{removeParagraphLineBreaks}}{beforeTextWrap}){ + if(${$mainSettings{modifyLineBreaks}{removeParagraphLineBreaks}}{beforeTextWrap}){ $self->remove_paragraph_line_breaks if ${$self}{removeParagraphLineBreaks}; - $self->text_wrap if (${$self}{textWrapOptions} and ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{perCodeBlockBasis}); + $self->text_wrap if (${$self}{textWrapOptions} and ${$mainSettings{modifyLineBreaks}{textWrapOptions}}{perCodeBlockBasis}); } else { - $self->text_wrap if (${$self}{textWrapOptions} and ${$masterSettings{modifyLineBreaks}{textWrapOptions}}{perCodeBlockBasis}); + $self->text_wrap if (${$self}{textWrapOptions} and ${$mainSettings{modifyLineBreaks}{textWrapOptions}}{perCodeBlockBasis}); $self->remove_paragraph_line_breaks if ${$self}{removeParagraphLineBreaks}; } } |