{ "info": { "author": "Santtu Pajukanta", "author_email": "santtu@pajukanta.fi", "bugtrack_url": null, "classifiers": [], "description": "# Empugn \u2013 Generate HTML or XML from YAML or JSON\n\nMore an experiment than a serious attempt at making a HTML template engine. But if you're going to use it, you may find it works well together with [Emrichen](https://github.com/con2/emrichen).\n\nAn Empugn template looks like this:\n\n```yaml\nhtml:\n - head:\n - title: Empugn example\n - link:\n rel: stylesheet\n href: foo.css\n - script: |\n alert('Hello, World');\n - body:\n - h1: Sole text child may be specified as-is\n - p:\n - \"Separating links by \"\n - a:\n href: https://google.com\n target: _blank\n children: space\n - \" may require quoting\"\n```\n\nOr with Emrichen:\n\n```yaml\n!Defaults\ntitle: Empugn example with Emrichen\ngreeting: Hello, Emrichen\n---\nhtml:\n - head:\n - title: !Var title\n - link:\n rel: stylesheet\n href: foo.css\n - script: !Format \"alert({greeting!r});\"\n - body:\n - h1: !Var title\n```\n\n## Installation\n\nPython 3.5+ required. Python 2 is not and will not be supported.\n\nOptional dependencies:\n\n* YAML support requires [PyYAML](https://pypi.org/project/PyYAML/)\n* Emrichen support requires\u2026 well\u2026 [Emrichen](https://pypi.org/project/emrichen/)\n\nThe recommended way to instal Empugn is\n\n pip install empugn[emrichen]\n\nPlain `empugn` gives you JSON support only. For Empugn with YAML support but no Emrichen, use `empugn[yaml]`.\n\n## CLI\n\n```\nusage: empugn [-h] [--template-format {yaml,json}] [--output-file OUTPUT_FILE]\n [--indent INDENT] [--use-emrichen] [--var-file VAR_FILE]\n [--define VAR=VALUE] [--include-env]\n [template_file]\n\nGenerate HTML or XML from YAML or JSON\n\npositional arguments:\n template_file The YAML or JSON template to process. If unspecified,\n the template is read from stdin.\n\noptional arguments:\n -h, --help show this help message and exit\n --template-format {yaml,json}\n Template format. If unspecified, attempted to be\n autodetected from the input filename (but defaults to\n YAML).\n --output-file OUTPUT_FILE, -o OUTPUT_FILE\n Output file. If unspecified, the HTML/XML output is\n written into stdout.\n --indent INDENT, -i INDENT\n Indent output. If integer, this many spaces will be\n used. If string, will be used literally. To disable\n indentation, pass in the empty string.\n --use-emrichen, -r Use Emrichen to process tags, making Empugn a full\n featured HTML template engine. Emrichen must be\n installed.\n --var-file VAR_FILE, -f VAR_FILE\n (Implies --use-emrichen) A YAML file containing an\n object whose top-level keys will be defined as\n variables. May be specified multiple times.\n --define VAR=VALUE, -D VAR=VALUE\n (Implies --use-emrichen) Defines a single variable.\n May be specified multiple times.\n --include-env, -e (Implies --use-emrichen) Expose process environment\n variables to the template.\n```\n\n## Python API\n\nSimple usage:\n\n```python\nfrom empugn import empugn\n\n# In goes parsed JSON/YAML, out comes string\nempugn({'html': []}) # -> ''\n```\n\nUsage with Emrichen:\n\n```python\nfrom empugn import empugn\nfrom emrichen import Context, Template\n\ntemplate_yaml = '\u2026'\ntemplate = Template.parse(template) # or Template(\u2026)\ncontext = Context({'var': 'value'})\ndata, = Template.enrich(context)\nempugn(data)\n```\n\n## Why is it called Empugn?\n\nThe name Empugn is a play on Emrichen, [Pug](https://pugjs.org/) and _impugn_.\n\n## License\n\n The MIT License (MIT)\n\n Copyright \u00a9 2018\u20132019 Santtu Pajukanta\n Copyright \u00a9 2018\u20132019 Aarni Koskela\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\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": "http://github.com/japsu/empugn", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "empugn", "package_url": "https://pypi.org/project/empugn/", "platform": "", "project_url": "https://pypi.org/project/empugn/", "project_urls": { "Homepage": "http://github.com/japsu/empugn" }, "release_url": "https://pypi.org/project/empugn/0.1.0/", "requires_dist": [ "yattag (~=1.10.1)", "emrichen; extra == 'emrichen'", "PyYAML; extra == 'yaml'" ], "requires_python": "", "summary": "Generate HTML or XML from YAML or JSON", "version": "0.1.0" }, "last_serial": 4703734, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "41fd820244d1d9a8dda9513779070db5", "sha256": "80dea33ebc929ae9f299aa4a9330776da87d4631750174795b7b35c01404427e" }, "downloads": -1, "filename": "empugn-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "41fd820244d1d9a8dda9513779070db5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6688, "upload_time": "2019-01-16T14:59:17", "url": "https://files.pythonhosted.org/packages/d6/18/0263257b8b0156894dbd9b768db0871458162bdf6c027a121d0dafd30468/empugn-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c4ac99edf73aa6190bcb4ad8a986fa1f", "sha256": "91b50ebd989819248892ca5a33e45fe3b066ed94a3d4e7f186a121e7babb55d7" }, "downloads": -1, "filename": "empugn-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c4ac99edf73aa6190bcb4ad8a986fa1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6019, "upload_time": "2019-01-16T14:59:19", "url": "https://files.pythonhosted.org/packages/c2/6a/756c6b06f859d2e19d7eb47f67663f77512cea75f727c760f3338a3b5b21/empugn-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "41fd820244d1d9a8dda9513779070db5", "sha256": "80dea33ebc929ae9f299aa4a9330776da87d4631750174795b7b35c01404427e" }, "downloads": -1, "filename": "empugn-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "41fd820244d1d9a8dda9513779070db5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6688, "upload_time": "2019-01-16T14:59:17", "url": "https://files.pythonhosted.org/packages/d6/18/0263257b8b0156894dbd9b768db0871458162bdf6c027a121d0dafd30468/empugn-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c4ac99edf73aa6190bcb4ad8a986fa1f", "sha256": "91b50ebd989819248892ca5a33e45fe3b066ed94a3d4e7f186a121e7babb55d7" }, "downloads": -1, "filename": "empugn-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c4ac99edf73aa6190bcb4ad8a986fa1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6019, "upload_time": "2019-01-16T14:59:19", "url": "https://files.pythonhosted.org/packages/c2/6a/756c6b06f859d2e19d7eb47f67663f77512cea75f727c760f3338a3b5b21/empugn-0.1.0.tar.gz" } ] }