make book-view collections and subcollections as markdown titles #170

This commit is contained in:
SvyatoslavArtymovych 2023-06-20 15:29:21 +03:00
parent df1a447b34
commit cb3f6d4467
3 changed files with 16 additions and 6 deletions

View File

@ -79,9 +79,19 @@ def build_qa_url_using_interpretation(interpretation: m.Interpretation):
# Using: {{ recursive_render("template.html", collection=collection, book=book) }}
def recursive_render(
template: str, collection: m.Collection, book: m.Book, version: m.BookVersion = None
template: str,
collection: m.Collection,
book: m.Book,
version: m.BookVersion = None,
loop_index: int = 1,
):
return render_template(template, collection=collection, book=book, version=version)
return render_template(
template,
collection=collection,
book=book,
version=version,
loop_index=loop_index,
)
# Using: {{ has_permission(entity=book, required_permissions=[Access.create]) }}

View File

@ -214,7 +214,7 @@
{% if not collection.active_sections and not collection.active_children %}
<p class="ml-3 my-3 italic text-sm">Collection is empty</p>
{% endif %}
{{recursive_render("book/components/sub_collection_preview_content.html",collection,book,version)|safe}}
{{recursive_render("book/components/sub_collection_preview_content.html",collection,book,version,2)|safe}}
{% endfor %}
</div>
<!-- prettier-ignore -->

View File

@ -4,7 +4,7 @@
{% for sub_collection in collection.active_children if not sub_collection.is_deleted%}
<p class="my-3 font-bold text-justify" id="collection-{{sub_collection.label}}">
##{{sub_collection.label}}
{{ "#" * loop_index }} {{sub_collection.label}}
</p>
<!-- prettier-ignore -->
{% if not sub_collection.active_sections and not sub_collection.active_children%}
@ -12,7 +12,7 @@
{% endif %}
<!-- prettier-ignore -->
{% if sub_collection.active_children %}
{{recursive_render("book/components/sub_collection_preview_content.html",sub_collection,book)|safe}}
{{recursive_render("book/components/sub_collection_preview_content.html",sub_collection,book, loop_index=loop_index + 1)|safe}}
{% else %}
<!-- prettier-ignore -->
{% for section in sub_collection.active_sections %}