Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Created a second test file and added file writing

  • Loading branch information...
commit 6c0bd759a5806c93849f097ebb0f108a2ba1aad0 1 parent 8300dd5
@liquidise authored
Showing with 8 additions and 6 deletions.
  1. +3 −0  README.md
  2. +5 −6 isCSS.py
View
3  README.md
@@ -7,6 +7,9 @@ isCSS (inline style CSS) is a parser and compiler that parses inline styles in a
The HTML file is edited to replace all inline styles with their new CSS classes
+Usage
+-----
+
Dependancies
------------
* BeautifulSoup
View
11 isCSS.py
@@ -19,11 +19,9 @@ def printCSS( name, styles ):
args.add_argument( "--html", required = True )
args.add_argument( "--css", required = False )
-htmlPath = args.parse_args().html
-cssPath = args.parse_args().css
-
-htmlF = open( htmlPath, "r+" )
+htmlF = open( args.parse_args().html, "r+" )
+cssPath = args.parse_args().css
if cssPath:
cssF = open( cssPath, "r+" )
@@ -44,11 +42,12 @@ def printCSS( name, styles ):
count += 1
if "class" in element:
- element['class'] += newClassName
+ print element['class']
+ element['class'] += " " + newClassName
else:
element['class'] = newClassName
printCSS( newClassName, styles )
del element['style']
-print soup
+htmlF.write( str(soup) )
Please sign in to comment.
Something went wrong with that request. Please try again.