From a2144bd65f72aa67f771669f69412a6ddf24fbe4 Mon Sep 17 00:00:00 2001 From: Michiel Sikma Date: Sat, 21 Mar 2020 19:05:17 +0100 Subject: [PATCH] Add list of groups to misc page --- scripts/gen_docs.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/gen_docs.py b/scripts/gen_docs.py index edb4b180..63e20da4 100755 --- a/scripts/gen_docs.py +++ b/scripts/gen_docs.py @@ -86,7 +86,7 @@ def generate_index_page(version, commit): }, 'Index', version, commit, '.') return content -def wrap_docs_page(table_content, gen, gen_dir, curr_page, json_file, title, is_items_page, is_misc_page, version, commit, sprites_counter, new_sprites_only): +def wrap_docs_page(table_content, gen, gen_dir, curr_page, json_file, title, is_items_page, is_misc_page, version, commit, sprites_counter, new_sprites_only, items_list): '''Wraps a documentation page in a table node and adds styling''' gen_url = f'{REPO_BASE_URL}/{gen_dir}' json_url = f'{REPO_BASE_URL}/data/{json_file}' @@ -100,11 +100,13 @@ def wrap_docs_page(table_content, gen, gen_dir, curr_page, json_file, title, is_

This table lists all inventory item sprites. These items are from the last several games and is up-to-date as of Pokémon Sword/Shield. The sprites are from Gen 3 through 8.

All sprites are 32×32 in size. There are two sets of sprites: one with a Sword/Shield style white outline around the sprites, and one without (as all previous games). Both sets contain the same number of sprites, and both are listed below.

''' if is_items_page else ''' -

This table lists all miscellaneous sprites—all that aren't Pokémon box sprites or inventory items.

+

This table lists all miscellaneous sprites—all that aren't Pokémon box sprites or inventory items.

The following groups of sprites are included:

+

The data for this list can be found in %(json_link)s.

''' % { + 'items_list': '\n'.join(items_list), 'json_link': json_link } if is_misc_page else '''

This table lists all Pokémon box sprites for Gen %(gen)s%(subtype)s, which can be found in the %(gen_link)s directory. The list is up-to-date as of Pokémon Sword/Shield, and some of the sprites are from an earlier generation. All shiny sprites were custom-made and are not found in-game.

@@ -393,8 +395,12 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]', # each one containing one item with potentially multiple sprites. reset_counter() groups = meta['misc-groups'] + order = ['ribbon', 'body-style'] base_url = REPO_BASE_URL + # List of items to display in the opening text. + page_content_list = ['
  • ' + groups[group]['name']['eng'] + '
  • ' for group in order] + sprites_counter = 0 buffer = [] @@ -405,7 +411,7 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]', # Ribbons buffer.append('') - buffer.append('%s' % groups['ribbon']['name']['eng']) + buffer.append('%s' % groups['ribbon']['name']['eng']) buffer.append('') buffer.append('') buffer.append('#Name名前OriginSpriteFilename/gen') @@ -446,7 +452,7 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]', # Body styles buffer.append('') - buffer.append('%s' % groups['body-style']['name']['eng']) + buffer.append('%s' % groups['body-style']['name']['eng']) buffer.append('') buffer.append('') buffer.append('#Type種類SpriteFilename/gen') @@ -494,7 +500,8 @@ def generate_misc_table(misc, meta, curr_page, json_file, version = '[unknown]', ''') buffer.append('') buffer.append('') - return wrap_docs_page('\n'.join(buffer), None, None, curr_page, json_file, 'Miscellaneous sprites', False, True, version, commit, sprites_counter, False) + + return wrap_docs_page('\n'.join(buffer), None, None, curr_page, json_file, 'Miscellaneous sprites', False, True, version, commit, sprites_counter, False, page_content_list) def generate_items_table(itm, itm_unl, inv, etc, dirs, curr_page, json_file, version = '[unknown]', commit = '[unknown]'): '''Generates a documentation table for inventory sprites''' @@ -575,7 +582,7 @@ def generate_items_table(itm, itm_unl, inv, etc, dirs, curr_page, json_file, ver ''') buffer.append('') buffer.append('') - return wrap_docs_page('\n'.join(buffer), None, None, curr_page, json_file, 'Inventory item sprites', True, False, version, commit, sprites_counter, new_sprites_only) + return wrap_docs_page('\n'.join(buffer), None, None, curr_page, json_file, 'Inventory item sprites', True, False, version, commit, sprites_counter, new_sprites_only, None) def generate_dex_table(dex, etc, gen, gen_dir, curr_page, json_file, add_female = True, add_right = False, version = '[unknown]', commit = '[unknown]'): '''Generates a documentation table for Pokémon sprites''' @@ -689,7 +696,7 @@ def generate_dex_table(dex, etc, gen, gen_dir, curr_page, json_file, add_female ''') buffer.append('') buffer.append('') - return wrap_docs_page('\n'.join(buffer), gen, gen_dir, curr_page, json_file, None, False, False, version, commit, sprites_counter, new_sprites_only) + return wrap_docs_page('\n'.join(buffer), gen, gen_dir, curr_page, json_file, None, False, False, version, commit, sprites_counter, new_sprites_only, None) def main(): '''Generates several documentation files for the /docs directory'''