{ "info": { "author": "Piotr Malinski", "author_email": "riklaunim@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-content-bbcode\n=====================\n\nBBCode alike parser for Django applications.\n\nThis application is based on tag parser I use on my rk.edu.pl sites. It's very similar to BBCode although it's designed\nto support more advanced tags giving more complex output. My usage examples:\n\n* put a link to article by given slug (depending if the article is a category or a page different styles may apply)\n* highlight code block in articles\n* insert a thumbnail of image given by relative path from media (with optional alt text, size, headline etc.)\n\n```\n[rk:syntax lang=\"bash\"]\nexport WORKON_HOME=~/Envs\nmkdir -p $WORKON_HOME\nsource /usr/local/bin/virtualenvwrapper.sh\n[/rk:syntax]\n```\n\nOr:\n\n```\n[rk:art slug=\"some-article-slug\"]\n```\n\nSo it's BBCode that calls some Python code, Django ORM even and returns dynamic output.\n\n\nHow to use it\n-------------\n* You can install it from pypi:\n```\npip install django-content-bbcode\n```\n\n* Add 'content_bbcode' to INSTALLED_APPS\n* You will get 'parse_content_bbcode' templatetag you can use in your templates on text which should have tags parsed:\n```\n{% load parse_content_bbcode %}\n{{ article.text|parse_content_bbcode|safe }}\n```\n\nIn code usage\n-------------\n\nYou can also manually parse tags:\n```\nparser = cbcparser.ContentBBCodeParser()\nresult = parser.parse_tags(some_text)\n```\n\nSetup and usage\n-------------\nYou will have to define parsers for tags you will want to use. The application will look for **tags.py** files in every\napplication from INSTALLED_APPS. In that file it will look for **registered_tags** dictionary.\n\nExample: https://github.com/riklaunim/django-content-bbcode/blob/master/content_bbcode_demo/demo_application/tags.py\n\n* Dictionary key is the tag *name* like *rk:art* would have *art* as name.\n* Dictionary value would be a callable, usually a function taking two arguments: list of dictionaries and text\n\n* The text is the text in which we replace the tags\n* The list of dictionaries is a list of all occurrences of given tag\n\n\nThe dictionary from the occurrences list has few keys:\n* tag: the tag we need to replace\n* attributes: all key-value attributes given to the tag\n* code: will be only for double tags (those with opening and closing tag)\n\n```\n[rk:mytag]code[/rk:mytag]\n```\n\n\nIn general you would iter over the list and replace every tag with something.\n\nIn the the end the callable should return modified text.\n\nIf you want to place tags.py in different location, then you can define ``CONTENT_BBCODE_SCAN_MODULES`` as a dictionary of 'app_name': 'module_location'.\n\nTo change the default tag prefix from ``rk`` set ``CONTENT_BBCODE_PREFIX`` in your settings.py\n\n\nRunning tests\n-------------\nTests are in the content_bbcode_demo.demo_application. Clone the repo and run:\n\n```\npip install -r demo_requirements.txt\n```\n\nDirect test run:\n\n```\npython manage.py test content_bbcode_demo\n```\n\nTesting on Python 2.7 and 3.6 with tox:\n\n```\ntox\n```\n\nProject status\n--------------\nAt the moment the code is just after pulling it out of my site code. It still needs some refactors/cleanups and quite likely regexp improvements,\nbut it works, at least it should :)\n\nI'll try to post, commit somewhere some real tags, like the pygments syntax highlighting and so on.\n\nYou can check the issues page for current ToDo list. I'm also interested in your feedback, suggestions and pull requests :)\n\n\nCredits\n-------\n* tags loader was inspired by https://github.com/pozytywnie/django-javascript-settings configuration loader", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/riklaunim/django-content-bbcode", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-content-bbcode", "package_url": "https://pypi.org/project/django-content-bbcode/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-content-bbcode/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/riklaunim/django-content-bbcode" }, "release_url": "https://pypi.org/project/django-content-bbcode/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Advanced BBCode alike tags parser", "version": "0.1.1" }, "last_serial": 2812270, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "5d510106404f6bf352e8a5e546899e14", "sha256": "0031aa0ff2694cbbea6512cf85b8beaeb510f4be7dc42b8d95ba22edc329fec8" }, "downloads": -1, "filename": "django-content-bbcode-0.0.1.tar.gz", "has_sig": false, "md5_digest": "5d510106404f6bf352e8a5e546899e14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4458, "upload_time": "2014-03-08T23:53:47", "url": "https://files.pythonhosted.org/packages/05/41/0eb861639aa488217db63fd2e725291f46b58445167469d2fa4213c57bbb/django-content-bbcode-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "36218dc9001177f4a5d52593b8fc0d55", "sha256": "5e9d3817813bc68523a2912229413aa75bcf5b7cfbc95e1b091a63cde3e9be35" }, "downloads": -1, "filename": "django-content-bbcode-0.0.2.tar.gz", "has_sig": false, "md5_digest": "36218dc9001177f4a5d52593b8fc0d55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4459, "upload_time": "2016-08-21T22:55:47", "url": "https://files.pythonhosted.org/packages/50/a8/2a72afff2e328b829fe8dac70b7b2e10b155382ed452e43e23a8c9264b83/django-content-bbcode-0.0.2.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "4558d6e37abbd3a836def0b71337a3c0", "sha256": "99058d9a8695930b9318ab32e9bd918ca878ccdadc528eaef7751d47d6a9374e" }, "downloads": -1, "filename": "django-content-bbcode-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4558d6e37abbd3a836def0b71337a3c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4705, "upload_time": "2017-04-17T21:32:40", "url": "https://files.pythonhosted.org/packages/c5/b6/1c5113f289a5a9e1bca732108c7716ec63b2797edf627a0e3888ada7f270/django-content-bbcode-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6db2c9f210d7a2b0a3c2b232ef86d5a0", "sha256": "f002726c9fecc2fa791edde149bd64c8bc8c43740a2759255b7415cf1865e11e" }, "downloads": -1, "filename": "django-content-bbcode-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6db2c9f210d7a2b0a3c2b232ef86d5a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4708, "upload_time": "2017-04-18T21:33:22", "url": "https://files.pythonhosted.org/packages/8b/5a/c0d918ee7921851aea0613f3b68c93d56dfbd5009ba4b284e04af928457e/django-content-bbcode-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6db2c9f210d7a2b0a3c2b232ef86d5a0", "sha256": "f002726c9fecc2fa791edde149bd64c8bc8c43740a2759255b7415cf1865e11e" }, "downloads": -1, "filename": "django-content-bbcode-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6db2c9f210d7a2b0a3c2b232ef86d5a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4708, "upload_time": "2017-04-18T21:33:22", "url": "https://files.pythonhosted.org/packages/8b/5a/c0d918ee7921851aea0613f3b68c93d56dfbd5009ba4b284e04af928457e/django-content-bbcode-0.1.1.tar.gz" } ] }