Add navigation tags to sections

This commit is contained in:
fanyx 2023-01-13 00:48:36 +01:00
parent 1f2c44c82d
commit 79bec88cfd
2 changed files with 37 additions and 29 deletions

View File

@ -30,7 +30,7 @@ def split_to_list(str, length, delim=' '):
return l return l
# build_header using section title # build_header using section title
def build_header(l_title, add_index=false, index_prefix=None): def build_header(l_title, add_index=False, index_string=None):
header = [] header = []
len_title = len(l_title[0]) len_title = len(l_title[0])
@ -48,15 +48,19 @@ def build_header(l_title, add_index=false, index_prefix=None):
header.append(c_pad * (pad + pad_left) + '|' + ' ' * TITLE_PADDING + title + ' ' * (TITLE_PADDING + pad_right) + '|' + c_pad * pad) header.append(c_pad * (pad + pad_left) + '|' + ' ' * TITLE_PADDING + title + ' ' * (TITLE_PADDING + pad_right) + '|' + c_pad * pad)
count += 1 count += 1
# lower part # lower part
header.append(' ' * (pad + pad_left) + '\\\\' + '_' * len_border + '//' + ' ' * pad) # optional navigation tag
# add navigation tag if add_index == True and index_string != None:
if add_index == true and index_prefix.length == 1: header.append(' ' * (pad + pad_left) + '\\\\' + '_' * len_border + '//' + ' ' * (pad - 7) + f'[{index_string}] ')
pass
else: else:
header.append(' ' * MAX_WIDTH) header.append(' ' * (pad + pad_left) + '\\\\' + '_' * len_border + '//' + ' ' * pad)
header.append(' ' * MAX_WIDTH)
return header return header
def index_string(prefix, index):
return f'{prefix}{index:>03d}'
def build_index(yaml, prefix): def build_index(yaml, prefix):
l_title = [] l_title = []
for item in yaml: for item in yaml:
@ -64,7 +68,7 @@ def build_index(yaml, prefix):
l_index = [] l_index = []
for i, item in enumerate(l_title): for i, item in enumerate(l_title):
l_index += [' - ' + item.ljust(MAX_WIDTH - 10) + f'[{prefix}{i+1:03}] '] l_index += [' - ' + item.ljust(MAX_WIDTH - 10) + f'[{index_string(prefix, i+1)}] ']
l_index += [' ' * MAX_WIDTH] l_index += [' ' * MAX_WIDTH]
@ -98,6 +102,7 @@ def main():
todo_result += build_index(todo_yaml, 'S') todo_result += build_index(todo_yaml, 'S')
item_count = 0
for section in todo_yaml: for section in todo_yaml:
s_title = section['title'] s_title = section['title']
l_title = [] l_title = []
@ -108,7 +113,8 @@ def main():
l_title = [s_title] l_title = [s_title]
# Create section header # Create section header
todo_result += build_header(l_title) item_count += 1
todo_result += build_header(l_title, add_index=True, index_string=index_string('S', item_count))
# Create table header # Create table header
todo_result += [' ______ ________________________________________________________', todo_result += [' ______ ________________________________________________________',
@ -144,6 +150,7 @@ def main():
finished_result += build_index(finished_yaml, 'P') finished_result += build_index(finished_yaml, 'P')
item_count = 0
for section in finished_yaml: for section in finished_yaml:
s_title = section['title'] s_title = section['title']
l_title = [] l_title = []
@ -154,7 +161,8 @@ def main():
l_title = [s_title] l_title = [s_title]
# Create section header # Create section header
finished_result += build_header(l_title) item_count += 1
finished_result += build_header(l_title, add_index=True, index_string=index_string('P', item_count))
# Create table header # Create table header
finished_result += ['______ ________________________________________________________ ', finished_result += ['______ ________________________________________________________ ',

View File

@ -3,18 +3,18 @@ __________________// \\_________________| :|__________
__________________| List of Shame |_________________| :|__________________| List of Pride |_________________ __________________| List of Shame |_________________| :|__________________| List of Pride |_________________
\\_________________________// | :| \\_________________________// \\_________________________// | :| \\_________________________//
| :| | :|
- Currently Playing [S100] | :| - Early Days [P100] - Currently Playing [S001] | :| - Early Days [P001]
- Upcoming [S200] | :| - First PC [P200] - Upcoming [S002] | :| - First PC [P002]
- Soon(TM) 2022 [S300] | :| - The Multiplayer Phase [P300] - Soon(TM) 2022 [S003] | :| - The Multiplayer Phase [P003]
- Unknown Future [S400] | :| - 2020 [P400] - Unknown Future [S004] | :| - 2020 [P004]
- Haunts my Dreams [S500] | :| - 2021 [P500] - Haunts my Dreams [S005] | :| - 2021 [P005]
- Not Yet Owned (Wishlist) [S600] | :| - 2022 [P600] - Not Yet Owned (Wishlist) [S006] | :| - 2022 [P006]
| :| - 2023 [P700] | :| - 2023 [P007]
_____________________________ | :| _____________________________ | :|
________________// \\_______________| :| ______________________ ________________// \\_______________| :| ______________________
________________| Currently Playing |_______________| :|___________________// \\___________________ ________________| Currently Playing |_______________| :|___________________// \\___________________
\\_____________________________// | :|___________________| Early Days |___________________ \\_____________________________// [S001] | :|___________________| Early Days |___________________
| :| \\______________________// | :| \\______________________// [P001]
______ ________________________________________________________| :| ______ ________________________________________________________| :|
|======|========================================================| :|______ ________________________________________________________ |======|========================================================| :|______ ________________________________________________________
| PC | Kingdom Two Crowns | :|======|========================================================| | PC | Kingdom Two Crowns | :|======|========================================================|
@ -23,7 +23,7 @@ ________________| Currently Playing |_______________| :|__________
____________________ | :| GBA | Pokemon Sapphire | ____________________ | :| GBA | Pokemon Sapphire |
____________________// \\____________________| :| GBC | Pokemon Trading Card Game | ____________________// \\____________________| :| GBC | Pokemon Trading Card Game |
____________________| Upcoming |____________________| :| GBC | Pokemon Crystal | ____________________| Upcoming |____________________| :| GBC | Pokemon Crystal |
\\____________________// | :| PC | Colin McRae Rally 2.0 | \\____________________// [S002] | :| PC | Colin McRae Rally 2.0 |
| :| PC | Anno 1602 | | :| PC | Anno 1602 |
______ ________________________________________________________| :| GBA | Pokemon Emerald | ______ ________________________________________________________| :| GBA | Pokemon Emerald |
|======|========================================================| :| PC | Need for Speed: Underground | |======|========================================================| :| PC | Need for Speed: Underground |
@ -38,7 +38,7 @@ ____________________| Upcoming |____________________| :| GBC | Po
_________________________ | :| NDS | Final Fantasy III | _________________________ | :| NDS | Final Fantasy III |
__________________// \\_________________| :| GBA | Final Fantasy I & II: Dawn of Souls | __________________// \\_________________| :| GBA | Final Fantasy I & II: Dawn of Souls |
__________________| Soon(TM) 2022 |_________________| :| NDS | Final Fantasy IV | __________________| Soon(TM) 2022 |_________________| :| NDS | Final Fantasy IV |
\\_________________________// | :| GBA | Final Fantasy V Advance | \\_________________________// [S003] | :| GBA | Final Fantasy V Advance |
| :| GBA | Final Fantasy VI Advance | | :| GBA | Final Fantasy VI Advance |
______ ________________________________________________________| :| PSP | Lego Star Wars | ______ ________________________________________________________| :| PSP | Lego Star Wars |
|======|========================================================| :| PSP | Lego Star Wars II | |======|========================================================| :| PSP | Lego Star Wars II |
@ -54,7 +54,7 @@ __________________| Soon(TM) 2022 |_________________| :| NDS | Fi
__________________________ | :| GBA | The Legend of Zelda: Minish Cap | __________________________ | :| GBA | The Legend of Zelda: Minish Cap |
_________________// \\_________________| :| PC | Moorhuhn 3: ...Es Gibt Huhn! | _________________// \\_________________| :| PC | Moorhuhn 3: ...Es Gibt Huhn! |
_________________| Unknown Future |_________________| :| GBA | Pokemon Pinball: Ruby & Sapphire | _________________| Unknown Future |_________________| :| GBA | Pokemon Pinball: Ruby & Sapphire |
\\__________________________// | :| NDS | Mario Kart DS | \\__________________________// [S004] | :| NDS | Mario Kart DS |
| :| GBA | Pokemon Leaf Green | | :| GBA | Pokemon Leaf Green |
______ ________________________________________________________| :| GBA | Pokemon Mystery Dungeon: Red Rescue Team | ______ ________________________________________________________| :| GBA | Pokemon Mystery Dungeon: Red Rescue Team |
|======|========================================================| :| PC | Shrek 2 | |======|========================================================| :| PC | Shrek 2 |
@ -87,7 +87,7 @@ _________________| Unknown Future |_________________| :| GBA | Po
____________________________ | :| NDS | Professor Layton and the Curious Village | ____________________________ | :| NDS | Professor Layton and the Curious Village |
________________// \\________________| :| NDS | Professor Layton and the Diabolical Box | ________________// \\________________| :| NDS | Professor Layton and the Diabolical Box |
________________| Haunts my Dreams |________________| :| PC | Tachyon: The Fringe | ________________| Haunts my Dreams |________________| :| PC | Tachyon: The Fringe |
\\____________________________// | :| NDS | The Simpsons | \\____________________________// [S005] | :| NDS | The Simpsons |
| :| NDS | Spectrobes | | :| NDS | Spectrobes |
______ ________________________________________________________| :| PC | Trackmania Original | ______ ________________________________________________________| :| PC | Trackmania Original |
|======|========================================================| :| GBA | Wario Ware | |======|========================================================| :| GBA | Wario Ware |
@ -99,7 +99,7 @@ ________________| Haunts my Dreams |________________| :| PC | Ta
| PC | The Secret of Monkey Island | :| ____________________ | PC | The Secret of Monkey Island | :| ____________________
| PC | Monkey Island 2 | :|____________________// \\____________________ | PC | Monkey Island 2 | :|____________________// \\____________________
| GBA | Fire Emblem | :|____________________| First PC |____________________ | GBA | Fire Emblem | :|____________________| First PC |____________________
| PC | Deus Ex: Game of the Year | :| \\____________________// | PC | Deus Ex: Game of the Year | :| \\____________________// [P002]
| PS2 | Metal Gear Solid 2: Sons of Liberty | :| | PS2 | Metal Gear Solid 2: Sons of Liberty | :|
| PC | Bravery Network Online | :|______ ________________________________________________________ | PC | Bravery Network Online | :|______ ________________________________________________________
| NES | Ninja Gaiden | :|======|========================================================| | NES | Ninja Gaiden | :|======|========================================================|
@ -126,7 +126,7 @@ ________________| Haunts my Dreams |________________| :| PC | Ta
| PC | Final Fantasy IX | :| _________________________________ | PC | Final Fantasy IX | :| _________________________________
| PC | Final Fantasy X | :|______________// \\_____________ | PC | Final Fantasy X | :|______________// \\_____________
| PC | Final Fantasy XII | :|______________| The Multiplayer Phase |_____________ | PC | Final Fantasy XII | :|______________| The Multiplayer Phase |_____________
| PS3 | Final Fantasy XIII | :| \\_________________________________// | PS3 | Final Fantasy XIII | :| \\_________________________________// [P003]
| PC | Lightning Returns: Final Fantasy XIII | :| | PC | Lightning Returns: Final Fantasy XIII | :|
| PC | Bastion | :|______ ________________________________________________________ | PC | Bastion | :|______ ________________________________________________________
| PC | Crashlands | :|======|========================================================| | PC | Crashlands | :|======|========================================================|
@ -141,7 +141,7 @@ ________________| Haunts my Dreams |________________| :| PC | Ta
____________________________________ | :| PC | The Beginner's Guide | ____________________________________ | :| PC | The Beginner's Guide |
____________// \\____________| :| PC | Stanley's Parable | ____________// \\____________| :| PC | Stanley's Parable |
____________| Not Yet Owned (Wishlist) |____________| :| PC | What Remains of Edith Finch | ____________| Not Yet Owned (Wishlist) |____________| :| PC | What Remains of Edith Finch |
\\____________________________________// | :| PC | Ori and the Blind Forest | \\____________________________________// [S006] | :| PC | Ori and the Blind Forest |
| :| PC | Realm of the Mad God | | :| PC | Realm of the Mad God |
______ ________________________________________________________| :| PC | Raft | ______ ________________________________________________________| :| PC | Raft |
|======|========================================================| :| NX | The Legend of Zelda: Breath of the Wild | |======|========================================================| :| NX | The Legend of Zelda: Breath of the Wild |
@ -153,7 +153,7 @@ ____________| Not Yet Owned (Wishlist) |____________| :| PC | Wh
| PC | Beacon Pines | :| ________________ | PC | Beacon Pines | :| ________________
| PC | Switchcars | :|______________________// \\______________________ | PC | Switchcars | :|______________________// \\______________________
| PC | Into the Breach | :|______________________| 2020 |______________________ | PC | Into the Breach | :|______________________| 2020 |______________________
| PS1 | Parasite Eve | :| \\________________// | PS1 | Parasite Eve | :| \\________________// [P004]
| PC | Sifu | :| | PC | Sifu | :|
| PS4 | Dark Souls 2 | :|______ ________________________________________________________ | PS4 | Dark Souls 2 | :|______ ________________________________________________________
| PS4 | Dark Souls 3 | :|======|========================================================| | PS4 | Dark Souls 3 | :|======|========================================================|
@ -173,7 +173,7 @@ ____________| Not Yet Owned (Wishlist) |____________| :| PC | Wh
| PC | Hellblade: Senua's Sacrifice | :| ________________ | PC | Hellblade: Senua's Sacrifice | :| ________________
| PC | Factorio | :|______________________// \\______________________ | PC | Factorio | :|______________________// \\______________________
| PC | VA-11 Hall-A: Cyberpunk Bartender Action | :|______________________| 2021 |______________________ | PC | VA-11 Hall-A: Cyberpunk Bartender Action | :|______________________| 2021 |______________________
| PC | Katana Zero | :| \\________________// | PC | Katana Zero | :| \\________________// [P005]
| PC | art of rally | :| | PC | art of rally | :|
| PC | Ooblets | :|______ ________________________________________________________ | PC | Ooblets | :|______ ________________________________________________________
| PC | Don't Escape: 4 Days to Survive | :|======|========================================================| | PC | Don't Escape: 4 Days to Survive | :|======|========================================================|
@ -198,7 +198,7 @@ ____________| Not Yet Owned (Wishlist) |____________| :| PC | Wh
| PC | Hyper Light Breaker | :| ________________ | PC | Hyper Light Breaker | :| ________________
| PC | Crypt of the Necrodancer | :|______________________// \\______________________ | PC | Crypt of the Necrodancer | :|______________________// \\______________________
| PC | Just Shapes & Beats | :|______________________| 2022 |______________________ | PC | Just Shapes & Beats | :|______________________| 2022 |______________________
| PC | Minit | :| \\________________// | PC | Minit | :| \\________________// [P006]
| PC | A Short Hike | :| | PC | A Short Hike | :|
| PC | Dysmantle | :|______ ________________________________________________________ | PC | Dysmantle | :|______ ________________________________________________________
| PC | Omori | :|======|========================================================| | PC | Omori | :|======|========================================================|
@ -239,7 +239,7 @@ ____________| Not Yet Owned (Wishlist) |____________| :| PC | Wh
| :| ________________ | :| ________________
| :|______________________// \\______________________ | :|______________________// \\______________________
| :|______________________| 2023 |______________________ | :|______________________| 2023 |______________________
| :| \\________________// | :| \\________________// [P007]
| :| | :|
| :|______ ________________________________________________________ | :|______ ________________________________________________________
| :|======|========================================================| | :|======|========================================================|