diff options
Diffstat (limited to 'support/latexindent/LatexIndent/Verbatim.pm')
-rw-r--r-- | support/latexindent/LatexIndent/Verbatim.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/support/latexindent/LatexIndent/Verbatim.pm b/support/latexindent/LatexIndent/Verbatim.pm index 0bb41c5227..edff0698a8 100644 --- a/support/latexindent/LatexIndent/Verbatim.pm +++ b/support/latexindent/LatexIndent/Verbatim.pm @@ -332,6 +332,13 @@ sub find_verbatim_commands{ # output, if desired $logger->trace(Dumper($verbatimCommand),'ttrace') if($is_tt_switch_active); + # check for nested verbatim commands + if(${$verbatimCommand}{body} =~ m/($tokens{verbatimInline}\d+$tokens{endOfToken})/s){ + my $verbatimNestedID = $1; + my $verbatimBody = ${$verbatimStorage{$verbatimNestedID}}{begin}.${$verbatimStorage{$verbatimNestedID}}{body}.${$verbatimStorage{$verbatimNestedID}}{end}; + ${$verbatimCommand}{body} =~ s/$verbatimNestedID/$verbatimBody/s; + delete $verbatimStorage{$verbatimNestedID}; + } # verbatim children go in special hash $verbatimStorage{${$verbatimCommand}{id}}=$verbatimCommand; @@ -534,7 +541,7 @@ sub create_unique_id{ my $self = shift; $verbatimCounter++; - ${$self}{id} = "$tokens{verbatim}$verbatimCounter$tokens{endOfToken}"; + ${$self}{id} = (${$self}{type} eq 'command' ? $tokens{verbatimInline} : $tokens{verbatim}).$verbatimCounter.$tokens{endOfToken}; return; } |