Commits

Tikitu de Jager  committed 13c9fde Merge

Merge released version from default

  • Participants
  • Parent commits 41678d3, 2076db5
  • Branches stable
  • Tags release-2.0.8

Comments (0)

Files changed (5)

+=====
+jsmin
+=====
+
+JavaScript minifier.
+
+Usage
+=====
+
+.. code:: python
+
+ from jsmin import jsmin
+ with open('myfile.js') as js_file:
+     minified = jsmin(js_file.read())
+
+You can run it as a commandline tool also::
+
+  python -m jsmin myfile.js
+
+Where to get it
+===============
+
+* install the package `from pypi <https://pypi.python.org/pypi/jsmin/>`_
+* get the latest release `from the stable branch on bitbucket <https://bitbucket.org/dcs/jsmin/branch/stable>`_
+* get the development version `from the default branch on bitbucket <https://bitbucket.org/dcs/jsmin/branch/default>`_
+
+Contributing
+============
+
+`Issues <https://bitbucket.org/dcs/jsmin/issues>`_ and `Pull requests <https://bitbucket.org/dcs/jsmin/pull-requests>`_
+will be gratefully received on Bitbucket. Pull requests on github are great too, but the issue tracker lives on
+bitbucket.
+
+If possible, please make separate pull requests for tests and for code: tests will be committed on the stable branch
+(which tracks the latest released version) while code will go to default by, erm, default.
+
+Unless you request otherwise, your Bitbucket identity will be added to the contributor's list below; if you prefer a
+different name feel free to add it in your pull request instead. (If you prefer not to be mentioned you'll have to let
+the maintainer know somehow.)
+
+Build/test status
+=================
+
+Both default and stable branches are tested with Travis: https://travis-ci.org/tikitu/jsmin
+
+Stable (latest released version plus any new tests) is tested against CPython 2.6, 2.7, 3.2, and 3.3.
+Currently:
+
+.. image:: https://travis-ci.org/tikitu/jsmin.png?branch=ghstable
+
+If stable is failing that means there's a new test that fails on *the latest released version on pypi*, with no fix yet
+released.
+
+Default (development version, might be ahead of latest released version) is tested against CPython 2.6, 2.7, 3.2, and
+3.3. Currently:
+
+.. image:: https://travis-ci.org/tikitu/jsmin.png?branch=master
+
+If default is failing don't use it, but as long as stable is passing the pypi release should be ok.
+
+Contributors (chronological commit order)
+=========================================
+
+* `Dave St.Germain <https://bitbucket.org/dcs>`_ (original author)
+* `Hans weltar <https://bitbucket.org/hansweltar>`_
+* `Tikitu de Jager <mailto:tikitu+jsmin@logophile.org>`_ (current maintainer)
+* https://bitbucket.org/rennat

File README.txt

-=====
-jsmin
-=====
-
-JavaScript minifier.
-
-Where to get it
-===============
-
-* install the package `from pypi <https://pypi.python.org/pypi/jsmin/>`_
-* get the latest release `from the stable branch on bitbucket <https://bitbucket.org/dcs/jsmin/branch/stable>`_
-* get the development version `from the default branch on bitbucket <https://bitbucket.org/dcs/jsmin/branch/default>`_
-
-Contributing
-============
-
-`Issues <https://bitbucket.org/dcs/jsmin/issues>`_ and `Pull requests <https://bitbucket.org/dcs/jsmin/pull-requests>`_
-will be gratefully received on Bitbucket.
-
-If possible, please make separate pull requests for tests and for code: tests will be committed on the stable branch
-(which tracks the latest released version) while code will go to default by, erm, default.
-
-By default your Bitbucket identity will be added to the contributor's list below; if you prefer a different name feel
-free to add it in your pull request instead. (If you prefer not to be mentioned you'll have to let the maintainer know
-somehow.)
-
-Build/test status
-=================
-
-Stable (latest released version plus any new tests) is tested against CPython 2.7.
-Currently:
-
-.. image:: https://jenkins.shiningpanda-ci.com/buzzcapture/job/jsmin-stable/badge/icon
-
-If stable is failing that means there's a new test that fails on *the latest released version on pypi*, with no fix yet
-released.
-
-Default (development version, might be ahead of latest released version) is tested against CPython 2.6, 2.7, 3.2 and
-3.3. Currently:
-
-.. image:: https://jenkins.shiningpanda-ci.com/buzzcapture/job/jsmin-dev/badge/icon
-
-If default is failing don't use it, but as long as stable is passing the pypi release is ok.
-
-Contributors (cronological commit order)
-========================================
-
-* `Dave St.Germain <https://bitbucket.org/dcs>`_ (original author)
-* `Hans weltar <https://bitbucket.org/hansweltar>`_
-* `Tikitu de Jager <mailto:tikitu+jsmin@logophile.org>`_ (current maintainer)
-* https://bitbucket.org/rennat

File jsmin/__init__.py

 
 
 __all__ = ['jsmin', 'JavascriptMinify']
-__version__ = '2.0.7'
+__version__ = '2.0.8'
 
 
 def jsmin(js):
                 last = next1.strip()
                 if not (doing_single_comment or doing_multi_comment)\
                     and last not in ('', '/'):
+                    if in_quote:
+                        write(''.join(quote_buf))
                     write(last)
                 break
             if doing_multi_comment:
                     or previous_non_space > '~') \
                     and (next2 in space_strings or next2 > '~'):
                     do_space = True
+                elif previous_non_space in '-+' and next2 == previous_non_space:
+                    # protect against + ++ or - -- sequences
+                    do_space = True
                 elif self.is_return and next2 == '/':
                     # returning a regex...
                     write(' ')

File jsmin/test.py

         expected = '"s"+ ++e+"s"'
         self.assertMinified(original, expected)
 
+    def test_no_final_newline(self):
+        original = '"s"'
+        expected = '"s"'
+        self.assertMinified(original, expected)
+
 if __name__ == '__main__':
     unittest.main()
     name="jsmin",
     version=re.search(r'__version__ = ["\']([^"\']+)', open('jsmin/__init__.py').read()).group(1),
     packages=['jsmin'],
-    description='JavaScript minifier.\nPLEASE UPDATE TO VERSION >= 2.0.6.  older versions have a serious bug related to comments.',
-    long_description=open('README.txt').read(),
+    description='JavaScript minifier.\nPLEASE UPDATE TO VERSION >= 2.0.6. Older versions have a serious bug related to comments.',
+    long_description=open('README.rst').read(),
     author='Dave St.Germain',
     author_email='dave@st.germa.in',
     maintainer='Tikitu de Jager',