wagtailset


Namewagtailset JSON
Version 1.1.1 PyPI version JSON
download
home_page
SummaryWagtail anchors set
upload_time2023-09-10 21:07:02
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License
keywords wagtail draftail anchors
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">Wagtail set</h1>

<p align="center">
<a href="https://pypi.org/project/wagtailset"><img alt="PyPI" src="https://img.shields.io/pypi/v/wagtailset?color=blue"></a>
<a href="https://pypi.org/project/wagtailset"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/wagtailset?color=blue"></a>
<a href="https://pypi.org/project/wagtailset"><img alt="PyPI - License" src="https://img.shields.io/pypi/l/wagtailset?color=blue"></a>
<a href="https://github.com/dest81/wagtailset"><img alt="Lines of code" src="https://tokei.rs/b1/github/dest81/wagtailset?category=lines"></a>
<a href="https://pypi.org/project/wagtailset"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/wagtailset?color=blue"></a>
<a href="https://github.com/dest81/wagtailset/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/dest81/wagtailset?color=blue"></a>
</p>

<h4 align="center">Wagtail anchors set.</h4>

## Installation

Install using `pip`:

```
pip install wagtailset
```

## Table of Contents

 - [ Wagtail draftail anchors](#wagtail_draftail_anchors)
 - [ Wagtail draftail anchored internal links](#wagtail_draftail_anchored_internal_links)

<div id="wagtail_draftail_anchors" />

## Wagtail Draftail Anchors

Adds the ability to add and edit anchors in the Draftail rich text editor, as well as automatically adding (slug-form) anchor ids to all headings with possibility to changes heading ids. Inspired by [wagtail_draftail_anchors](https://github.com/jacobtoppm/wagtail_draftail_anchors) with some improvements like possibility to edit previous anchor id and headings' ids.


### Instalation

Add `'wagtailset.draftail_anchors'` to `INSTALLED_APPS` below `wagtail.admin`.

Add `'anchor-identifier'` to the features of any rich text field where you have overridden the default feature list.
 **Note:** 'anchor-identifier' must be added before any heading('h1',...,'h6') feature and also before 'link' feature:

```
body = RichTextField(features=['anchor-identifier', 'h2', 'h3', 'bold', 'italic', 'link'])
```


### Rendered representation of anchors

By default, `anchor-identifier` rich text entities will be rendered as HTML `anchor` elements, e.g.:

``` html
<a href="#my-element" id="my-element" data-id="my-element">My element</a>
```


### Configuration

This package provides an alternative renderer that renders `anchor-identifier` entities as HTML `span` elements, e.g.:

``` html
<span id="my-element">My element</span>
```

The desired renderer can be specified using the `DRAFTAIL_ANCHORS_RENDERER` setting. To use the `span` renderer, configure your application as follows:

``` python
DRAFTAIL_ANCHORS_RENDERER = "wagtail_draftail_anchors.rich_text.render_span"
```

It is possible to define your own renderer. It should be a callable that takes a `dict` of attributes, and returns a string containing the opening tag of the HTML element that represents the anchor target. The `dict` passed to the renderer, for an anchor with an identifier of `"my-anchor"`, would look like the following:

``` python
{"data-id": "my-anchor", "href": "#my-anchor", "id": "my-anchor", "linktype": "my-anchor"}
```

If you define your own renderer, you should set the value of `DRAFTAIL_ANCHORS_RENDERER` to your custom renderer's import path.

See `render_span` and `render_a` in `wagtail_draftail_anchors.rich_text` for examples.

<div id="wagtail_draftail_anchored_internal_links" />


## Wagtail Draftail Anchored Internal Links

Adds the ability to add (and edit) anchors to the internal links in the Draftail rich text editor.

### Instalation

Installed by default. No extra configuration needed.


### How it works

**Add anchor to the internal link:**
![Add anchor to the internal link](docs/images/add_anchor_link.png)

**Edit anchor of the internal link:**
![Edit anchor of the internal link](docs/images/edit_anchor_link.png)


### Rendered representation of anchors

By default, `link` rich text entities will be rendered as HTML with anchor in the end if it is set, e.g.:

**Database representation:**
``` html
<a hash="header-1" id="3" linktype="page">bla</a>
```

**HTML representation:**
``` html
<a href="/page3/#header-1">bla</a>
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "wagtailset",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "wagtail,draftail,anchors",
    "author": "",
    "author_email": "Ihor Marhytich <dest81@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e8/54/8d23b20f2dd6cf189aa6d19b20fa579d0b30f02a47d7ff10ccdc34805ca8/wagtailset-1.1.1.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">Wagtail set</h1>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/wagtailset\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/wagtailset?color=blue\"></a>\n<a href=\"https://pypi.org/project/wagtailset\"><img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/wagtailset?color=blue\"></a>\n<a href=\"https://pypi.org/project/wagtailset\"><img alt=\"PyPI - License\" src=\"https://img.shields.io/pypi/l/wagtailset?color=blue\"></a>\n<a href=\"https://github.com/dest81/wagtailset\"><img alt=\"Lines of code\" src=\"https://tokei.rs/b1/github/dest81/wagtailset?category=lines\"></a>\n<a href=\"https://pypi.org/project/wagtailset\"><img alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/wagtailset?color=blue\"></a>\n<a href=\"https://github.com/dest81/wagtailset/graphs/contributors\"><img alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/dest81/wagtailset?color=blue\"></a>\n</p>\n\n<h4 align=\"center\">Wagtail anchors set.</h4>\n\n## Installation\n\nInstall using `pip`:\n\n```\npip install wagtailset\n```\n\n## Table of Contents\n\n - [ Wagtail draftail anchors](#wagtail_draftail_anchors)\n - [ Wagtail draftail anchored internal links](#wagtail_draftail_anchored_internal_links)\n\n<div id=\"wagtail_draftail_anchors\" />\n\n## Wagtail Draftail Anchors\n\nAdds the ability to add and edit anchors in the Draftail rich text editor, as well as automatically adding (slug-form) anchor ids to all headings with possibility to changes heading ids. Inspired by [wagtail_draftail_anchors](https://github.com/jacobtoppm/wagtail_draftail_anchors) with some improvements like possibility to edit previous anchor id and headings' ids.\n\n\n### Instalation\n\nAdd `'wagtailset.draftail_anchors'` to `INSTALLED_APPS` below `wagtail.admin`.\n\nAdd `'anchor-identifier'` to the features of any rich text field where you have overridden the default feature list.\n **Note:** 'anchor-identifier' must be added before any heading('h1',...,'h6') feature and also before 'link' feature:\n\n```\nbody = RichTextField(features=['anchor-identifier', 'h2', 'h3', 'bold', 'italic', 'link'])\n```\n\n\n### Rendered representation of anchors\n\nBy default, `anchor-identifier` rich text entities will be rendered as HTML `anchor` elements, e.g.:\n\n``` html\n<a href=\"#my-element\" id=\"my-element\" data-id=\"my-element\">My element</a>\n```\n\n\n### Configuration\n\nThis package provides an alternative renderer that renders `anchor-identifier` entities as HTML `span` elements, e.g.:\n\n``` html\n<span id=\"my-element\">My element</span>\n```\n\nThe desired renderer can be specified using the `DRAFTAIL_ANCHORS_RENDERER` setting. To use the `span` renderer, configure your application as follows:\n\n``` python\nDRAFTAIL_ANCHORS_RENDERER = \"wagtail_draftail_anchors.rich_text.render_span\"\n```\n\nIt is possible to define your own renderer. It should be a callable that takes a `dict` of attributes, and returns a string containing the opening tag of the HTML element that represents the anchor target. The `dict` passed to the renderer, for an anchor with an identifier of `\"my-anchor\"`, would look like the following:\n\n``` python\n{\"data-id\": \"my-anchor\", \"href\": \"#my-anchor\", \"id\": \"my-anchor\", \"linktype\": \"my-anchor\"}\n```\n\nIf you define your own renderer, you should set the value of `DRAFTAIL_ANCHORS_RENDERER` to your custom renderer's import path.\n\nSee `render_span` and `render_a` in `wagtail_draftail_anchors.rich_text` for examples.\n\n<div id=\"wagtail_draftail_anchored_internal_links\" />\n\n\n## Wagtail Draftail Anchored Internal Links\n\nAdds the ability to add (and edit) anchors to the internal links in the Draftail rich text editor.\n\n### Instalation\n\nInstalled by default. No extra configuration needed.\n\n\n### How it works\n\n**Add anchor to the internal link:**\n![Add anchor to the internal link](docs/images/add_anchor_link.png)\n\n**Edit anchor of the internal link:**\n![Edit anchor of the internal link](docs/images/edit_anchor_link.png)\n\n\n### Rendered representation of anchors\n\nBy default, `link` rich text entities will be rendered as HTML with anchor in the end if it is set, e.g.:\n\n**Database representation:**\n``` html\n<a hash=\"header-1\" id=\"3\" linktype=\"page\">bla</a>\n```\n\n**HTML representation:**\n``` html\n<a href=\"/page3/#header-1\">bla</a>\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Wagtail anchors set",
    "version": "1.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/dest81/wagtailset/issues",
        "Homepage": "https://github.com/dest81/wagtailset"
    },
    "split_keywords": [
        "wagtail",
        "draftail",
        "anchors"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46226a86c735095a2546011a94bdb7480fbf3184bbe09e6171b1e82bf9818eff",
                "md5": "143fefc3d1869e55106a51120a65970e",
                "sha256": "c263e29624c38f1a262ac48712672508566bd7ffb971f9930bd985cf1f29d8db"
            },
            "downloads": -1,
            "filename": "wagtailset-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "143fefc3d1869e55106a51120a65970e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 18786,
            "upload_time": "2023-09-10T21:06:59",
            "upload_time_iso_8601": "2023-09-10T21:06:59.960956Z",
            "url": "https://files.pythonhosted.org/packages/46/22/6a86c735095a2546011a94bdb7480fbf3184bbe09e6171b1e82bf9818eff/wagtailset-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8548d23b20f2dd6cf189aa6d19b20fa579d0b30f02a47d7ff10ccdc34805ca8",
                "md5": "e50c5422b300256450b0c114653b0150",
                "sha256": "3bb95ac3d98dd2782432e028f336ad79248b688e3ef88bf61c0b991587a2d4fa"
            },
            "downloads": -1,
            "filename": "wagtailset-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e50c5422b300256450b0c114653b0150",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 19731,
            "upload_time": "2023-09-10T21:07:02",
            "upload_time_iso_8601": "2023-09-10T21:07:02.052088Z",
            "url": "https://files.pythonhosted.org/packages/e8/54/8d23b20f2dd6cf189aa6d19b20fa579d0b30f02a47d7ff10ccdc34805ca8/wagtailset-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-10 21:07:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dest81",
    "github_project": "wagtailset",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "wagtailset"
}
        
Elapsed time: 0.12336s