File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 4
4
"""
5
5
from __future__ import print_function
6
6
7
+ import re
7
8
import sys
8
9
9
10
import bs4
@@ -26,7 +27,18 @@ def main(argv):
26
27
html = bs4 .BeautifulSoup (response .text , 'html.parser' )
27
28
textarea = [ta for ta in html .find_all ('textarea' )
28
29
if ta .get ('name' ) != 'user_source' ][0 ]
29
- print (textarea .text )
30
+ minified = textarea .text
31
+
32
+ # fix minifier bugs:
33
+ # * semicolon before function declaration requires additional whitespace
34
+ # * ampersand (for background jobs) gets an erroneous semicolon
35
+ # at the end of a function
36
+ minified = re .sub (
37
+ r';(\w+)\(\)' , lambda m : '; %s()' % m .group (1 ), minified )
38
+ minified = minified .replace ('&;}' , '&}' )
39
+
40
+ print ("#!/bin/bash" )
41
+ print (minified )
30
42
31
43
32
44
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments