From 99ad6130af1649663ac6f490c4c5e78db5a0ee93 Mon Sep 17 00:00:00 2001 From: Dylan Verheul Date: Sun, 31 Dec 2023 09:15:20 +0100 Subject: [PATCH] Update documentation, remove Font Awesome 4 examples --- README.md | 14 +++++++++----- docs/renderers.rst | 5 +++-- docs/settings.rst | 10 ++++------ src/django_icons/renderers/image.py | 2 +- src/django_icons/templatetags/icons.py | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 3c7ff5a..c4a4a0a 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ INSTALLED_APPS = ( DJANGO_ICONS = { "ICONS": { - "edit": {"name": "far fa-pencil"}, + "edit": {"name": "fa-solid fa-pencil"}, }, } ``` @@ -47,26 +47,30 @@ Render an icon in a Django template. ```djangotemplate {% load icons %} + + + + {% icon 'edit' %} ``` -This will generate the FontAwesome 5 pencil icon in regular style. +This will generate the FontAwesome 6 pencil icon in regular style. ```html - + ``` Add extra classes and attributes to your predefined icon. ```djangotemplate {% load icons %} -{% icon 'edit' extra_classes='fa-fw my-own-icon' title='Update' %} +{% icon 'edit' extra_classes='fa-2xs my-extra-class' title='Update' %} ``` These will be added to the HTML output. ```html - + ``` ## Requirements diff --git a/docs/renderers.rst b/docs/renderers.rst index d67825c..32e264b 100644 --- a/docs/renderers.rst +++ b/docs/renderers.rst @@ -6,11 +6,12 @@ What is it? A renderer converts your icon definition to HTML. -This package includes the default renderer `IconRenderer` which renders to an HTML element styled with CSS classes and other attributes, a method used by many icon libraries. +This package includes the default renderer `IconRenderer` which renders to an HTML element styled with CSS classes and other attributes. +This method is used by many icon libraries, such as Font Awesome. You can use a customized renderer to support specific icon libraries or specific code. -This package includes renderers for FontAwesome 4, Bootstrap 3, Material Design and image sets. +This package includes specific renderers for Font Awesome 4, Bootstrap 3, Material Design and image sets. The example app includes a custom SVG renderer. diff --git a/docs/settings.rst b/docs/settings.rst index 00c1332..55c95a1 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -1,7 +1,7 @@ Settings ======== -In your Django ``settings.py`` file, make a dictionary for ``DJANGO_ICONS`` like this: +In your Django ``settings.py`` file, make a dictionary for ``DJANGO_ICONS``. .. code:: Python @@ -9,12 +9,11 @@ In your Django ``settings.py`` file, make a dictionary for ``DJANGO_ICONS`` like DJANGO_ICONS = { "DEFAULTS": { - "renderer": "fontawesome4", + "renderer": "icon", }, "RENDERERS": { - "fontawesome4": "FontAwesome4Renderer", - "bootstrap3": "Bootstrap3Renderer", + "custom-svg": "tests.app.renderers.CustomSvgRenderer", }, "ICONS": { @@ -28,7 +27,7 @@ In your Django ``settings.py`` file, make a dictionary for ``DJANGO_ICONS`` like "renderer": "tests.app.renderers.CustomSvgRenderer", }, "paperplane": { - "renderer": "tests.app.renderers.CustomSvgRenderer", + "renderer": "custom-svg", } }, @@ -36,7 +35,6 @@ In your Django ``settings.py`` file, make a dictionary for ``DJANGO_ICONS`` like The ``DJANGO_ICONS`` dictionary has 3 sections, all of which are optional. - DEFAULTS -------- diff --git a/src/django_icons/renderers/image.py b/src/django_icons/renderers/image.py index 71e423e..312953a 100644 --- a/src/django_icons/renderers/image.py +++ b/src/django_icons/renderers/image.py @@ -41,7 +41,7 @@ def get_image_root(cls): return "special-icons" DJANGO_ICONS = { - "DEFAULTS": {"renderer": "fontawesome4", "attrs": {"aria-hidden": True}}, + "DEFAULTS": {"attrs": {"aria-hidden": True}}, "RENDERERS": { "image": "app.renderers.CustomImageRenderer", }, diff --git a/src/django_icons/templatetags/icons.py b/src/django_icons/templatetags/icons.py index e790dcb..2204449 100644 --- a/src/django_icons/templatetags/icons.py +++ b/src/django_icons/templatetags/icons.py @@ -29,7 +29,7 @@ def icon_tag(name, *args, **kwargs): renderer The renderer to use for the icon - :default: The default renderer as per ``settings.py``, or ultimately `FontAwesome4Renderer`. + :default: The default renderer as per ``settings.py``, or ultimately `IconRenderer`. **Usage**::