DjangoGirls / tutorial-extensions

Additional tasks for tutorial
https://tutorial-extensions.djangogirls.org
Other
162 stars 202 forks source link

Code samples are not displaying django tags correctly in the 'Homework' extension #151

Closed helenb closed 1 year ago

helenb commented 1 year ago

Issue description

When viewing the homework extension project, the code samples are not displaying django tags correctly. I have given an example below, but this is an issue throughout the tutorial.

Example url: https://tutorial-extensions.djangogirls.org/en/homework_create_more_models Example code sample on the above page:

<div data-gb-custom-block data-tag="for"></div>

    <div class="comment">
        <div class="date">{{ comment.created_date }}</div>
        <strong>{{ comment.author }}</strong>
        <p>{{ comment.text|linebreaks }}</p>
    </div>

<div data-gb-custom-block data-tag="empty">

    <p>No comments here yet :(</p>

</div>

What this should display (I think):

{% if comments %}
        {% for comment in comments%}
            <div class="comment">
                <div class="date">{{ comment.created_date }}</div>
                <strong>{{ comment.author }}</strong>
                <p>{{ comment.text|linebreaks }}</p>
            </div>
        {% endfor %}
    {% else %}
        <p>No comments have been added</p>
    {% endif %}

Language

Is this related to a specific language of the tutorial? I am viewing it in English - I suspect this is not language specific though as it relates to code.

Operating system

What operating system does this issue relate to? I am viewing the tutorial in the latest version of Chrome on a Mac running Big Sur.

ekohl commented 1 year ago

I don't have permissions to move this, but that's https://github.com/DjangoGirls/tutorial-extensions. It probably has to do with the conversion to the new major version of GitBook.

helenb commented 1 year ago

Thank you @ekohl. It looks like there is already an issue logged about this on the https://github.com/DjangoGirls/tutorial-extensions repo so I will close this.

das-g commented 1 year ago

The problem probably is that GitBook is mistaking Django template tags for GitBook template tags. This used to be an issue for inline code snippets within prose (enclosed in `) but now (other than previously, IIRC) also in code blocks (enclosed in ```).

I guess it can be fixed by wrapping the concerning code blocks in {% raw %}[…]{% endraw %}.