From 69f0b4c0ee9bf4957db5222d7426423f377314c2 Mon Sep 17 00:00:00 2001 From: Alessandro Molina Date: Wed, 17 Aug 2016 00:53:48 +0200 Subject: [PATCH] More documentation --- README.rst | 12 ++++++++++++ dukpy/nodelike.py | 2 ++ 2 files changed, 14 insertions(+) diff --git a/README.rst b/README.rst index 8cda5af..379b38f 100644 --- a/README.rst +++ b/README.rst @@ -19,6 +19,7 @@ It comes with a bunch of common transpilers built-in for convenience: - *BabelJS* - *TypeScript* - *JSX* + - *LESS* Dukpy has been tested on **Python 2.7** and **Python 3.4**, dukpy is currently not production ready and might actually crash your @@ -138,6 +139,17 @@ DukPy provides a built-in compiler from JSX to React, this is available as >>> dukpy.jsx_compile('var react_hello =

Hello, world!

;') u'"use strict";\n\nvar react_hello = React.createElement(\n "h1",\n null,\n "Hello, world!"\n);' +Less Transpiling +---------------- + +DukPy provides a built-in distribution of the less compiler available +through `dukpy.less_compile`: + +.. code:: python + + >>> import dukpy + >>> dukpy.less_compile('.class { width: (1 + 1) }') + '.class {\n width: 2;\n}\n' Using the JavaScript Interpreter -------------------------------- diff --git a/dukpy/nodelike.py b/dukpy/nodelike.py index d769fa8..b8c53da 100644 --- a/dukpy/nodelike.py +++ b/dukpy/nodelike.py @@ -4,6 +4,7 @@ from .evaljs import JSInterpreter class NodeLikeInterpreter(JSInterpreter): + """A DukPy Interpreter that provides a minimal compatibility layer with NodeJS""" def __init__(self): super(NodeLikeInterpreter, self).__init__() self.loader.register_path(os.path.join(os.path.dirname(__file__), 'jscore')) @@ -12,6 +13,7 @@ class NodeLikeInterpreter(JSInterpreter): class FS: + """Provides oversimplified fs.js native functions.""" @classmethod def exists(cls, filepath): try: