From 3a7feaeb3a92238cf08d3e1c486ad1b8fd4ca9f4 Mon Sep 17 00:00:00 2001 From: ndparker Date: Tue, 4 Feb 2014 22:18:39 +0100 Subject: [PATCH] Optionally keep /*! comments */ - jsmin() grew a new parameter: keep_bang_comments, defaulting to False - added command line options: -b keep bang comments -p force python-only implementation --- README.rst | 37 ++++--- docs/CHANGES | 14 +++ docs/DESCRIPTION | 3 +- docs/_userdoc/conf.py | 2 +- docs/_userdoc/index.txt | 59 ++++++----- package.cfg | 4 +- rjsmin.c | 76 ++++++++++---- rjsmin.py | 212 ++++++++++++++++++++++++++++++---------- 8 files changed, 295 insertions(+), 112 deletions(-) diff --git a/README.rst b/README.rst index 38b12aa..a28911d 100644 --- a/README.rst +++ b/README.rst @@ -36,6 +36,7 @@ same results as the original ``jsmin.c``. It differs in the following ways: - "return /regex/" is recognized correctly. - "+ +" and "- -" sequences are not collapsed to '++' or '--' - Newlines before ! operators are removed more sensibly +- Comments starting with an exclamation mark (``!``) can be kept optionally - rJSmin does not handle streams, but only complete strings. (However, the module provides a "streamy" interface). @@ -55,7 +56,7 @@ rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more. COPYRIGHT AND LICENSE --------------------- -Copyright 2011 - 2013 +Copyright 2011 - 2014 André Malo or his licensors, as applicable. The whole package (except for the files in the bench/ directory) @@ -73,26 +74,29 @@ Both python 2 (>=2.4) and python 3 are supported. INSTALLATION ------------ -rJSmin is set up using the standard python distutils. So you can install -it using the usual command: +Using pip +~~~~~~~~~ + +$ pip install rjsmin + + +Using distutils +~~~~~~~~~~~~~~~ $ python setup.py install -The command above will install rJSmin into python's library path. - -Additionally it will install the documentation. On unices it will be -installed by default into /share/doc/rjsmin. - -For customization options please study the output of - -$ python setup.py --help - -Especially the following options may be interesting for you: +The following extra options to the install command may be of interest: --without-c-extensions Don't install C extensions --without-docs Do not install documentation files -Alternatively just copy rjsmin.py into your project and use it. + +Drop-in +~~~~~~~ + +rJSmin effectively consists of two files: rjsmin.py and rjsmin.c, the +latter being entirely optional. So, for simple integration you can just +copy rjsmin.py into your project and use it. DOCUMENTATION @@ -108,6 +112,11 @@ jsmin.c provides: $ python -mrjsmin