Permalink
Browse files

fix for sorting mixed types

  • Loading branch information...
1 parent 1ede34e commit f27fdf750151661bf234c7f1adfea71c83f9e41f @peterbe committed Jan 18, 2014
Showing with 26 additions and 27 deletions.
  1. +4 −4 README.rst
  2. +21 −22 example/run_mincss
  3. +1 −1 mincss/processor.py
View
@@ -1,14 +1,14 @@
mincss
======
-.. image:: https://travis-ci.org/myint/mincss.png?branch=master
- :target: https://travis-ci.org/myint/mincss
+.. image:: https://travis-ci.org/peterbe/mincss.png?branch=master
+ :target: https://travis-ci.org/peterbe/mincss
:alt: Build status
Clears the junk out of your CSS by finding out which selectors are
actually not used in your HTML.
-By Peter Bengtsson, 2012-2013
+By Peter Bengtsson, 2012-2014
Example
-------
@@ -23,7 +23,7 @@ Installation
From pip::
- $ pip install --upgrade git+https://github.com/myint/mincss
+ $ pip install --upgrade git+https://github.com/peterbe/mincss
Why?
----
View
@@ -1,5 +1,6 @@
#!/usr/bin/env python
-
+import sys,os
+sys.path.insert(0, os.path.abspath('.'))
from mincss.processor import Processor
@@ -9,29 +10,27 @@ def run():
p = Processor()
p.process(URL)
- print "INLINES ".ljust(79, '-')
+ print("INLINES ".ljust(79, '-'))
for each in p.inlines:
- print ("On line %s" % each.line)
- print '- ' * 40
- print "BEFORE"
- print each.before
- print '- ' * 40
- print "AFTER:"
- print each.after
- print
- print
-
- print "LINKS ".ljust(79, '-')
+ print("On line %s" % each.line)
+ print('- ' * 40)
+ print("BEFORE")
+ print(each.before)
+ print('- ' * 40)
+ print("AFTER:")
+ print(each.after)
+ print("\n")
+
+ print("LINKS ".ljust(79, '-'))
for each in p.links:
- print ("On href %s" % each.href)
- print '- ' * 40
- print "BEFORE"
- print each.before
- print '- ' * 40
- print "AFTER:"
- print each.after
- print
- print
+ print("On href %s" % each.href)
+ print('- ' * 40)
+ print("BEFORE")
+ print(each.before)
+ print('- ' * 40)
+ print("AFTER:")
+ print(each.after)
+ print("\n")
if __name__ == '__main__':
View
@@ -132,7 +132,7 @@ def process(self, *urls):
for url in urls:
self.process_url(url)
- for identifier in sorted(self.blocks.keys()):
+ for identifier in sorted(self.blocks.keys(), key=lambda x: str(x[0])):
content = self.blocks[identifier]
processed = self._process_content(content, self._bodies)

0 comments on commit f27fdf7

Please sign in to comment.