added resume note beneath Welcome

This commit is contained in:
Yuriy 2024-07-17 00:17:00 -04:00
parent efabee0eb5
commit 751d050c8f

View File

@ -50,6 +50,8 @@ class Folder:
return slugify(self.title)
def get_summary_line(self, level: int) -> str:
print(f"{self.title}'s level is: {level}")
# level = 1
"""Get the appropriate summary file line for this folder."""
return (
(" " * (level - 1))
@ -269,7 +271,6 @@ class JoplinExporter:
"""Write the SUMMARY.md that mdBook needs."""
# We construct a note tree by adding each note into its parent.
note_tree: Dict[str, List[Union[Note, Folder]]] = defaultdict(list)
# The note tree is a list of notes with their parents:
# [
# [parent1, parent2, note1]
@ -278,12 +279,16 @@ class JoplinExporter:
# Then, we sort these by alphabetical order, and we're done.
note_tree = []
introduction: Optional[Note] = None # The "introduction" note.
resume: Optional[Note] = None # The "resume" note.
folders: List[Folder] = list
for note_list in self.notes.values():
for note in note_list:
if note.title == "Welcome":
introduction = note
continue
if note.title == "Resume":
resume = note
continue
note_item = [note]
item: Union[Folder, Note] = note
while True:
@ -330,6 +335,8 @@ class JoplinExporter:
# Special-case the introduction.
if introduction:
outfile.write(introduction.get_summary_line(0) + "\n")
if resume:
outfile.write(resume.get_summary_line(0) + "\n")
print("\n".join(items))
outfile.write("\n".join(items))