{ "info": { "author": "Jonathan Sacramento", "author_email": "jmsmistral@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 3.6" ], "description": "# sassy\n\n[![Build Status](https://travis-ci.org/jmsmistral/sassy.svg?branch=master)](https://travis-ci.org/jmsmistral/sassy)\n\nA simple but powerful templating language for text interpolation inspired by sas macros.\n\n## How it works\n\n**Sassy** is a command-line program that **interpolates text** by interpreting a set of pre-defined **tags** that control text replacement, and loops, amongst other things.\n- A tag starts with a `%` and ends with a `;`.\n- Everything that is not a tag, or within open/close tags is interpreted as plaintext and is left untouched.\n\nBelow is a description of each tag, with examples.\n\n### Macros\n- Macros are named blocks of text enclosed within `%macro` and `%mend` tags, that are interpolated when executed. A macro can be executed at any point after it is defined\n\n- A macro looks a lot like a function, and must be given a name and a list of parameters within parentheses (empty for no parameters): `%macro (, ...);`\n\n- Macros are executed with the `%exec` tag, referencing the macro name, and passing the required parameters (if any)\n\n- When run, macros will interpolate parameters and tags within it's body, and output the resulting string\n\n- Macros currently accept a maximum number of 25 parameters\n\n***test.txt***\n``` \n%macro testMacro(param1);\n This text will show whenever the macro is called.\n We can reference macro parameters like this: ¶m1.\n%mend;\n\nHere's how you call a macro:\n%exec testMacro(1);\n\nHere's a call to the same macro with a different parameter:\n%exec testMacro(a parameter can contain spaces);\n```\n\nRunning `sassy test.txt` will generate the following... \n\n```\nHere's how you execute a macro:\n This text will be interpolated whenever the macro is executed.\n We can reference macro parameters like this: 1\n\nHere's a call to the same macro with a different parameter:\n This text will be interpolated whenever the macro is executed.\n We can reference macro parameters like this: a parameter can contain spaces\n```\n\n\n### Variables\n- Variables are named references to strings, which can be used within macros, and loop blocks\n\n- Variables are declared using the `%let` tag, as follows: `%let = ;`\n\n- The value is includes everything after the equal symbol `=`\n\n- Variables can be referenced by wrapping the variable name within `&` and `.`, e.g. `&.`\n\n- Macro parameters are referenced in the same way as variables, `&.`\n\n- Variables references can be nested (see example below)\n\n***test.txt***\n```\n%let var1 = some value;\n%let var2 = some other value;\n%let varNum =2;\n\n%macro testMacro(param1);\n Here's how you reference variables: &var1.\n Macro parameters are referenced in the same way as variables: ¶m1.\n Variables and parameters can be nested to dynamically compose references to other variables: &var&varNum..\n%mend;\n\nHere's what that looks like:\n%exec testMacro(1);\n\n%exec testMacro(2);\n```\n\nRunning `sassy test.txt` will generate the following... \n``` \nHere's what that looks like:\n Here's how you reference variables: some value\n Macro parameters are referenced in the same way as variables: 1\n Variables and parameters can be nested to dynamically compose references to other variables: some other value\n\n Here's how you reference variables: some value\n Macro parameters are referenced in the same way as variables: 2\n Variables and parameters can be nested to dynamically compose references to other variables: some other value\n```\n\n\n### Loops\n- Loops are blocks of text enclosed within `%procloop` and `%pend` tags, that are interpolated multiple times in succession\n\n- Unlike macros, loops do not have names and are interpolated in-place\n\n- A loop is declared as follows: `%procloop () ;`\n - `` - Defines the number of times the loop will execute. This can also be a reference to a variable\n - `` - Is a name given to the loop counter, that can be referenced within the loop body as a variable\n\n- The loop counter is zero-based\n\n\n***test.txt***\n```\nThis is how you execute a loop:\n%procloop (3) loopCounter;\n This loop will execute &loopCounter. times.\n%pend;\n\nYou can also use a variable to set the number of iterations:\n%let loopVar0 = first loop;\n%let loopVar1 = second loop;\n%let loopVar2 = third loop;\n%let loopVar3 = fourth loop;\n%let numLoops = 4;\n%procloop (&numLoops.) counterVar;\n This other loop will execute &counterVar. times, and references a different variable each time: &loopVar&counterVar..\n%pend;\n```\n\nRunning `sassy test.txt` will generate the following... \n```\nThis is how you execute a loop:\n This loop will execute 0 times.\n This loop will execute 1 times.\n This loop will execute 2 times.\n\nYou can also use a variable to set the number of iterations:\n This other loop will execute 0 times, and references a different variable each time: first loop\n This other loop will execute 1 times, and references a different variable each time: second loop\n This other loop will execute 2 times, and references a different variable each time: third loop\n This other loop will execute 3 times, and references a different variable each time: fourth loop\n```\n\n---\n\n## Installation\n\nHere's what you need to do to install sassy:\n\n### Python 3.6+\n\nSassy is compatible with **Python 3.6 and later**.\n\nOn Unix systems, install Python 3.6 (or later) via your package manager (apt, rpm, yum, brew).\nAlternatively, you can download an installation package from the [official Python downloads page](https://www.python.org/downloads/)\n\n### Virtual Environment\n\nIt is recommended to put all project dependencies into its own virtual\nenvironment - this way we don't pollute the global Python installation.\nFor this we recommend you use **virtualenvwrapper**. Follow the instructions\n[here](http://virtualenvwrapper.readthedocs.io/en/latest/install.html)\nto get this installed. Once you have virtualenvwrapper install, create\na new virtual environment with:\n\n```bash\nmkvirtualenv sassy\nworkon sassy\n```\n\nNow let's install sassy:\n\n```bash\npip install sassylang\n```\n\n### Get help or give help\n\n- Open a new [issue](https://github.com/jmsmistral/sassy/issues/new) you encounter a problem.\n- Pull requests welcome. You can help with language features!\n\n---\n\n## License\n\n- sassy is Free Software and licensed under the [GPLv3](https://github.com/jmsmistral/macrosql/blob/master/LICENSE.txt)\n- Main author is [@jmsmistral](https://github.com/jmsmistral)\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jmsmistral/sassy", "keywords": "templates macros text interpolation sas", "license": "", "maintainer": "", "maintainer_email": "", "name": "sassylang", "package_url": "https://pypi.org/project/sassylang/", "platform": "", "project_url": "https://pypi.org/project/sassylang/", "project_urls": { "Homepage": "https://github.com/jmsmistral/sassy" }, "release_url": "https://pypi.org/project/sassylang/0.0.5/", "requires_dist": [ "docopt" ], "requires_python": "", "summary": "A simple but powerful templating language for text interpolation inspired by sas macros.", "version": "0.0.5" }, "last_serial": 5830521, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2b96798e942eff643f07ff2e66aa33fa", "sha256": "fc43b22affa66e04ea9b78cafd9da83a2502c2f307361763de782f9d02fd6f73" }, "downloads": -1, "filename": "sassylang-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2b96798e942eff643f07ff2e66aa33fa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 28880, "upload_time": "2019-02-05T21:45:22", "url": "https://files.pythonhosted.org/packages/78/4a/dbf2f28f2fb409d1864df185f45432adf5373b6fe4a1b19bd2738b4e27fb/sassylang-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d37277f0b99017c069adfd8a7031e57d", "sha256": "4e515a5f83ba4c850a6eacc7be6d68986097e52e4a37a34a6ff0be1f86a2e499" }, "downloads": -1, "filename": "sassylang-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d37277f0b99017c069adfd8a7031e57d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14092, "upload_time": "2019-02-05T21:45:24", "url": "https://files.pythonhosted.org/packages/42/b6/9998bb4b84914e13d8445495b023ca92518780476ed014bb7694b88af929/sassylang-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9a482701e878b5df6ea4a73277b64255", "sha256": "f7678b876f3ec75e0becf82e1f9f30c631d9d073d8f97f68660b39f5748b8fa3" }, "downloads": -1, "filename": "sassylang-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9a482701e878b5df6ea4a73277b64255", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 28866, "upload_time": "2019-02-06T16:21:27", "url": "https://files.pythonhosted.org/packages/97/51/eee7140c42d4a9cc9cb41414ee5ee7d2f3115f785cc52a5d447925a45d78/sassylang-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e72067b4bf056b3ddaa21efa7116c62b", "sha256": "33cb8093e7e6698f2555048424bf5fbc882f1add0e75ef052a0b4624be148641" }, "downloads": -1, "filename": "sassylang-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e72067b4bf056b3ddaa21efa7116c62b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14108, "upload_time": "2019-02-06T16:21:29", "url": "https://files.pythonhosted.org/packages/cd/44/b5dee001101e4a1e7912b4686e30efd645bfa33fb647eb39036f087539cd/sassylang-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "d2a1d3839123e59d2aa8eeab23df062f", "sha256": "d0860c35cdc379fc61de22b48a363ffbab411b76b2d172bfd309e648592c5dc4" }, "downloads": -1, "filename": "sassylang-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "d2a1d3839123e59d2aa8eeab23df062f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 28280, "upload_time": "2019-02-07T16:15:42", "url": "https://files.pythonhosted.org/packages/e8/88/b5b75e15095ecd179c5a18b1024b275470cd7f0250a3f2a462db7b2dca12/sassylang-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "14ddd76ef5d4cfe6470cd7acdf69f6d1", "sha256": "8aafdfe9e2d6fd0a246680d0d6cae8f4a0bb8f8ed137d95971369f5e3e3ed4a8" }, "downloads": -1, "filename": "sassylang-0.0.3.tar.gz", "has_sig": false, "md5_digest": "14ddd76ef5d4cfe6470cd7acdf69f6d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13479, "upload_time": "2019-02-07T16:15:44", "url": "https://files.pythonhosted.org/packages/eb/94/633e86fa50162638e9d5519718feb35a7bbe78e24f895749eb8cf9859e5a/sassylang-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "92097f3257dd8a06f99c66fe02dfb110", "sha256": "c9f594ed8c760d73b3f70b9d980f55b49165a8ff2e42970848337d14f627b328" }, "downloads": -1, "filename": "sassylang-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "92097f3257dd8a06f99c66fe02dfb110", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29166, "upload_time": "2019-09-14T17:42:34", "url": "https://files.pythonhosted.org/packages/ce/81/20ba2479f5aeee8e835822bf0f59568f1f79247a58120e2604e5c0aa0011/sassylang-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f599cae8cd43d71f97490bd387aadf81", "sha256": "b98225ab743b80c561ced24c6a715afc9188ae053a5cefae6290cb15a3867342" }, "downloads": -1, "filename": "sassylang-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f599cae8cd43d71f97490bd387aadf81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14473, "upload_time": "2019-09-14T17:42:36", "url": "https://files.pythonhosted.org/packages/e6/8f/ba4799794be8af2429d51cf8698e9d2857bedd88135e03ae726794e3c799/sassylang-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "b32f6bd89e307708613b94b36f934b5a", "sha256": "c88ce70e91dee6f17d5d5388a2c12f5c33337bc89d468305d613fe920b3a8ec6" }, "downloads": -1, "filename": "sassylang-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "b32f6bd89e307708613b94b36f934b5a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29158, "upload_time": "2019-09-15T00:01:36", "url": "https://files.pythonhosted.org/packages/5b/92/00c3dce0b8feb53d15d62c70a55c677c30231a7d63a975316c3f2469ee7b/sassylang-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69d0043966e83312ea9a5cd108c02a7f", "sha256": "d9feaeacd99a183a1a9ce36b89cd4d89a6470f58a0eb25110de4b2b82480a66b" }, "downloads": -1, "filename": "sassylang-0.0.5.tar.gz", "has_sig": false, "md5_digest": "69d0043966e83312ea9a5cd108c02a7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14458, "upload_time": "2019-09-15T00:01:37", "url": "https://files.pythonhosted.org/packages/bf/c9/9b0501164d10fc700404672b9d120a32988bbf1700c587ff386ae4e181a3/sassylang-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b32f6bd89e307708613b94b36f934b5a", "sha256": "c88ce70e91dee6f17d5d5388a2c12f5c33337bc89d468305d613fe920b3a8ec6" }, "downloads": -1, "filename": "sassylang-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "b32f6bd89e307708613b94b36f934b5a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29158, "upload_time": "2019-09-15T00:01:36", "url": "https://files.pythonhosted.org/packages/5b/92/00c3dce0b8feb53d15d62c70a55c677c30231a7d63a975316c3f2469ee7b/sassylang-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69d0043966e83312ea9a5cd108c02a7f", "sha256": "d9feaeacd99a183a1a9ce36b89cd4d89a6470f58a0eb25110de4b2b82480a66b" }, "downloads": -1, "filename": "sassylang-0.0.5.tar.gz", "has_sig": false, "md5_digest": "69d0043966e83312ea9a5cd108c02a7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14458, "upload_time": "2019-09-15T00:01:37", "url": "https://files.pythonhosted.org/packages/bf/c9/9b0501164d10fc700404672b9d120a32988bbf1700c587ff386ae4e181a3/sassylang-0.0.5.tar.gz" } ] }