From 6bc0bc2fb3f405ad4609a9be2992374c57bf0328 Mon Sep 17 00:00:00 2001 From: Jeff Godin Date: Mon, 29 Aug 2016 12:58:27 -0400 Subject: [PATCH] LP#1618136 Fix webstaff IDL2js.js test failures Fix webstaff test failures due to an invalid IDL2js.js file by adding newly-required preprocessing to the support script that generates that file when running tests. Signed-off-by: Jeff Godin Signed-off-by: Ben Shum Signed-off-by: Dan Wells --- .../web/js/ui/default/staff/test/data/idl2js.pl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/staff/test/data/idl2js.pl b/Open-ILS/web/js/ui/default/staff/test/data/idl2js.pl index 66fb2e150d..4301f318c6 100644 --- a/Open-ILS/web/js/ui/default/staff/test/data/idl2js.pl +++ b/Open-ILS/web/js/ui/default/staff/test/data/idl2js.pl @@ -9,7 +9,8 @@ my $xsl_file = '../../../../../../../xsl/fm_IDL2js.xsl'; my $xslt = XML::LibXSLT->new(); my $style_doc = XML::LibXML->load_xml(location => $xsl_file, no_cdata=>1); my $stylesheet = $xslt->parse_stylesheet($style_doc); -my $idl_doc = XML::LibXML->load_xml(location => $idl_file); +my $idl_string = preprocess_idl_file($idl_file); +my $idl_doc = XML::LibXML->load_xml(string => $idl_string); my $results = $stylesheet->transform($idl_doc); my $output = $stylesheet->output_as_bytes($results); @@ -20,3 +21,16 @@ print IDL $output; close(IDL); +sub preprocess_idl_file { + my $file = shift; + open my $idl_fh, '<', $file or die "Unable to open IDL file $file : $!\n"; + local $/ = undef; + my $xml = <$idl_fh>; + close($idl_fh); + # These substitutions are taken from OpenILS::WWW::IDL2js + $xml =~ s///sg; # filter out XML comments ... + $xml =~ s/(?:^|\s+)--.*$//mg; # and SQL comments ... + $xml =~ s/^\s+/ /mg; # and extra leading spaces ... + $xml =~ s/\R*//g; # and newlines + return $xml; +} -- 2.43.2