diff --git a/app.py b/app.py index c8bac04..29e0518 100644 --- a/app.py +++ b/app.py @@ -117,8 +117,6 @@ def post_detail(post_id): return "Post not found", 404 comments = get_comments_for_post(post_id) - if post_id == 2: - return render_template('post_detail_test.html', post=post, comments=comments, blog_title = TITLE) return render_template('post_detail.html', post=post, comments=comments, blog_title = TITLE) diff --git a/content b/content index 5dcd5bd..bf7589d 160000 --- a/content +++ b/content @@ -1 +1 @@ -Subproject commit 5dcd5bdcee80548c8f4bdb399ea684d04413f339 +Subproject commit bf7589d017ab8d6b7dd82f5e2c3f395435153a5e diff --git a/templates/components/image.html b/templates/components/image.html index eb7ea16..c206a34 100644 --- a/templates/components/image.html +++ b/templates/components/image.html @@ -1,4 +1,3 @@
-

...

{{ alt or 'image' }}
diff --git a/templates/components/post_renderer.html b/templates/components/post_renderer.html index 7ab0693..cfe5823 100644 --- a/templates/components/post_renderer.html +++ b/templates/components/post_renderer.html @@ -1,12 +1,10 @@ {% macro render_post(post) %} -
{{ post.content | safe }}
-{% if post.template %} {% include post.template %} {% endif %} {% endmacro %} {% -macro render_test(post) %}
- {% for block in post.content %} {% if block.type == "image" %} {% with - src=url_for('content_image_files', filename=block.src) %} {% include - "components/image.html" %} {% endwith %} {% elif block.type == "text" %} -

{{ block.value }}

- {% endif %} {% endfor %} + {% if post.content is iterable and post.content is not string %} {# content is + [] → render blocks #} {% for block in post.content %} {% if block.type == + "image" %} {% with src=url_for('content_image_files', filename=block.src) %} + {% include "components/image.html" %} {% endwith %} {% elif block.type == + "text" %} {{ block.value | safe }} {% endif %} {% endfor %} {% else %} {# + content is """...""" → render HTML #} {{ post.content | safe }} {% endif %}
-{% endmacro %} +{% if post.template %} {% include post.template %} {% endif %} {% endmacro %} diff --git a/templates/posts/post_2.html b/templates/posts/post_2.html deleted file mode 100644 index ed5fb39..0000000 --- a/templates/posts/post_2.html +++ /dev/null @@ -1,5 +0,0 @@ -{% for block in post.content %} {% if block.type == "image" %} {% include -"components/image.html" with src=url_for('content_image_files', -filename=block.src) %} {% elif block.type == "text" %} -

{{ block.value }}

-{% endif %} {% endfor %}