The desired formatting here is what the -wn flag would normally give. The
problem is that the opening and closing parens of all types of quotes in
perltidy
are treated as special quote delimiter characters and cannot be controlled
by the normal
controls for braces, parens and brackets.
The formatting will be the same if the quote delimiter characters are
parens, braces,
or even an exclamation mark for example.
So, unfortunately, the -wn flag does not work in this case. It would be
difficult to change this.
Incidentally, note that the first example uses a qq quote operator and the
second uses a qw quote. For the qq quote, any whitespace before the
terminal
quote delimiter is unchanged by perltidy, so since this character was
unindented
in the input file it remains unindented in the output file.
Steve
On Wed, Jan 31, 2018 at 5:41 PM, Justin Case via RT <
bug-Perl-Tidy@rt.cpan.org> wrote:
Show quoted text> Queue: Perl-Tidy
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=81852 >
>
> On Sun Dec 09 17:56:05 2012, parlay wrote:
> > This is the output format I want:
> >
> > DB->do(qq(
> > CREATE INDEX IF NOT EXISTS idx_account_user_payment
> > ON AccountPayment(user, payment);
> > ));
> >
> > This is what perltidy turns it into:
> >
> > DB->do(
> > qq(
> > CREATE INDEX IF NOT EXISTS idx_account_user_payment
> > ON AccountPayment(user, payment);
> > )
> > );
> >
> > I tried all the different stacking options, with no effect.
>
> I think this is the same bug I ran into. Original, and preferred format:
>
> my @morse = (
> [qw(
> .- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. ---
> .--. --.-
> .-. ... - ..- ...- .-- -..- -.-- --.. ----- .---- ..--- ...--
> ....-
> ..... -.... --... ---.. ----.
> )],
> [qw(
> ----- .---- ..--- ...-- ....- ..... -.... --... ---.. ----. .-
> -...
> -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.-
> .-. ...
> - ..- ...- .-- -..- -.-- --..
> )],
> );
>
> Results in the following:
>
> my @morse = ([ qw(
> .- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -.
> --- .--. --.-
> .-. ... - ..- ...- .-- -..- -.-- --.. ----- .---- ..---
> ...-- ....-
> ..... -.... --... ---.. ----.
> )
> ], [ qw(
> ----- .---- ..--- ...-- ....- ..... -.... --... ---..
> ----. .- -...
> -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--.
> --.- .-. ...
> - ..- ...- .-- -..- -.-- --..
> )
> ],
> );
>
> Using the following options:
>
> --continuation-indentation=4
> --paren-tightness=2
> --block-brace-tightness=1
> --nospace-for-semicolon
> --opening-token-right
> --stack-all-containers
> --stack-opening-block-brace
> --weld-nested-containers
>
>