Skip Menu |

This queue is for tickets about the JavaScript-Beautifier CPAN distribution.

Report information
The Basics
Id: 124828
Status: resolved
Priority: 0/
Queue: JavaScript-Beautifier

People
Owner: Nobody in particular
Requestors: eleonora45 [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Beautifier.pm
Date: Mon, 19 Mar 2018 22:22:46 +0100
To: bug-JavaScript-Beautifier [...] rt.cpan.org
From: "eleonora45 [...] gmx.net" <eleonora45 [...] gmx.net>
Hello, Double backslashes will be erroneously cut now. http://jsbeautifier.org/ does not show this error of course. For example, a line: "{return'\\w+'};"; Will be erroneously translated to: "{return '\w+'};"; To avoid this, code has to be modified as follows: Old code (line 26, ...): sub js_beautify {     my ( $js_source_code, $opts ) = @_;     $opt_indent_size = $opts->{indent_size} || 4; New code (line 26, ...): sub js_beautify {     my ( $js_source_code, $opts ) = @_;     $js_source_code =~ s/\\/\\\\/g;  # prevent \\ -> \  tktk     $opt_indent_size = $opts->{indent_size} || 4; I tested the modification, and it works properly. Thank you for the correction in advance.
it breaks the tests as I tried. https://github.com/fayland/perl-javascript-beautifier if possible, please fork and submit PR. Thanks
Subject: Re: [rt.cpan.org #124828] Beautifier.pm
Date: Tue, 20 Mar 2018 17:44:34 +0100
To: bug-JavaScript-Beautifier [...] rt.cpan.org
From: "eleonora45 [...] gmx.net" <eleonora45 [...] gmx.net>
Hi, It breaks regexp tests, because these expected wrong results. 01-javascript-beauty.t has to be modified from: # regexps bt( 'a(/abc\\/\\/def/);b()', "a(/abc\\/\\/def/);\nb()" ); bt( 'a(/a[b\\[\\]c]d/);b()', "a(/a[b\\[\\]c]d/);\nb()" ); test_beautifier('a(/a[b\\[', "a(/a[b\\["); # incomplete char class to: # regexps bt( 'a(/abc\\/\\/def/);b()', "a(/abc\\\\/\\\\ / def / );\nb()" ); bt( 'a(/a[b\\[\\]c]d/);b()', "a(/a[b\\\\[\\\\]c]d/);\nb()" ); test_beautifier('a(/a[b\\[', "a(/a[b\\\\["); # incomplete char class I checked with jsbeautifier.org, attached the check results. Thank you. 2018-03-20 01:24 keltezéssel, Fayland Lin via RT írta: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=124828 > > > it breaks the tests as I tried. > > https://github.com/fayland/perl-javascript-beautifier > > if possible, please fork and submit PR. > > Thanks

Message body is not shown because sender requested not to inline it.

you're right. it's applied and new version is uploaded to PAUSE. Thanks