t5html


Namet5html JSON
Version 23.6.2 PyPI version JSON
download
home_page
SummaryConverts text to html. Text muste be in t5html form.
upload_time2023-02-11 16:55:46
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords html html5 template templating web
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            T5HTML
======

Converts a text file into HTML. 

The text must be formatted according to the rules of a Trivial Text Tree To
Trivial HTML (T5HTML) file.

---

- [Example](#example)
- [Syntax Overview](#t5html-syntax)
- [Developers](#for-developers)

---

## Example

```t5html
## t5html

## definitions / macros
##
DCT := <!DOCTYPE html>
CHARSET := meta charset=utf-8
VIEWPORT := meta name=viewport
DESC := meta name=description content="A simple HTML5 Template"
AUTHOR := meta name=author content=splendor
OG_PROPERTY := meta property=og:title content=HTML5-Template |
            .. meta property=og:type content=website |
            .. meta property=og.url content=www.example.org |
            .. meta property=og.description content="Example for t5html" |
            .. meta property=og.image content=noneatm
FAVICON := link rel=icon href=/favicon.ico |
        .. link rel=icon href=/favicon.svg type=image/svg+xml |
        .. link rel=apple-touch-icon href=/apple-touch-icon.png
CSS_ := link rel=stylesheet 
JS_  := script src=

## DOCUMENT-TREE
#
!DCT
html > head
      # not more then one multiline macro per line
      CHARSET | DESC | AUTHOR | FAVICON
      OG_PROPERTY
      CSS_ href=css/styles.css?v=23.1
      JS_ js/script.js
   body
      main
         article#example
            h1 > "This is an t5html-example
            p class=p-normal
               " A human readable, strucured file
               .. written in a specific format called the
               .. Trivial Text-Tree To Trivial HTML (ttttthtml or t5html)
               .. format, allows for easy prototyping of web-pages.



# vi: set et sw=3 ts=3 :
```

translates into:

```html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <meta name="description" content="A simple HTML5 Template"/>
    <meta name="author" content="splendor"/>
    <link rel="icon" href="/favicon.ico"/>
    <link rel="icon" href="/favicon.svg" type="image/svg+xml"/>
    <link rel="apple-touch-icon" href="/apple-touch-icon.png"/>
    <meta property="og:title" content="HTML5-Template"/>
    <meta property="og:type" content="website"/>
    <meta property="og.url" content="www.example.org"/>
    <meta property="og.description" content="Example for t5html"/>
    <meta property="og.image" content="noneatm"/>
    <link rel="stylesheet" href="css/styles.css?v=23.1"/>
    <script src="js/script.js"/>
  </head>
  <body>
    <main>
      <article id="example">
        <h1>
          This is an t5html-example
        </h1>
        <p class="p-normal">
           A human readable, strucured file written in a specific format called the Trivial Text-Tree To Trivial HTML (ttttthtml or t5html) format, allows for easy prototyping of web-pages.
        </p>
      </article>
    </main>
  </body>
</html>
```


## t5html-Syntax

1. Every line stand on its own as a syntactic element, except ...

2. .. if a line is the continuation of a previous one, signified by a
   leading `..`

3. Spaces are important! They delimit words as syntactic elements.

4. Indentation matters! Every indentation marks a hierarchical step down!

5. There are six types of lines: blank, verbatim, elements, comments, macros
   text-nodes.

6. Every line-type starts with a special symbol, except: blanks, elements and
   macros (!!, ##, "").

7. Macros have a macroname followed by an assignment operator `:=` and after a
   white-space the macro-value.

8. The first word of an element-line is the element's name.

9. Indentation are **3 whitespaces**! Do **not** use **tabs**!

10. There is a special syntax for `id` and `class` attributes: `div#id.class` !

11. `>` means an hierarchical step down, `<` up and `|` same hierarchical level
    if uses in the same line. They substitute indentation if used in the same
    line, e.g.: `div > p > "Paragraph text`.

12. A leading `"` double-quote marks a text-node.


## Feature-Matrix

| Feature                       |  23.6.1  | 23.1b28 |         | Explanation/Example       | 
| ----------------------------- | :------: | :-----: | :-----: | ------------------------- |
| Line Continuation ('..')      |     +    |    +    |         | `.. continue previous    `|
| Comments ('`#`')              |     +    |    +    |         | `# im a comment          `|
| Inline Indentation ('`><\|`') |     +    |    +    |         | `div > h1 > div > p      `|
| untouched literal lines ('!') |     +    |    +    |         | `! <-- html comment -->  `|
| first word as element-name    |     +    |    +    |         | `first word is the tag   `|
| id attribute ('`tag#id`')     |     +    |    +    |         | `tag#id -> tag id="id"   `|
| class attribute ('`tag.id`')  |     +    |    +    |         | `tag.cls -> tag class="" `|
| text-nodes (`' " '`)          |     +    |    +    |         | `p > "text -> <p>text</p>`|
| Macro Expansion (' := ')      |     +    |    +    |         | `MACRONAME := expansion  `|
| non recursive macro expansion |     +    |         |         |`macroname expanded only once per line`|
| Macro Imports ('@ . from .')  |     +    |         |         | `@ filename from ./dir   `|
 
 
## For Developers

Start with `Read.4dev` in the `doc` directory.


## Disclaimers

This **Read.Me** is a link to doc/Read.us!
The **License** is in meta/license.


## Additional Examples

```t5html
## t5html
@@ stdlib.t5i

_SCREEN-500 := "screen AND (max-width:500px)"


!! HTML5
html
   head > UTF8 | AUTHOR_splendor | DESC_"An Example page for the T5HTML-system" 
      title > "Example Three 
      FAVICON
      MEDIA__SCREEN-500 > !! a { background: white }
      CSS_css/main.css
      REFRESH_5
   body
      header
         nav.home > button 
      main
      aside
      footer
      template
         div single-attribute other-attribute
            A_assets/images/home.png > img src=images/home.png

## vi: set et sw=3 ts=3 ai ft=t5html :
```

will be translated into the following, if the stdlib macros are in
`$HOME/.local/share/t5html` :

```html
<!DOCTPYE html>
<html>
  <head>
    <meta charset="utf-8"/>
    <meta name="author" content="splendor"/>
    <meta name="description" content="An Example page for the T5HTML-system"/>
    <title>
      Example Three
    </title>
    <link rel="icon" href="/favicon.ico"/>
    <link rel="icon" href="/favicon.svg" type="image/svg+xml"/>
    <link rel="apple-touch-icon" href="/apple-touch-icon.png"/>
    <style type="text/css" media="screen AND (max-width:500px)">
       a { background: white }
    </style>
    <link rel="stylesheet" href="css/main.css"/>
    <meta http-equiv="refresh" content="5"/>
  </head>
  <body>
    <header>
      <nav class="home">
        <button/>
      </nav>
    </header>
    <main/>
    <aside/>
    <footer/>
    <template>
      <div single-attribute other-attribute>
        <a href="assets/images/home.png">
          <img src="images/home.png">
        </a>
      </div>
    </template>
  </body>
</html>
```


[//]: # ( vi: set et ts=4 sw=4 ai ft=markdown tw=80 cc=+0 spl=en: )

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "t5html",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "html,html5,template,templating,web",
    "author": "",
    "author_email": "splendor <splendor@tuta.io>",
    "download_url": "https://files.pythonhosted.org/packages/99/8a/776ba187dd80ae0fb6b669061bf4e6c1ac32848375c8b3c408ad3cd8c755/t5html-23.6.2.tar.gz",
    "platform": null,
    "description": "T5HTML\n======\n\nConverts a text file into HTML. \n\nThe text must be formatted according to the rules of a Trivial Text Tree To\nTrivial HTML (T5HTML) file.\n\n---\n\n- [Example](#example)\n- [Syntax Overview](#t5html-syntax)\n- [Developers](#for-developers)\n\n---\n\n## Example\n\n```t5html\n## t5html\n\n## definitions / macros\n##\nDCT := <!DOCTYPE html>\nCHARSET := meta charset=utf-8\nVIEWPORT := meta name=viewport\nDESC := meta name=description content=\"A simple HTML5 Template\"\nAUTHOR := meta name=author content=splendor\nOG_PROPERTY := meta property=og:title content=HTML5-Template |\n            .. meta property=og:type content=website |\n            .. meta property=og.url content=www.example.org |\n            .. meta property=og.description content=\"Example for t5html\" |\n            .. meta property=og.image content=noneatm\nFAVICON := link rel=icon href=/favicon.ico |\n        .. link rel=icon href=/favicon.svg type=image/svg+xml |\n        .. link rel=apple-touch-icon href=/apple-touch-icon.png\nCSS_ := link rel=stylesheet \nJS_  := script src=\n\n## DOCUMENT-TREE\n#\n!DCT\nhtml > head\n      # not more then one multiline macro per line\n      CHARSET | DESC | AUTHOR | FAVICON\n      OG_PROPERTY\n      CSS_ href=css/styles.css?v=23.1\n      JS_ js/script.js\n   body\n      main\n         article#example\n            h1 > \"This is an t5html-example\n            p class=p-normal\n               \" A human readable, strucured file\n               .. written in a specific format called the\n               .. Trivial Text-Tree To Trivial HTML (ttttthtml or t5html)\n               .. format, allows for easy prototyping of web-pages.\n\n\n\n# vi: set et sw=3 ts=3 :\n```\n\ntranslates into:\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <meta name=\"description\" content=\"A simple HTML5 Template\"/>\n    <meta name=\"author\" content=\"splendor\"/>\n    <link rel=\"icon\" href=\"/favicon.ico\"/>\n    <link rel=\"icon\" href=\"/favicon.svg\" type=\"image/svg+xml\"/>\n    <link rel=\"apple-touch-icon\" href=\"/apple-touch-icon.png\"/>\n    <meta property=\"og:title\" content=\"HTML5-Template\"/>\n    <meta property=\"og:type\" content=\"website\"/>\n    <meta property=\"og.url\" content=\"www.example.org\"/>\n    <meta property=\"og.description\" content=\"Example for t5html\"/>\n    <meta property=\"og.image\" content=\"noneatm\"/>\n    <link rel=\"stylesheet\" href=\"css/styles.css?v=23.1\"/>\n    <script src=\"js/script.js\"/>\n  </head>\n  <body>\n    <main>\n      <article id=\"example\">\n        <h1>\n          This is an t5html-example\n        </h1>\n        <p class=\"p-normal\">\n           A human readable, strucured file written in a specific format called the Trivial Text-Tree To Trivial HTML (ttttthtml or t5html) format, allows for easy prototyping of web-pages.\n        </p>\n      </article>\n    </main>\n  </body>\n</html>\n```\n\n\n## t5html-Syntax\n\n1. Every line stand on its own as a syntactic element, except ...\n\n2. .. if a line is the continuation of a previous one, signified by a\n   leading `..`\n\n3. Spaces are important! They delimit words as syntactic elements.\n\n4. Indentation matters! Every indentation marks a hierarchical step down!\n\n5. There are six types of lines: blank, verbatim, elements, comments, macros\n   text-nodes.\n\n6. Every line-type starts with a special symbol, except: blanks, elements and\n   macros (!!, ##, \"\").\n\n7. Macros have a macroname followed by an assignment operator `:=` and after a\n   white-space the macro-value.\n\n8. The first word of an element-line is the element's name.\n\n9. Indentation are **3 whitespaces**! Do **not** use **tabs**!\n\n10. There is a special syntax for `id` and `class` attributes: `div#id.class` !\n\n11. `>` means an hierarchical step down, `<` up and `|` same hierarchical level\n    if uses in the same line. They substitute indentation if used in the same\n    line, e.g.: `div > p > \"Paragraph text`.\n\n12. A leading `\"` double-quote marks a text-node.\n\n\n## Feature-Matrix\n\n| Feature                       |  23.6.1  | 23.1b28 |         | Explanation/Example       | \n| ----------------------------- | :------: | :-----: | :-----: | ------------------------- |\n| Line Continuation ('..')      |     +    |    +    |         | `.. continue previous    `|\n| Comments ('`#`')              |     +    |    +    |         | `# im a comment          `|\n| Inline Indentation ('`><\\|`') |     +    |    +    |         | `div > h1 > div > p      `|\n| untouched literal lines ('!') |     +    |    +    |         | `! <-- html comment -->  `|\n| first word as element-name    |     +    |    +    |         | `first word is the tag   `|\n| id attribute ('`tag#id`')     |     +    |    +    |         | `tag#id -> tag id=\"id\"   `|\n| class attribute ('`tag.id`')  |     +    |    +    |         | `tag.cls -> tag class=\"\" `|\n| text-nodes (`' \" '`)          |     +    |    +    |         | `p > \"text -> <p>text</p>`|\n| Macro Expansion (' := ')      |     +    |    +    |         | `MACRONAME := expansion  `|\n| non recursive macro expansion |     +    |         |         |`macroname expanded only once per line`|\n| Macro Imports ('@ . from .')  |     +    |         |         | `@ filename from ./dir   `|\n \n \n## For Developers\n\nStart with `Read.4dev` in the `doc` directory.\n\n\n## Disclaimers\n\nThis **Read.Me** is a link to doc/Read.us!\nThe **License** is in meta/license.\n\n\n## Additional Examples\n\n```t5html\n## t5html\n@@ stdlib.t5i\n\n_SCREEN-500 := \"screen AND (max-width:500px)\"\n\n\n!! HTML5\nhtml\n   head > UTF8 | AUTHOR_splendor | DESC_\"An Example page for the T5HTML-system\" \n      title > \"Example Three \n      FAVICON\n      MEDIA__SCREEN-500 > !! a { background: white }\n      CSS_css/main.css\n      REFRESH_5\n   body\n      header\n         nav.home > button \n      main\n      aside\n      footer\n      template\n         div single-attribute other-attribute\n            A_assets/images/home.png > img src=images/home.png\n\n## vi: set et sw=3 ts=3 ai ft=t5html :\n```\n\nwill be translated into the following, if the stdlib macros are in\n`$HOME/.local/share/t5html` :\n\n```html\n<!DOCTPYE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\"/>\n    <meta name=\"author\" content=\"splendor\"/>\n    <meta name=\"description\" content=\"An Example page for the T5HTML-system\"/>\n    <title>\n      Example Three\n    </title>\n    <link rel=\"icon\" href=\"/favicon.ico\"/>\n    <link rel=\"icon\" href=\"/favicon.svg\" type=\"image/svg+xml\"/>\n    <link rel=\"apple-touch-icon\" href=\"/apple-touch-icon.png\"/>\n    <style type=\"text/css\" media=\"screen AND (max-width:500px)\">\n       a { background: white }\n    </style>\n    <link rel=\"stylesheet\" href=\"css/main.css\"/>\n    <meta http-equiv=\"refresh\" content=\"5\"/>\n  </head>\n  <body>\n    <header>\n      <nav class=\"home\">\n        <button/>\n      </nav>\n    </header>\n    <main/>\n    <aside/>\n    <footer/>\n    <template>\n      <div single-attribute other-attribute>\n        <a href=\"assets/images/home.png\">\n          <img src=\"images/home.png\">\n        </a>\n      </div>\n    </template>\n  </body>\n</html>\n```\n\n\n[//]: # ( vi: set et ts=4 sw=4 ai ft=markdown tw=80 cc=+0 spl=en: )\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Converts text to html. Text muste be in t5html form.",
    "version": "23.6.2",
    "split_keywords": [
        "html",
        "html5",
        "template",
        "templating",
        "web"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d746c837198ffc20a43a7344c608a6793c76272bb70db5110522c1aa4d488371",
                "md5": "3c0a456a541b31af4450ff8c5397e048",
                "sha256": "184511235bf0a4238c8aef1aee1f8ddfe70ea6bd9fdc23d8dd9942af630340b3"
            },
            "downloads": -1,
            "filename": "t5html-23.6.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3c0a456a541b31af4450ff8c5397e048",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11801,
            "upload_time": "2023-02-11T16:55:43",
            "upload_time_iso_8601": "2023-02-11T16:55:43.445592Z",
            "url": "https://files.pythonhosted.org/packages/d7/46/c837198ffc20a43a7344c608a6793c76272bb70db5110522c1aa4d488371/t5html-23.6.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "998a776ba187dd80ae0fb6b669061bf4e6c1ac32848375c8b3c408ad3cd8c755",
                "md5": "066dc3da61338bf1205518ae27cec829",
                "sha256": "a5f47119ae69ff33ba0fe3f8775d79c1f7e0ef06aff65a54415d343de46f4bc3"
            },
            "downloads": -1,
            "filename": "t5html-23.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "066dc3da61338bf1205518ae27cec829",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 18734,
            "upload_time": "2023-02-11T16:55:46",
            "upload_time_iso_8601": "2023-02-11T16:55:46.028895Z",
            "url": "https://files.pythonhosted.org/packages/99/8a/776ba187dd80ae0fb6b669061bf4e6c1ac32848375c8b3c408ad3cd8c755/t5html-23.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-11 16:55:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "t5html"
}
        
Elapsed time: 0.04482s