{ "info": { "author": "Cody Landry", "author_email": "cody.landry@me.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "# Smores\n[]()\n[]()\n[]()\n[](https://coveralls.io/github/codylandry/Smores?branch=master)\n\nSmores allows you to specify a schema for user facing template features. It leverages marshmallow (hence 'smores') to\npopulate and transform data that is then rendered via jinja. It has a parser that presents a more friendly syntax to \nusers (ex. {user.addresses:1.street}). It also includes an autocomplete method that gives you intellisense style \noptions given a tag fragment. \n\nSmores provides two Marshmallow field types called TemplateString and TemplateFile. Templates defined in these fields\nare scoped to that schema and it's descendants. Each schema can have a _default_template that, if defined, will what\nis inserted if the associated tag ends with that schema. For example: typing {user.address} will render the _default_template\nfor the Address schema. You can define other template attributes as well. For example, see the 'google_link' attribute\nof the Address schema below. Typing {user.address.google_link} will populate and insert that link. \n\nsmores.tag_autocomplete is a method where you can provide a tag 'fragment' and it will return the possible options below that.\nFor example:\n\n```python\nfrom smores import Smores, TemplateString\nfrom marshmallow import Schema, fields\n\n# instantiate a smores instance\nsmores = Smores()\n\n# smores.schema registers the schema with the instance\n@smores.schema\nclass Coordinates(Schema):\n lat = fields.Decimal()\n lng = fields.Decimal()\n _default_template = TemplateString(\"{{lat}},{{lng}}\")\n\n@smores.schema\nclass Address(Schema):\n street = fields.String()\n suite = fields.String()\n city = fields.String()\n state = fields.String()\n zipcode = fields.String()\n coordinates = fields.Nested(Coordinates)\n google_link = TemplateString('View Map')\n _default_template = TemplateString(\"\"\"\n
Your Info:
\n {user}\n\"\"\"\n\n# render the output\nprint smores.render(data, user_template)\n\n# output -->\n#Your Info:
\n# \n#