{ "info": { "author": "Marcos Rosa", "author_email": "marcos.cantor@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Topic :: Software Development :: Build Tools" ], "description": "+\n# This is a very important project.\n# Sucuri\nSimple and efficient template engine for Python projects inspired by [PugJS](https://pugjs.org)\n\n## Instaling\nInstall and update using [pip](https://pip.pypa.io/en/stable/quickstart/):\n> pip install sucuri\n\n## Creating a Sucuri Template\n- Example of code:\n```\nhtml\n body\n h1 Title\n a(href='#') This is my link\n```\nAs can be seen in the code example above, the sucuri development requires tabulation standardization. We do not determine the number of spaces, but it is necessary to keep the same number of spaces on the left in the whole code, because this quantity will inform if a certain TAG of the HTML will be contained within another one or not. With this, in the example above we will have the following HTML code:\n```\n\n \n

Title

\n This is my link\n \n\n```\n\n## Using\nTo use sucuri, you need to import the sucuri package into your Python file, the example below is an application that uses the sucuri to render in the [Flask](http://flask.pocoo.org/):\n```\nfrom sucuri import rendering\nfrom flask import Flask, render_template_string\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template.suc')\n \u00a0 \u00a0return render_template_string(template)\n```\n\nAs can be seen in the example above, the template in the example is loaded from a file named `template.suc` which is in the project's root directory, however it could be in any project directory, such as `templates/template.suc` if you include a folder to group the templates. At the first access to the archive, it will take care of storing it in memory, thus making access to information less costly and more efficient. \n\n### Text\nIn sucuri, texts are described in two ways. It can be written after the declaration of the tag such as:\n```\nh1 Title\n```\nResult:\n```\n

Title

\n```\nOr you can type in more than one line using the `|` on the lines that are not the same as the tag, see example:\n```\nh3 Hello!\n | Text\n | with\n | more than\n | one line\n```\nResult:\n```\n

Hello!\n Text\n with\n more than\n one line\n

\n```\n\n### Attributes\nJust as in HTML the attributes in the sucuri must be separated by space and unlike the PugJS must be in a row only and can not be separated by commas. They must necessarily be enclosed in parentheses. See examples of the use of attributes below:\n```\na(href='google.com') Google\na(class='button' href='google.com') Google\ndiv(class='div-class')\n```\n- Result:\n```\nGoogle\nGoogle\n
\n```\n\n### Rendering of data\nWe already know (seen in the text above) that we can only use the `template('template_name')` function with a simple `.suc` file, however it is possible to pass information through a JSON to the template and the sucuri will automatically render the data in the proper location, see the example below:\n- Sucuri file:\n```\nhtml\n body\n h1 Hello {a}\n | Title\n | More\n a(href='#') This is my link\n h3 {b}\n```\n- Python example with data:\n```\nfrom flask import Flask, render_template_string\nfrom sucuri import rendering\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template_data.suc',{\"a\": 1, \"b\": \"Hello!\"})\n return render_template_string(template)\n```\n- Result:\n```\n\n \n

Hello 1\n Title\n More\n

\n This is my link\n

Hello!

\n \n\n```\n\n### Injecting template\nCode reuse can be done through injected templates. This facility makes reuse of the code very efficient and enables the creation of code components. In the sucuri the identification of an injection occurs through an `include` at the beginning of the .suc file and its use is carried out using the `+` symbol before the name of the file that was imported. See the example below using this feature:\n- Sucuri file (`template_include.suc`):\n```\ninclude inc/link\ninclude inc/list\n\nhtml\n body\n h1 Hello\n | Title\n | More\n +link\n h3 Oh Yeahh\n +list\n```\n- File inside the folder `inc` called `link.suc` (`inc/link.suc`):\n```\na(href='#') {text}\n```\n- File inside the folder `inc` called `list.suc` (`inc/list.suc`):\n```\nul\n li A\n li B\n```\n- Python example:\n```\nfrom flask import Flask, render_template_string\nfrom sucuri import rendering\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template_include.suc',{\"text\": \"Hello! I'm here!\"})\n return render_template_string(template)\n```\n- Result:\n```\n\n \n

Hello\n Title\n More\n

\n Hello! I'm here!\n

Oh Yeahh

\n \n \n\n```\n\n### Condition (if)\n\nIt is possible to use conditional statements within Sucuri. Conditions are using the same form as Python's. Hence, the main operators are ```==``` and ```!=```. See an example below:\n- Main file\n```\nfrom flask import Flask, render_template_string\nfrom sucuri import rendering\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template_if.suc',{\"x\": 1, \"y\": 3})\n return render_template_string(template)\n```\n- Sucuri file (`template_if.suc`):\n```\ninclude inc/if\n\nhtml\n body\n h1 Hello\n | Title\n | More\n +if\n```\n\n- File inside the folder `inc` called `if.suc` (`inc/if.suc`):\n```\n\nh2 The condition is True\n\n```\n- Result:\n```\n\n \n

Hello\n Title\n More\n

\n

The condtition is True

\n \n\n```\n\n### Loop (for)\nSucuri has a loop in collections of objects, so it is necessary to use the object that has this characteristic as a parameter and to use the information in that collection. See the example below:\n- Main file\n```\nfrom flask import Flask, render_template_string\nfrom sucuri import rendering\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template.suc',{\"text\": \"Hello! I'm here!\", \"var\":[1, 2, 3, 4]})\n return render_template_string(template)\n```\n- Sucuri file (`template_include.suc`):\n```\ninclude inc/link\ninclude inc/list\n\nhtml\n body\n h1 Hello\n | Title\n | More\n +link\n h1 Test\n +list\n```\n- File inside the folder `inc` called `link.suc` (`inc/link.suc`):\n```\na(href='#') {text}\n```\n- File inside the folder `inc` called `list.suc` (`inc/list.suc`):\n```\nul\n \n li Value #a\n h1 test\n ul\n \n li Another #w\n \n \n```\n- Result:\n```\n\n \n

Hello\n Title\n More\n

\n Hello! I'm here!\n

Test

\n
    \n
  • Value 1
  • \n

    test

    \n
      \n
    • Another 1
    • \n
    • Another 2
    • \n
    • Another 3
    • \n
    • Another 4
    • \n
    \n
  • Value 2
  • \n

    test

    \n
      \n
    • Another 1
    • \n
    • Another 2
    • \n
    • Another 3
    • \n
    • Another 4
    • \n
    \n
  • Value 3
  • \n

    test

    \n
      \n
    • Another 1
    • \n
    • Another 2
    • \n
    • Another 3
    • \n
    • Another 4
    • \n
    \n
  • Value 4
  • \n

    test

    \n
      \n
    • Another 1
    • \n
    • Another 2
    • \n
    • Another 3
    • \n
    • Another 4
    • \n
    \n
\n \n\n```\n\n### Lists\n\nIt is possible to generate unordered bullet list (```
    ```) and checkboxex with Sucuri. This requires that the Python list given as argument is only a one dimension list for unordered lists and two (the list of the items and the list of the checked items) for the checkboxes. See an example below:\n- Main file\n```\nfrom flask import Flask, render_template_string\nfrom sucuri import rendering\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template_list.suc',{\"items\": [1, \"two\", 3, \"Five\"], \"checked\": [1, \"Five\"]})\n return render_template_string(template)\n```\n- Sucuri file (`template_list.suc`):\n```\n\nhtml\n body\n h1 Hello\n list(items)\n list(items checked)\n```\n\n- Result:\n```\n\n \n

    Hello

    \n
      \n
    • 1
    • \n
    • two
    • \n
    • 3
    • \n
    • Five
    • \n
    \n 1\n two\n 3\n Five\n \n\n```\n\n`list()` also takes the optional argument `class`, which can be used to set the class of unordered lists like so:\n\n- Main file\n```\nfrom flask import Flask, render_template_string\nfrom sucuri import rendering\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n template = rendering.template('template_list_with_classes.suc',{\"items\": [1, \"two\", 3, \"Five\"]})\n return render_template_string(template)\n```\n- Sucuri file (`template_list_with_classes.suc`):\n```\nstyle static/css/list\n\nhtml\n body\n h1 Hello\n list(items class=\"ul-squares\")\n```\n\n- Result:\n```\n\n \n

    Hello

    \n
      \n
    • 1
    • \n
    • two
    • \n
    • 3
    • \n
    • Five
    • \n
    \n \n\n```\n### Injecting Style (css) or Script (js)\nTo inject style or script into your html, the sucuri uses the style command that should come before the commands that will translate the html, in this case along with the import of the file however with the `style` tag for `css` and the `script` tag for `js` files.\n- Sucuri file (`template.suc`):\n```\ninclude inc/link\ninclude inc/list\nstyle static/css/style\nscript static/js/script\n\nhtml\n body\n h1 Hello\n | Title\n | More\n +link\n h1 Test\n +list\n```\n\n- Include List:\n```\nstyle static/css/list\nul\n \n li Value #a\n h1(class='h1-red') test\n ul\n \n li Another #w\n \n \n```\n\n- `style` static/css/style.css\n```\nh1 {\n color: blue;\n}\n```\n\n- `style` static/css/list.css\n```\n.h1-red {\n color: red;\n}\n```\n\n- `script` static/js/script.js\n```\nfunction example() {\n console.log('test');\n}\n```\n\n- Result:\n```\n\n \n \n

    Hello\n Title\n More\n

    \n Hello! I'm here!\n

    Test

    \n
      \n
    • Value 1
    • \n

      test

      \n
        \n
      • Another 1
      • \n
      • Another 2
      • \n
      • Another 3
      • \n
      • Another 4
      • \n
      \n
    • Value 2
    • \n

      test

      \n
        \n
      • Another 1
      • \n
      • Another 2
      • \n
      • Another 3
      • \n
      • Another 4
      • \n
      \n
    • Value 3
    • \n

      test

      \n
        \n
      • Another 1
      • \n
      • Another 2
      • \n
      • Another 3
      • \n
      • Another 4
      • \n
      \n
    • Value 4
    • \n

      test

      \n
        \n
      • Another 1
      • \n
      • Another 2
      • \n
      • Another 3
      • \n
      • Another 4
      • \n
      \n
    \n \n \n \n\n```\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marcosstefani/sucuri", "keywords": "template engine python", "license": "", "maintainer": "", "maintainer_email": "", "name": "sucuri", "package_url": "https://pypi.org/project/sucuri/", "platform": "", "project_url": "https://pypi.org/project/sucuri/", "project_urls": { "Homepage": "https://github.com/marcosstefani/sucuri" }, "release_url": "https://pypi.org/project/sucuri/0.2.6/", "requires_dist": null, "requires_python": ">=3", "summary": "Simple and efficient Template Engine for Python projects", "version": "0.2.6" }, "last_serial": 4776059, "releases": { "0.1.7": [ { "comment_text": "", "digests": { "md5": "0ba8d0028f0ccfee1beea6c71fcfc908", "sha256": "a6df6f6f4f2b04679d2d051a2ee95ea03ce1b9e6f0434167b0f96c50ec802b3f" }, "downloads": -1, "filename": "sucuri-0.1.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0ba8d0028f0ccfee1beea6c71fcfc908", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 3264, "upload_time": "2018-03-21T14:52:23", "url": "https://files.pythonhosted.org/packages/d5/08/75910dec0712c1fe4731132b9109241d988b10a1a14446ef23b51267552e/sucuri-0.1.7-py2.py3-none-any.whl" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "9304d949e29efb13872d39c772db935d", "sha256": "aa4a89a154d58f5d57d37d099d0c06931b1a2cbfdc57d260854a6683394c24de" }, "downloads": -1, "filename": "sucuri-0.1.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9304d949e29efb13872d39c772db935d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 5465, "upload_time": "2018-03-22T23:56:16", "url": "https://files.pythonhosted.org/packages/2f/ff/c372544baf44399dd0639cf4fadb4f3ebea5678ebda99eaa286da124f881/sucuri-0.1.8-py2.py3-none-any.whl" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "5cf8387d783ee052ce43a95be7d06455", "sha256": "35f062a3ac7ca071e12b1a9d02dd5959942ea421e52cf0ee9f616d6f413cab38" }, "downloads": -1, "filename": "sucuri-0.1.9-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5cf8387d783ee052ce43a95be7d06455", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 5867, "upload_time": "2018-03-23T03:58:36", "url": "https://files.pythonhosted.org/packages/c4/21/56032080acbef4fd717fee52a2edde392e7453efad81bd81b6a8ba0fc134/sucuri-0.1.9-py2.py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d92c279df9a4d0d748de4905953d6e96", "sha256": "d919305545c24254528ff19d871b8c5ba284a0f0eda20dedffdc9c289cbcefb8" }, "downloads": -1, "filename": "sucuri-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d92c279df9a4d0d748de4905953d6e96", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 6578, "upload_time": "2018-03-24T00:50:49", "url": "https://files.pythonhosted.org/packages/1e/f1/67052d96b94c5a3bac0e0ebf86217f38948793b0d96ce18a4351a051c60e/sucuri-0.2.0-py2.py3-none-any.whl" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "263ef427afed313b4b7900977c91511c", "sha256": "39b429c8f72a2ab82b08384e34863e5730156be011d9a33364320c080df6f52f" }, "downloads": -1, "filename": "sucuri-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "263ef427afed313b4b7900977c91511c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 8126, "upload_time": "2018-04-03T19:33:33", "url": "https://files.pythonhosted.org/packages/c5/7e/8151b379083d7af07636e0546a748d13324daab446f5255acf730af83c9a/sucuri-0.2.1-py2.py3-none-any.whl" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "835308a0b1ea623d11a5c599a1e05f9a", "sha256": "006c91a82caeeb7858c5b6db1db622671d63b954f4ceaed4b08fcac453a1aa97" }, "downloads": -1, "filename": "sucuri-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "835308a0b1ea623d11a5c599a1e05f9a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 9345, "upload_time": "2018-04-25T01:33:53", "url": "https://files.pythonhosted.org/packages/17/7b/74283ac489cf1b165f3da165aec1c52c0613808a84561e8f6eb12de9b656/sucuri-0.2.2-py2.py3-none-any.whl" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "f1a4d29373070ad4416074fcf0472998", "sha256": "172eb52b46ac46fe7247fdb13c6c2956c0691ac78c7425a0714c8a120d9018d6" }, "downloads": -1, "filename": "sucuri-0.2.4.tar.gz", "has_sig": false, "md5_digest": "f1a4d29373070ad4416074fcf0472998", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 9883, "upload_time": "2018-07-22T22:58:32", "url": "https://files.pythonhosted.org/packages/a0/e1/7e7803019ef918b42cedfa678aacc1bed78b9b026aaded74021edb376594/sucuri-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "d14378c26dfd1b5ca13dcc7eda63b4fe", "sha256": "0f646cb364bbb7f707fa2000beac90e65512df88fdaa811fbc8985504ef8bb61" }, "downloads": -1, "filename": "sucuri-0.2.5.tar.gz", "has_sig": false, "md5_digest": "d14378c26dfd1b5ca13dcc7eda63b4fe", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 14239, "upload_time": "2018-11-03T15:04:26", "url": "https://files.pythonhosted.org/packages/f6/41/1979448a7af3998d9983b6d55517881a336c31da52359b38f75c2e332fc8/sucuri-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "634bcd4c6f4c13e846cda48ed7cbe0db", "sha256": "ee2fe0d1bb6d49ec60a426c854ccc41343811a8f2c75301000beae8cca090b86" }, "downloads": -1, "filename": "sucuri-0.2.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "634bcd4c6f4c13e846cda48ed7cbe0db", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 8869, "upload_time": "2019-02-04T00:11:23", "url": "https://files.pythonhosted.org/packages/a6/50/e7faef495c6e7f6ff2116296dc3c76f5be0e29d5e3d4e8d089f8f93e7ea7/sucuri-0.2.6-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "634bcd4c6f4c13e846cda48ed7cbe0db", "sha256": "ee2fe0d1bb6d49ec60a426c854ccc41343811a8f2c75301000beae8cca090b86" }, "downloads": -1, "filename": "sucuri-0.2.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "634bcd4c6f4c13e846cda48ed7cbe0db", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3", "size": 8869, "upload_time": "2019-02-04T00:11:23", "url": "https://files.pythonhosted.org/packages/a6/50/e7faef495c6e7f6ff2116296dc3c76f5be0e29d5e3d4e8d089f8f93e7ea7/sucuri-0.2.6-py2.py3-none-any.whl" } ] }