{"id":13502506,"url":"https://github.com/edoburu/django-template-analyzer","last_synced_at":"2025-04-11T16:51:42.266Z","repository":{"id":1987881,"uuid":"2920114","full_name":"edoburu/django-template-analyzer","owner":"edoburu","description":"Extract template nodes from a Django template","archived":false,"fork":false,"pushed_at":"2023-10-16T12:27:17.000Z","size":81,"stargazers_count":51,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T01:32:55.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/edoburu.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-12-05T21:37:39.000Z","updated_at":"2024-11-28T16:29:24.000Z","dependencies_parsed_at":"2024-06-20T00:08:00.328Z","dependency_job_id":null,"html_url":"https://github.com/edoburu/django-template-analyzer","commit_stats":{"total_commits":68,"total_committers":2,"mean_commits":34.0,"dds":"0.044117647058823484","last_synced_commit":"de7d0f914c7794c7720d169addbd39663bf6a1e1"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-template-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-template-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-template-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-template-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edoburu","download_url":"https://codeload.github.com/edoburu/django-template-analyzer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248443060,"owners_count":21104330,"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":[],"created_at":"2024-07-31T22:02:16.187Z","updated_at":"2025-04-11T16:51:42.241Z","avatar_url":"https://github.com/edoburu.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"django-template-analyzer\n========================\n\n.. image:: https://github.com/edoburu/django-template-analyzer/actions/workflows/tests.yaml/badge.svg?branch=master\n    :target: https://github.com/edoburu/django-template-analyzer/actions/workflows/tests.yaml\n.. image:: https://img.shields.io/pypi/v/django-template-analyzer.svg\n    :target: https://pypi.python.org/pypi/django-template-analyzer/\n.. image:: https://img.shields.io/badge/wheel-yes-green.svg\n    :target: https://pypi.python.org/pypi/django-template-analyzer/\n.. image:: https://img.shields.io/codecov/c/github/edoburu/django-template-analyzer/master.svg\n    :target: https://codecov.io/github/edoburu/django-template-analyzer?branch=master\n\nThe ``template_analyzer`` package offers an API to analyze the Django template structure.\nIt can be used to find nodes of a particular type, e.g. to do automatic detection of placeholder tags.\n\nSupported features\n==================\n\nThe scanner finds tags in various situations, including:\n\n* Extend nodes\n* Include nodes\n* Overwritten blocks with new definitions\n* Blocks with or without ``{{ block.super }}``\n* Reorganized blocks\n* Ignoring nodes outside blocks in extending templates\n* Handling multiple levels of super includes\n\nThe returned nodes are provided in a natural ordering,\nas they would be expected to appear in the outputted page.\n\nWhile Django offers a ``template.nodelist.get_nodes_of_type()`` function,\nthis function does not produce the same results.\n\n\nAPI example\n===========\n\n.. code-block:: python\n\n    from django.template.loader import get_template\n    from mycms.templatetags.placeholdertags import Placeholder\n    from template_analyzer.djangoanalyzer import get_node_instances\n\n    # Load a Django template\n    template = get_template(\"mycms/default-page.html\")\n\n    # Find all tags in the template:\n    placeholders = get_node_instances(template, Placeholder)\n\n    # Read information from the template tag themselves:\n    # (this is an example, accessing a custom method on the Placeholder object)\n    placeholder_names = [p.get_name() for p in placeholders]\n\nInstallation\n============\n\nFirst install the module, preferably in a virtual environment. It can be installed from PyPI::\n\n    pip install django-template-analyzer\n\nOr the current folder can be installed::\n\n    pip install .\n\nCredits\n=======\n\n* This package is based on the work of\n  `Django CMS \u003chttp://www.django-cms.org\u003e`_. \n* Many thanks to the contributors of ``cms/utils/placeholder.py`` / ``cms/utils/plugins.py`` in Django CMS!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedoburu%2Fdjango-template-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedoburu%2Fdjango-template-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedoburu%2Fdjango-template-analyzer/lists"}