Skip to content

Commit

Permalink
Merge branch 'release/0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rspivak committed May 2, 2011
2 parents e4558a5 + 3987445 commit 8025dc3
Show file tree
Hide file tree
Showing 15 changed files with 626 additions and 904 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -0,0 +1 @@
include README.rst
4 changes: 0 additions & 4 deletions README.org

This file was deleted.

54 changes: 54 additions & 0 deletions README.rst
@@ -0,0 +1,54 @@
Welcome to SlimIt
==================================

`SlimIt` is a JavaScript minifier written in Python.
It compiles JavaScript into more compact code so that it downloads
and runs faster.

At version `0.1` it provides only a JavaScript lexer.

Using lexer in your project
---------------------------

>>> from slimit.lexer import Lexer
>>> lexer = Lexer()
>>> lexer.input('a = 1;')
>>> for token in lexer:
... print token
...
LexToken(ID,'a',1,0)
LexToken(EQ,'=',1,2)
LexToken(NUMBER,'1',1,4)
LexToken(SEMI,';',1,5)

You can get one token at a time using ``token`` method:

>>> lexer.input('a = 1;')
>>> while True:
... token = lexer.token()
... if not token:
... break
... print token
...
LexToken(ID,'a',1,0)
LexToken(EQ,'=',1,2)
LexToken(NUMBER,'1',1,4)
LexToken(SEMI,';',1,5)

`LexToken` instance has different attributes:

>>> lexer.input('a = 1;')
>>> token = lexer.token()
>>> token.type, token.value, token.lineno, token.lexpos
('ID', 'a', 1, 0)

Installation
------------

Using ``pip``::

$ sudo pip install slimit

Using ``easy_install``::

$ sudo easy_install slimit
18 changes: 12 additions & 6 deletions buildout.cfg
@@ -1,7 +1,10 @@
[buildout]
# extensions = buildout.dumppickedversions
# dump-picked-versions-file = versions.cfg
extends = versions.cfg
newest = false
include-site-packages = false
exec-sitecustomize = false
versions = versions
# allow-picked-versions = false
parts =
console-scripts
test
Expand All @@ -10,14 +13,12 @@ parts =
pylint-bin
pylint
ipython
sphinxbuilder
develop =
.
eggs =
slimit
# allow-picked-versions = false
include-site-packages = false
exec-sitecustomize = false
versions = versions


[console-scripts]
recipe = z3c.recipe.scripts
Expand All @@ -27,6 +28,11 @@ eggs =
${buildout:eggs}
interpreter=python

[sphinxbuilder]
recipe = collective.recipe.sphinxbuilder
source = ${buildout:directory}/docs-source
build = ${buildout:directory}/docs

[ipython]
recipe = z3c.recipe.scripts
eggs =
Expand Down
Binary file added docs-source/_static/slimit-small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs-source/_templates/sidebarintro.html
@@ -0,0 +1,9 @@
<h3>About SlimIt</h3>
<p>
SlimIt is a JavaScript minifier.
</p>
<h3>Useful Links</h3>
<ul>
<li><a href="http://pypi.python.org/pypi/slimit">SlimIt @ PyPI</a></li>
<li><a href="http://github.com/rspivak/slimit">SlimIt @ GitHub</a></li>
</ul>
3 changes: 3 additions & 0 deletions docs-source/_templates/sidebarlogo.html
@@ -0,0 +1,3 @@
<p class="logo"><a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/slimit-small.png', 1) }}" alt="Logo"/>
</a></p>
250 changes: 250 additions & 0 deletions docs-source/_theme/nature/static/nature.css_t
@@ -0,0 +1,250 @@
/*
* nature.css_t
* ~~~~~~~~~~~~
*
* Sphinx stylesheet -- nature theme.
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/

@import url("basic.css");

/* -- page layout ----------------------------------------------------------- */

body {
font-family: Arial, sans-serif;
font-size: 100%;
background-color: #111;
color: #555;
margin: 0;
padding: 0;
}

div.documentwrapper {
float: left;
width: 100%;
}

div.bodywrapper {
margin: 0 0 0 230px;
}

hr {
border: 1px solid #B1B4B6;
}

div.document {
background-color: #fafafa;
}

div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 30px 30px;
font-size: 17px;
}

div.footer {
color: #555;
width: 100%;
padding: 13px 0;
text-align: center;
font-size: 75%;
}

div.footer a {
color: #444;
text-decoration: underline;
}

div.related {
background-color: #6BA81E;
line-height: 32px;
color: #fff;
font-size: 0.9em;
}

div.related a {
color: #E2F3CC;
}

div.sphinxsidebar {
font-size: 15px;
line-height: 1.5em;
}

div.sphinxsidebarwrapper{
padding: 20px 0;
}

div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: Arial, sans-serif;
color: #222;
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 5px 10px;
background-color: #ddd;
}

div.sphinxsidebar h4{
font-size: 1.1em;
}

div.sphinxsidebar h3 a {
color: #444;
}


div.sphinxsidebar p {
color: #888;
padding: 5px 20px;
}

div.sphinxsidebar p.topless {
}

div.sphinxsidebar ul {
margin: 10px 20px;
padding: 0;
color: #000;
}

div.sphinxsidebar a {
color: #444;
border-bottom: 1px dotted #999999;
text-decoration: none;
}

div.sphinxsidebar a:hover {
color: #444;
border-bottom: 1px solid #999999;
}


div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: sans-serif;
font-size: 1em;
}

div.sphinxsidebar input[type=text]{
margin-left: 20px;
}

/* -- body styles ----------------------------------------------------------- */

a {
color: #005B81;
text-decoration: none;
}

a:hover {
color: #E32E00;
text-decoration: underline;
}

div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: Arial, sans-serif;
border-bottom: 1px solid #C8D5E3;
font-weight: normal;
color: #212224;
margin: 30px 0px 10px 0px;
padding: 5px 0 5px 10px;
}

div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 240%; }
div.body h2 { font-size: 180%; background-color: #C8D5E3; }
div.body h3 { font-size: 150%; background-color: #D8DEE3; }
div.body h4 { font-size: 130%; background-color: #D8DEE3; }
div.body h5 { font-size: 100%; background-color: #D8DEE3; }
div.body h6 { font-size: 100%; background-color: #D8DEE3; }

a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}

a.headerlink:hover {
background-color: #c60f0f;
color: white;
}

div.body p, div.body dd, div.body li {
line-height: 1.5em;
}

div.admonition p.admonition-title + p {
display: inline;
}

div.highlight{
background-color: white;
}

div.note {
background-color: #eee;
border: 1px solid #ccc;
}

div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}

div.topic {
background-color: #eee;
}

div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}

p.admonition-title {
display: inline;
}

p.admonition-title:after {
content: ":";
}

pre {
padding: 10px;
background-color: White;
color: #222;
line-height: 1.2em;
border: 1px solid #C6C9CB;
font-size: 0.85em;
margin: 1.5em 0 1.5em 0;
-webkit-box-shadow: 1px 1px 1px #d8d8d8;
-moz-box-shadow: 1px 1px 1px #d8d8d8;
}

tt {
background-color: #ecf0f3;
color: #222;
/* padding: 1px 2px; */
font-size: 0.85em;
font-family: monospace;
}

.viewcode-back {
font-family: Arial, sans-serif;
}

div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}
4 changes: 4 additions & 0 deletions docs-source/_theme/nature/theme.conf
@@ -0,0 +1,4 @@
[theme]
inherit = basic
stylesheet = nature.css
pygments_style = tango

0 comments on commit 8025dc3

Please sign in to comment.