diff options
author | Karl Berry <karl@freefriends.org> | 2018-08-14 22:01:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-08-14 22:01:47 +0000 |
commit | a54d196b0fc4715e3d2dbcfe62cfccea6aae57fe (patch) | |
tree | 40ebe5b6f9da50b68cd6ae2546a9e32124cb46ed /Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm | |
parent | 2feb602ca10b928ee4cba97b3ae95a8ef6b853d4 (diff) |
latexindent (15aug18)
git-svn-id: svn://tug.org/texlive/trunk@48402 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 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm index 8c8b5af38f1..7c84a0e65f3 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Arguments.pm @@ -78,6 +78,14 @@ sub find_opt_mand_arguments{ # give unique id $arguments->create_unique_id; + + # text wrapping can make the ID split across lines + ${$arguments}{idRegExp} = ${$arguments}{id}; + + if($is_m_switch_active){ + my $IDwithLineBreaks = join("\\R?\\h*",split(//,${$arguments}{id})); + ${$arguments}{idRegExp} = qr/$IDwithLineBreaks/s; + } # determine which comes first, optional or mandatory if(${$arguments}{body} =~ m/.*?((?<!\\)\{|\[)/s){ @@ -98,6 +106,12 @@ sub find_opt_mand_arguments{ $arguments->find_optional_arguments; } + # it's possible not to have any mandatory or optional arguments, see + # https://github.com/cmhughes/latexindent.pl/issues/123 + if( !(defined ${$arguments}{children}) ){ + $logger->trace("No optional or mandatory arguments found; searching for matching round parenthesis") if $is_t_switch_active; + $arguments->find_round_brackets; + } } else { $logger->trace("Searching for round brackets ONLY") if $is_t_switch_active; # look for round brackets |