{ "info": { "author": "Felipe A. Hernandez", "author_email": "ergoithz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Text Processing :: Markup", "Topic :: Text Processing :: Markup :: HTML", "Topic :: Text Processing :: Markup :: XML" ], "description": "# Yatom\n\nBeautiful HTML/XHTML/XML using YAML.\n\nYatom is a YAML to markup compiler supporting XML and HTML as output formats.\n\nHTML and its siblings are not friendly at all, their very convoluted and often unreadable nature (due its parent: SGML) cannot be overtaken regardless on how much effort is put on both indentation and formatting. And even that requires further postprocessing to avoid the a huge size overhead.\n\nIn some way, Yatom shares the same concept as jedi/pugjs and HAML, but unless being *yaml-inspired*TM, Yatom is absolutely pure YAML, completely language agnostic, without extra stuff, requirements or incompatibilities.\n\nYAML in, HTML out, simple.\n\n## Usage\n\nSimple HTML5 page using Yatom.\n\n```python\nimport yatom\n\nsource = '''\n doctype: html5\n html:\n head:\n title: My Yatom page!\n body:\n h2: Yatom is awesome\n p: >-\n Now, you can code your page with\n beautiful markup without worrying\n about inefficient HTML output nor\n erratic linebreak behavior thanks\n to Yatom.\n '''\nprint(\n yatom.HTMLProcessor\n .from_source(source)\n .render()\n )\n```\n\n```html\n\nMy Yatom page!

Yatom is awesome

Now, you can code your page with beautiful markup without worrying about inefficient HTML output nor erratic linebreak behavior thanks to Yatom.

\n```\n\n## The Yatom syntax\n\nYatom uses regular YAML, but that doesn't mean documents can of arbitrary shape.\n\nThe YAML document structure is defined by the target language, but mostly all follow the following rules:\n\n- YAML root must be a mapping, as mappings define the document structure.\n- If a non-mapping value is is encountered, it is treated as text.\n\n### HTML/XHTML/XML\n\nThe YAML syntax defining an entire HTML document is quite simple. If you already know HTML you can start writing Yatom templates with very few rules:\n\n- Mapping keys are tag names, with one exception:\n - Key `doctype` is handled differently, its accepted values are listed here:\n - html4-strict\n - html4-transitional\n - html4-frameset\n - html5\n - xhtml1-strict\n - xhtml1-transitional\n - xhtml1-frameset\n - xhtml11\n- Mapping string values are treated as text content.\n- Dot-prefixed keys are tag attributes and must appear before any other sibling keys, with some exceptions:\n - .text for inline text strings (escaped)\n - .literal for unescaped inlined text strings (allowing inline markup)\n - .cdata for XML CDATA tags\n - .comment for HTML comments\n\nIn addition to previous rules, attributes support nesting, with the following rules:\n\n- When style value is a mapping, properties are treated as CSS properties, and nested mapping keys are joined with dashes (`-`).\n- When class value is a mapping or list, its properties are treated as different classes (the dot is prefixed). It its a mapping its hierarchy (mapping or array) is combined with dashes (`-`).\n- If any other attribute value is a mapping or list, its hierarchy is combined with dashes (`-`).\n\nAnd as a bonus, and only if required by doctype, few tags provide sane defaults:\n\n- Both html4 and xhtml:\n - `style` element's attribute `type` defaults to `text/css`.\n - `script` element's attribute `type` defaults to `application/javascript`.\n- Only xhtml:\n - `html` element has both default `lang` and `xmlns`.\n - Both `style` and `script` element's content is automatically wrapped with `CDATA` tags.\n\nSemantic HTML rules are applied.\n\n## Examples\n\nSimple example for HTML5.\n\n```python\nimport yatom\n\nsource = '''\n doctype: html5\n html:\n head:\n title: my page\n body:\n h2: my page\n p: |\n multiline\n text\n p:\n .text: mixed\n span:\n .style:\n color: red\n .text: tags\n .text: and\n strong: text\n '''\nprint(\n yatom.HTMLProcessor\n .from_source(source)\n .render()\n )\n```\n\n```html\n\nmy page

my page

multiline\ntext\n

mixedtagsandtext

\n```\n\nMore advanced XHTML4 example.\n\n```python\nimport yatom\n\nsource = '''\n doctype: xhtml11\n html:\n head:\n title: my page\n script: window.alert('')\n body:\n .data:\n something: 1\n other: 2\n .class:\n - simple:\n - nested\n - other\n .style:\n padding:\n top: 2em\n bottom: 2em\n left: 25%\n right: 25%\n p: some simple text\n '''\nprint(\n yatom.HTMLProcessor\n .from_source(source)\n .render()\n )\n```\n\n```html\n\nmy page

some simple text

\n```\n\n## Roadmap\n\n- [ ] Pretty print\n- [ ] Pluggable templating engines or logic\n- [ ] Drop python2 for good\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://gitlab.com/ergoithz/yatom", "keywords": "yaml,html", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "yatom", "package_url": "https://pypi.org/project/yatom/", "platform": "any", "project_url": "https://pypi.org/project/yatom/", "project_urls": { "Homepage": "https://gitlab.com/ergoithz/yatom" }, "release_url": "https://pypi.org/project/yatom/0.0.4/", "requires_dist": [ "pyyaml", "six" ], "requires_python": "", "summary": "Beautiful HTML/XHTML/XML using YAML", "version": "0.0.4" }, "last_serial": 5005552, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "130d9459f2db3109bf7889c243b14490", "sha256": "b9c87a91072b7b81eb0032e3c0e53c0cd7d0df0191714bcadd8ef013b3e21499" }, "downloads": -1, "filename": "yatom-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "130d9459f2db3109bf7889c243b14490", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 12504, "upload_time": "2019-03-28T11:52:47", "url": "https://files.pythonhosted.org/packages/ad/db/674ac619c41da923e7da2b063fdb744e66dc4d2adf8d1efffed6ac23d505/yatom-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "488645b3fcf68110e95379242abb086d", "sha256": "5621baafb06afaf223093912bcb637c408807d7f999466a6e913b771a11b72e6" }, "downloads": -1, "filename": "yatom-0.0.1.tar.gz", "has_sig": false, "md5_digest": "488645b3fcf68110e95379242abb086d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9570, "upload_time": "2019-03-28T11:52:50", "url": "https://files.pythonhosted.org/packages/fc/7c/ed99020b13eb9bdaae1c919c03977896a3089fc564a2fbb971c7e7626c88/yatom-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "658d1e7091ad76c2d0e1dd709a15b2bb", "sha256": "d61d96270c6e0a69e641ee53bb5a8854ec2d0c70fd1abb85b426cf630134379f" }, "downloads": -1, "filename": "yatom-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "658d1e7091ad76c2d0e1dd709a15b2bb", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 14067, "upload_time": "2019-03-29T14:22:45", "url": "https://files.pythonhosted.org/packages/79/22/0c5e32b78a412d73ede7b76af38a8a24f220edbaf5041a10ec323b6bfc70/yatom-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5406c3c7b875691cb5542d8a5539b71c", "sha256": "6e6c9509be8b75eb14d136fc5d845721716c24135be255c653a3b628680012b1" }, "downloads": -1, "filename": "yatom-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5406c3c7b875691cb5542d8a5539b71c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12511, "upload_time": "2019-03-29T14:22:47", "url": "https://files.pythonhosted.org/packages/d5/da/431f5ce48acd821b314abb4647b0091d08610f4254f4395401057a5f6b7a/yatom-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "fe073b692d0e245ad5664ff6839ba24b", "sha256": "bba0fdbf2eadbc3550c51d784e7caaaad9a6e0a9787b735c90b4cb723f6d661b" }, "downloads": -1, "filename": "yatom-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fe073b692d0e245ad5664ff6839ba24b", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 14863, "upload_time": "2019-03-29T23:14:00", "url": "https://files.pythonhosted.org/packages/5b/c6/7fa02019e5915db011c64eca5c9f1e94b245435b4e8f1aaf2a65fa6b287d/yatom-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc2bf4cdabe17e85d816eb54c626357d", "sha256": "7d1ccb1dc35b518d85b9bb95a71014dc545872ce3debdb2956eaa00398249486" }, "downloads": -1, "filename": "yatom-0.0.3.tar.gz", "has_sig": false, "md5_digest": "fc2bf4cdabe17e85d816eb54c626357d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12808, "upload_time": "2019-03-29T23:13:49", "url": "https://files.pythonhosted.org/packages/80/95/da498aac887eb0c7b93da5527bff2177a24ecdff23b319510535d20b8409/yatom-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "511d7ac34ed840c7f4f727547d282417", "sha256": "935b5a7a48c9f0d7f452938de3b319264632c9311cf1220288dbfd1e175c01f1" }, "downloads": -1, "filename": "yatom-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "511d7ac34ed840c7f4f727547d282417", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14863, "upload_time": "2019-03-29T23:37:54", "url": "https://files.pythonhosted.org/packages/4f/de/ed64c840812a6a0ef38a9978c97897558d50652220c2d1481fb3b23c5f36/yatom-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c2164a4750cdb57e09f6933c83a6136b", "sha256": "b66d0ee8b106ef99fbc13723543de9afb511071a901e4d0304f8573f58e87445" }, "downloads": -1, "filename": "yatom-0.0.4.tar.gz", "has_sig": false, "md5_digest": "c2164a4750cdb57e09f6933c83a6136b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12803, "upload_time": "2019-03-29T23:37:55", "url": "https://files.pythonhosted.org/packages/7e/dc/a6c2d998f4f47ae372659bed29ebc2900ecf560eb74ab1223bc63d8c5234/yatom-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "511d7ac34ed840c7f4f727547d282417", "sha256": "935b5a7a48c9f0d7f452938de3b319264632c9311cf1220288dbfd1e175c01f1" }, "downloads": -1, "filename": "yatom-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "511d7ac34ed840c7f4f727547d282417", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14863, "upload_time": "2019-03-29T23:37:54", "url": "https://files.pythonhosted.org/packages/4f/de/ed64c840812a6a0ef38a9978c97897558d50652220c2d1481fb3b23c5f36/yatom-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c2164a4750cdb57e09f6933c83a6136b", "sha256": "b66d0ee8b106ef99fbc13723543de9afb511071a901e4d0304f8573f58e87445" }, "downloads": -1, "filename": "yatom-0.0.4.tar.gz", "has_sig": false, "md5_digest": "c2164a4750cdb57e09f6933c83a6136b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12803, "upload_time": "2019-03-29T23:37:55", "url": "https://files.pythonhosted.org/packages/7e/dc/a6c2d998f4f47ae372659bed29ebc2900ecf560eb74ab1223bc63d8c5234/yatom-0.0.4.tar.gz" } ] }