mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Add function to escape Jinja2 syntax in text content
This commit is contained in:
@@ -1809,6 +1809,25 @@ def commentary(request: Request, book: str, chapter: int):
|
||||
)
|
||||
|
||||
|
||||
def escape_jinja2_syntax(text):
|
||||
"""Escape Jinja2 syntax in text to prevent template parsing errors"""
|
||||
if not text:
|
||||
return text
|
||||
|
||||
# Escape Jinja2 block tags
|
||||
text = text.replace('{%', '{%')
|
||||
text = text.replace('%}', '%}')
|
||||
|
||||
# Escape Jinja2 variable tags
|
||||
text = text.replace('{{', '{{')
|
||||
text = text.replace('}}', '}}')
|
||||
|
||||
# Escape Jinja2 comment tags
|
||||
text = text.replace('{#', '{#')
|
||||
text = text.replace('#}', '#}')
|
||||
|
||||
return text
|
||||
|
||||
def generate_commentary(book, chapter, verse):
|
||||
"""Generate AI-powered commentary for a specific verse"""
|
||||
# Enhanced commentary database for major chapters
|
||||
|
||||
@@ -192,7 +192,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
.chapter-container {
|
||||
position: relative;
|
||||
|
||||
Reference in New Issue
Block a user