woshi


Namewoshi JSON
Version 2.1.3 PyPI version JSON
download
home_page
SummaryOn-the-go HTML Abstraction and Generator for Python
upload_time2023-01-21 14:38:43
maintainer
docs_urlNone
authorRodney Maniego Jr.
requires_python>=3.10
licenseLICENSE.txt
keywords html abstraction template python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # woshi
On-the-go HTML Abstraction and Generator for Python.

Woshi is simple, it abstracts XML nesting and leverages CSS3 selectors to append elements into the HTML document!

Version 2.0 is a breaking upgrade, which means the general usage and the internal algorithms were change to make it more flexible and lighter. The package lxml was removed in favor of a custom-made builder function. Only simple CSS3 selectors are supported, but will add support in the upcoming versions.

Here's a sample syntax:
```python
page["tag#id"] = "tag #id.class property='10' > inner text"
```
And scroll down below for more examples.

## Official Release
Current version is 2.0, but more updates are coming soon. Compatible with Python 3.10 or later.

`pip install woshi`


## Usage
**Import Package**
```python
from woshi import Woshi
```

**Initialization**
```python
page = Woshi()

# initializing with a valid HTML text
page = Woshi("<div></div>")

# setting up filename
page = Woshi(filepath="home.html")
```

**Creating elements with an inner text**
```python
page["head"] = "title > Woshi v1.0"
```

**Creating other elements**
Basically, you set the parent selector to append the new element.
```python
# create container box
page["body"] = "div #content"
page["#content"] = "div #box.container.light"

# create the popup text
page["#box"] = "div #title.header > Woshi"
page["#box"] = "div .message data-default='Lorem ipsum...' > Hello, world!"

# populate the action buttons
page["#box"] = "div #action.btn-list"
page["#action"] = "button #btn1.btn.btn-no style='background-color:#b22222;color:#fff;' > CLOSE"
page["#action"] = "button #btn2.btn.btn-maybe > LATER"
```

**Setting Properties**
```python
page["html"] = "lang=en"
page["body"] = "#canvas"
```

**Yield all matches**
```python
for match in page["button"]:
    print(match)
```

**Save to HTML file**
```python
page.save()
page.save("newFile.html")
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "woshi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "html,abstraction,template,python",
    "author": "Rodney Maniego Jr.",
    "author_email": "rodney.maniegojr@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f4/09/66a1425cd5400b09063ebfad205dbc677a4936a9d54ce38f37c2e6b6c624/woshi-2.1.3.tar.gz",
    "platform": null,
    "description": "# woshi\nOn-the-go HTML Abstraction and Generator for Python.\n\nWoshi is simple, it abstracts XML nesting and leverages CSS3 selectors to append elements into the HTML document!\n\nVersion 2.0 is a breaking upgrade, which means the general usage and the internal algorithms were change to make it more flexible and lighter. The package lxml was removed in favor of a custom-made builder function. Only simple CSS3 selectors are supported, but will add support in the upcoming versions.\n\nHere's a sample syntax:\n```python\npage[\"tag#id\"] = \"tag #id.class property='10' > inner text\"\n```\nAnd scroll down below for more examples.\n\n## Official Release\nCurrent version is 2.0, but more updates are coming soon. Compatible with Python 3.10 or later.\n\n`pip install woshi`\n\n\n## Usage\n**Import Package**\n```python\nfrom woshi import Woshi\n```\n\n**Initialization**\n```python\npage = Woshi()\n\n# initializing with a valid HTML text\npage = Woshi(\"<div></div>\")\n\n# setting up filename\npage = Woshi(filepath=\"home.html\")\n```\n\n**Creating elements with an inner text**\n```python\npage[\"head\"] = \"title > Woshi v1.0\"\n```\n\n**Creating other elements**\nBasically, you set the parent selector to append the new element.\n```python\n# create container box\npage[\"body\"] = \"div #content\"\npage[\"#content\"] = \"div #box.container.light\"\n\n# create the popup text\npage[\"#box\"] = \"div #title.header > Woshi\"\npage[\"#box\"] = \"div .message data-default='Lorem ipsum...' > Hello, world!\"\n\n# populate the action buttons\npage[\"#box\"] = \"div #action.btn-list\"\npage[\"#action\"] = \"button #btn1.btn.btn-no style='background-color:#b22222;color:#fff;' > CLOSE\"\npage[\"#action\"] = \"button #btn2.btn.btn-maybe > LATER\"\n```\n\n**Setting Properties**\n```python\npage[\"html\"] = \"lang=en\"\npage[\"body\"] = \"#canvas\"\n```\n\n**Yield all matches**\n```python\nfor match in page[\"button\"]:\n    print(match)\n```\n\n**Save to HTML file**\n```python\npage.save()\npage.save(\"newFile.html\")\n```\n",
    "bugtrack_url": null,
    "license": "LICENSE.txt",
    "summary": "On-the-go HTML Abstraction and Generator for Python",
    "version": "2.1.3",
    "split_keywords": [
        "html",
        "abstraction",
        "template",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f406cf765ba8f90fdc97e64ee2e5f9d742e390619b9ca0895fa092e8307298fd",
                "md5": "1dd14e434862bf06a564e85047fc3b34",
                "sha256": "36be0c589b3c19f57bdbbcf0564efbf224550d02886eb26174daaad1efdd8fa5"
            },
            "downloads": -1,
            "filename": "woshi-2.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1dd14e434862bf06a564e85047fc3b34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10672,
            "upload_time": "2023-01-21T14:38:37",
            "upload_time_iso_8601": "2023-01-21T14:38:37.289294Z",
            "url": "https://files.pythonhosted.org/packages/f4/06/cf765ba8f90fdc97e64ee2e5f9d742e390619b9ca0895fa092e8307298fd/woshi-2.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f40966a1425cd5400b09063ebfad205dbc677a4936a9d54ce38f37c2e6b6c624",
                "md5": "f02bb74f3345d1d5db3b97388fb278d4",
                "sha256": "74f5475362971ee3e9e0eacc220207d865d9f70c26deb50ca546f7770d862500"
            },
            "downloads": -1,
            "filename": "woshi-2.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f02bb74f3345d1d5db3b97388fb278d4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 10821,
            "upload_time": "2023-01-21T14:38:43",
            "upload_time_iso_8601": "2023-01-21T14:38:43.480350Z",
            "url": "https://files.pythonhosted.org/packages/f4/09/66a1425cd5400b09063ebfad205dbc677a4936a9d54ce38f37c2e6b6c624/woshi-2.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-21 14:38:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "woshi"
}
        
Elapsed time: 0.03505s