diff options
Diffstat (limited to 'support/latexindent/LatexIndent/Preamble.pm')
-rw-r--r-- | support/latexindent/LatexIndent/Preamble.pm | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/support/latexindent/LatexIndent/Preamble.pm b/support/latexindent/LatexIndent/Preamble.pm index bade8d42d1..7f835e6d0d 100644 --- a/support/latexindent/LatexIndent/Preamble.pm +++ b/support/latexindent/LatexIndent/Preamble.pm @@ -1,4 +1,5 @@ package LatexIndent::Preamble; + # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -23,10 +24,10 @@ use LatexIndent::LogFile qw/$logger/; use LatexIndent::Environment qw/$environmentBasicRegExp/; use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/; use LatexIndent::Special qw/$specialBeginBasicRegExp/; -our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321 +our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321 our $preambleCounter; -sub create_unique_id{ +sub create_unique_id { my $self = shift; $preambleCounter++; @@ -34,21 +35,22 @@ sub create_unique_id{ return; } -sub get_replacement_text{ +sub get_replacement_text { my $self = shift; # the replacement text for preamble needs to put the \\begin{document} back in $logger->trace("Custom replacement text routine for preamble ${$self}{name}") if $is_t_switch_active; - ${$self}{replacementText} = ${$self}{id}.${$self}{afterbit}; + ${$self}{replacementText} = ${$self}{id} . ${$self}{afterbit}; delete ${$self}{afterbit}; } -sub indent{ +sub indent { + # preamble doesn't receive any additional indentation return; } -sub tasks_particular_to_each_object{ +sub tasks_particular_to_each_object { my $self = shift; # search for environments @@ -57,15 +59,17 @@ sub tasks_particular_to_each_object{ # search for ifElseFi blocks $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s; - if(${$mainSettings{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(!$mainSettings{preambleCommandsBeforeEnvironments}); - } else { + $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(!$mainSettings{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; |