Skip to content

Add support for middle tags in --extra-block flag#130

Merged
JaapJoris merged 3 commits intortts:mainfrom
RoscaS:extra-middle-tags
Mar 26, 2026
Merged

Add support for middle tags in --extra-block flag#130
JaapJoris merged 3 commits intortts:mainfrom
RoscaS:extra-middle-tags

Conversation

@RoscaS
Copy link
Copy Markdown
Contributor

@RoscaS RoscaS commented Mar 26, 2026

The -b/--extra-block flag now accepts additional comma-separated values after the start and end tags. These are treated as "close-and-open" (middle) tags, similar to Django built-in {% else %} and {% elif %}.

Usage: djhtml -b "if_has_right,end_if_has_right,else_has_right,elif_has_right" template.html

This is useful for projects with custom Django template tags that have middle tags (e.g.: {% else_has_right %}), which should be indented at the same level as the opening tag rather than as block content.

@JaapJoris JaapJoris self-requested a review March 26, 2026 15:37
@JaapJoris JaapJoris merged commit eb8da5b into rtts:main Mar 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants