{"id":17654886,"url":"https://github.com/ellmetha/django-precise-bbcode","last_synced_at":"2025-04-07T08:16:44.126Z","repository":{"id":600473,"uuid":"13904807","full_name":"ellmetha/django-precise-bbcode","owner":"ellmetha","description":"A Django application for parsing, displaying and editing BBCodes-based text contents.","archived":false,"fork":false,"pushed_at":"2025-01-07T12:07:32.000Z","size":796,"stargazers_count":31,"open_issues_count":21,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-31T07:05:08.907Z","etag":null,"topics":["bbcode","django","parser"],"latest_commit_sha":null,"homepage":"https://django-precise-bbcode.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ellmetha.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-10-27T16:45:03.000Z","updated_at":"2025-02-28T19:09:24.000Z","dependencies_parsed_at":"2024-01-01T17:23:17.253Z","dependency_job_id":"7054a6e4-db39-474e-980b-85c0c61a91e5","html_url":"https://github.com/ellmetha/django-precise-bbcode","commit_stats":{"total_commits":505,"total_committers":7,"mean_commits":72.14285714285714,"dds":0.3386138613861386,"last_synced_commit":"70b653cc69a1f45a5f1dbd69752f3d7a70693011"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-precise-bbcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-precise-bbcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-precise-bbcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-precise-bbcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ellmetha","download_url":"https://codeload.github.com/ellmetha/django-precise-bbcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615382,"owners_count":20967184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bbcode","django","parser"],"created_at":"2024-10-23T12:40:10.975Z","updated_at":"2025-04-07T08:16:44.077Z","avatar_url":"https://github.com/ellmetha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=====================\ndjango-precise-bbcode\n=====================\n\n.. image:: https://readthedocs.org/projects/django-precise-bbcode/badge/?version=stable\n  :target: http://django-precise-bbcode.readthedocs.org/en/stable/\n  :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/l/django-precise-bbcode.svg\n  :target: https://pypi.python.org/pypi/django-precise-bbcode/\n  :alt: License\n\n.. image:: http://img.shields.io/pypi/v/django-precise-bbcode.svg\n  :target: https://pypi.python.org/pypi/django-precise-bbcode/\n  :alt: Latest Version\n\n.. image:: https://github.com/ellmetha/django-precise-bbcode/workflows/CI/badge.svg?branch=develop\n  :target: https://github.com/ellmetha/django-precise-bbcode/actions\n  :alt: Build status\n\n|\n*Django-precise-bbcode* is a Django application providing a way to create textual contents based on BBCodes.\n\n  BBCode is a special implementation of HTML. BBCode itself is similar in style to HTML, tags are enclosed in square brackets [ and ] rather than \u003c and \u003e and it offers greater control over what and how something is displayed.\n\nThis application includes a BBCode compiler aimed to render any BBCode content to HTML and allows the use of BBCodes tags in models, forms and admin forms. The BBCode parser comes with built-in tags (the default ones ; ``b``, ``u``, etc) and allows the use of smilies, custom BBCode placeholders and custom BBCode tags. These can be added in two different ways:\n\n* Custom tags can be defined in the Django administration panel and stored into the database ; doing this allows any non-technical admin to add BBCode tags by defining the HTML replacement string associated with each tag\n* Tags can also be manually registered to be used by the parser by defining a tag class aimed to render a given bbcode tag and its content to the corresponding HTML markup\n\n.. contents:: Table of Contents\n    :local:\n\n\nDocumentation\n-------------\n\nOnline browsable documentation is available at https://django-precise-bbcode.readthedocs.org.\n\n\nRequirements\n------------\n\n* Python 3.6+\n* Django 3.2+\n* PIL or Pillow (required for smiley tags)\n\nInstallation\n------------\n\nJust run:\n\n::\n\n  pip install django-precise-bbcode\n\nOnce installed you can configure your project to use *django-precise-bbcode* with the following steps.\n\nAdd ``precise_bbcode`` to ``INSTALLED_APPS`` in your project's settings module:\n\n.. code-block:: python\n\n  INSTALLED_APPS = (\n      # other apps\n      'precise_bbcode',\n  )\n\nThen install the models:\n\n.. code-block:: shell\n\n  python manage.py migrate\n\nUsage\n-----\n\nRendering bbcodes\n*****************\n\n*Django-precise-bbcode* comes with a BBCode parser that allows you to transform a textual content containing BBCode tags to the corresponding HTML markup. To do this, simply import the ``get_parser`` shortcut and use the ``render`` method of the BBCode parser::\n\n  \u003e\u003e\u003e from precise_bbcode.bbcode import get_parser\n  \u003e\u003e\u003e parser = get_parser()\n  \u003e\u003e\u003e parser.render('[b]Hello [u]world![/u][/b]')\n  '\u003cstrong\u003eHello \u003cu\u003eworld!\u003c/u\u003e\u003c/strong\u003e'\n\n*It's that easy!*\n\nAs you may need to render bbcodes inside one of your Django template, this parser can be used as a template filter or as a template tag after loading ``bbcode_tags``::\n\n  {% load bbcode_tags %}\n  {% bbcode entry.bbcode_content %}\n  {{ \"[b]Write some bbcodes![/b]\"|bbcode }}\n\nThe BBCode content included in the ``entry.bbcode_content``  field will be converted to HTML and displayed. The last statement will output ``\u003cstrong\u003eWrite some bbcodes!\u003c/strong\u003e``.\n\nStoring bbcodes\n***************\n\nWhile you can use the Django built-in ``models.TextField`` to add your BBCode contents to your models, a common need is to store both the BBCode content and the corresponding HTML markup in the database. To address this *django-precise-bbcode* provides a ``BBCodeTextField``.\n\n.. code-block:: python\n\n  from django.db import models\n  from precise_bbcode.fields import BBCodeTextField\n\n  class Post(models.Model):\n      content = BBCodeTextField()\n\nThis field will store both the BBCode content and the correspondign HTML markup. The HTML content of such a field can then be displayed in any template by using its ``rendered`` attribute:\n\n::\n\n  {{ post.content.rendered }}\n\nAnd more...\n***********\n\nHead over to the `documentation \u003chttps://django-precise-bbcode.readthedocs.org\u003e`_ for all the details on how to use the BBCode parser and how to define custom BBcode tags, placeholders and smilies.\n\nAuthors\n-------\n\nMorgan Aubert (`@ellmetha \u003chttps://github.com/ellmetha\u003e`_) and contributors_\n\n.. _contributors: https://github.com/ellmetha/django-precise-bbcode/contributors\n\nLicense\n-------\n\nBSD. See ``LICENSE`` for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fellmetha%2Fdjango-precise-bbcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fellmetha%2Fdjango-precise-bbcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fellmetha%2Fdjango-precise-bbcode/lists"}