feature: add chapter title to question index
This commit is contained in:
+10
-1
@@ -394,7 +394,13 @@ class Build:
|
|||||||
section["slide"] = section_content
|
section["slide"] = section_content
|
||||||
|
|
||||||
if section["content"] is not None:
|
if section["content"] is not None:
|
||||||
self.__collect_question_occurrences(edition, ident, section["title"], section["content"])
|
self.__collect_question_occurrences(
|
||||||
|
edition,
|
||||||
|
chapter["title"],
|
||||||
|
ident,
|
||||||
|
section["title"],
|
||||||
|
section["content"],
|
||||||
|
)
|
||||||
|
|
||||||
next_section = (
|
next_section = (
|
||||||
chapter["sections"][section_number] if section_number < len(chapter["sections"]) else None
|
chapter["sections"][section_number] if section_number < len(chapter["sections"]) else None
|
||||||
@@ -527,6 +533,7 @@ class Build:
|
|||||||
def __collect_question_occurrences(
|
def __collect_question_occurrences(
|
||||||
self,
|
self,
|
||||||
edition: str,
|
edition: str,
|
||||||
|
chapter_title: str,
|
||||||
section_ident: str,
|
section_ident: str,
|
||||||
section_title: str,
|
section_title: str,
|
||||||
section_content: str,
|
section_content: str,
|
||||||
@@ -535,6 +542,7 @@ class Build:
|
|||||||
section_entry = self.question_index[question_number].setdefault(
|
section_entry = self.question_index[question_number].setdefault(
|
||||||
section_ident,
|
section_ident,
|
||||||
{
|
{
|
||||||
|
"chapter_title": chapter_title,
|
||||||
"section_title": section_title,
|
"section_title": section_title,
|
||||||
"editions": set(),
|
"editions": set(),
|
||||||
},
|
},
|
||||||
@@ -547,6 +555,7 @@ class Build:
|
|||||||
serialized[question] = [
|
serialized[question] = [
|
||||||
{
|
{
|
||||||
"section": section,
|
"section": section,
|
||||||
|
"chapter_title": data["chapter_title"],
|
||||||
"section_title": data["section_title"],
|
"section_title": data["section_title"],
|
||||||
"editions": sorted(data["editions"]),
|
"editions": sorted(data["editions"]),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user