Skip to content

fix: accept empty comment opener at EOF - #96

Open
mnkj0021 wants to merge 1 commit into
google:mainfrom
mnkj0021:fix/94-unterminated-comment
Open

mnkj0021 wants to merge 1 commit into
google:mainfrom
mnkj0021:fix/94-unterminated-comment

Conversation

@mnkj0021

@mnkj0021 mnkj0021 commented Sep 29, 2026 •

Copy link
Copy Markdown

Fixes #94

Summary

  • treat a bare {# opener at end-of-file as an empty comment, matching Jinja2
  • keep malformed unterminated comments with content (for example {# followed by a space) as errors
  • explicitly advance to EOF so the old unclosed-comment loop cannot return
  • add regression coverage for a bare EOF comment and text immediately before it

Compatibility detail

Jinja2's behavior is narrower than accepting every unterminated comment: a bare {# at EOF renders as an empty comment, while {# followed by content still raises Missing end of comment tag. This change preserves that distinction.

Validation

  • focused SyntaxTest.SimpleCases passed against Minja when the change was prepared
  • the same focused test passed with USE_JINJA2=1 against Jinja2 3.1.6
  • git diff --check passes on the current branch
  • branch is current with upstream main (0 commits behind)
  • Google CLA and the change-detection check pass

The main CI and security-scan workflows are currently action_required and need a Google maintainer to approve the fork workflow run.

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.

Unterminated {# comment is rejected where Jinja2 renders the template

1 participant