File tree Expand file tree Collapse file tree 6 files changed +20
-4
lines changed
Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 11# CSS parser
22
3- ![ Terminal screenshot demonstrating user experience with parsing software] ( https://github.com/jckdm/CSS-parser/blob/master/demo.png?raw=true )
3+ ![ Terminal screenshot demonstrating user experience with parsing software] ( https://github.com/jckdm/CSS-parser/blob/master/terminal-demo.png?raw=true )
4+
5+ ![ Screenshot of code editor showing result of using parsing software] ( https://github.com/jckdm/CSS-parser/blob/master/result.png?raw=true )
46
570 . prompts user for .css file(s)
681 . prompts user for .html file(s)
Original file line number Diff line number Diff line change @@ -81,3 +81,13 @@ def full(l):
8181 if '{' in l and '}' in l :
8282 return True
8383 return False
84+
85+ # update .css files to have full filepaths
86+ def updateFilePaths (filenames , d ):
87+ for html , css in d .items ():
88+ for cssFile in filenames :
89+ # filename == file
90+ if cssFile .split ('/' )[- 1 ] == d [html ]:
91+ # update with full filepath
92+ d [html ] = cssFile
93+ return d
Original file line number Diff line number Diff line change 1- from parser import parse_css , parse_html
1+ from parser import parse_css , parse_html
22from cleaner import clean
33from definer import define
4- from sys import exit
4+ from helper import updateFilePaths
5+ from sys import exit
56
67def main ():
78 # parse the files
@@ -71,6 +72,9 @@ def main():
7172 print (o )
7273 results += '\n ' + o
7374
75+ # update dict with full css filepaths
76+ fullFilePairs = updateFilePaths (fileNames , h [1 ])
77+
7478 # predefined in case file is already clean
7579 q , qq = 'no' , 'no'
7680 if not final :
@@ -90,7 +94,7 @@ def main():
9094 # may i define?
9195 qq = input ('May I add definitions for undefined rules? (yes/no): ' )
9296 if qq .lower () in ('yes' , 'y' ):
93- define (undefined , h [ 1 ] )
97+ define (undefined , fullFilePairs )
9498
9599 # no cleaning, but maybe a humble .txt file?
96100 if q .lower () in ('no' , 'n' ) and qq .lower () in ('no' , 'n' ):
You can’t perform that action at this time.
0 commit comments