summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md16
-rw-r--r--Edit-the-Town-Map.md6
-rw-r--r--Increase-Pokémon-sprite-animation-size.md8
-rw-r--r--toc.py8
4 files changed, 24 insertions, 14 deletions
diff --git a/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md b/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
index 1a6dd51..2cd5194 100644
--- a/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
+++ b/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
@@ -9,14 +9,14 @@ This tutorial will show you how to switch from per-tile \*_palette_map.asm files
## Contents
-- [1. Create \*_attributes.bin files from \*_palette_map.asm and \*_metatiles.bin files](#1-create-_attributesbin-files-from-_palette_mapasm-and-_metatilesbin-files)
-- [2. Remove the old files and include the new ones](#2-remove-the-old-files-and-include-the-new-ones)
-- [3. Store attribute pointers in tileset metadata](#3-store-attribute-pointers-in-tileset-metadata)
-- [4. Start changing how tile attributes are loaded](#4-start-changing-how-tile-attributes-are-loaded)
-- [5. Declare space in WRAM for on-screen tile attributes](#5-declare-space-in-wram-for-on-screen-tile-attributes)
-- [6. Continue changing how tile attributes are loaded](#6-continue-changing-how-tile-attributes-are-loaded)
-- [7. Finish changing how tile attributes are loaded](#7-finish-changing-how-tile-attributes-are-loaded)
-- [8. Remove unreferenced code in home/ to make room](#8-remove-unreferenced-code-in-home-to-make-room)
+1. [Create \*_attributes.bin files from \*_palette_map.asm and \*_metatiles.bin files](#1-create-_attributesbin-files-from-_palette_mapasm-and-_metatilesbin-files)
+2. [Remove the old files and include the new ones](#2-remove-the-old-files-and-include-the-new-ones)
+3. [Store attribute pointers in tileset metadata](#3-store-attribute-pointers-in-tileset-metadata)
+4. [Start changing how tile attributes are loaded](#4-start-changing-how-tile-attributes-are-loaded)
+5. [Declare space in WRAM for on-screen tile attributes](#5-declare-space-in-wram-for-on-screen-tile-attributes)
+6. [Continue changing how tile attributes are loaded](#6-continue-changing-how-tile-attributes-are-loaded)
+7. [Finish changing how tile attributes are loaded](#7-finish-changing-how-tile-attributes-are-loaded)
+8. [Remove unreferenced code in home/ to make room](#8-remove-unreferenced-code-in-home-to-make-room)
## 1. Create \*_attributes.bin files from \*_palette_map.asm and \*_metatiles.bin files
diff --git a/Edit-the-Town-Map.md b/Edit-the-Town-Map.md
index c561200..3d6e120 100644
--- a/Edit-the-Town-Map.md
+++ b/Edit-the-Town-Map.md
@@ -1,7 +1,11 @@
The Town Map is a bit tricky to edit: it's one of the only things in pokecrystal that still requires a hex editor. This tutorial will explain how it works.
-## TOC
+## Contents
+
+1. [The tileset](#1-the-tileset)
+2. [The Johto and Kanto tilemaps](#2-the-johto-and-kanto-tilemaps)
+3. [The landmarks](#3-the-landmarks)
## 1. The tileset
diff --git a/Increase-Pokémon-sprite-animation-size.md b/Increase-Pokémon-sprite-animation-size.md
index 6191bd0..7b37210 100644
--- a/Increase-Pokémon-sprite-animation-size.md
+++ b/Increase-Pokémon-sprite-animation-size.md
@@ -3,10 +3,10 @@ By default, Pokémon sprite animations have maximum sizes that limit how creativ
## Contents
-- [1. Understanding the problem](#1-understanding-the-problem)
-- [2. Allocate space in SRAM for animation graphics](#2-allocate-space-in-sram-for-animation-graphics)
-- [3. Change how animations are loaded](#3-change-how-animations-are-loaded)
-- [4. Don't use tile $7F](#4-dont-use-tile-7f)
+1. [Understanding the problem](#1-understanding-the-problem)
+2. [Allocate space in SRAM for animation graphics](#2-allocate-space-in-sram-for-animation-graphics)
+3. [Change how animations are loaded](#3-change-how-animations-are-loaded)
+4. [Don't use tile $7F](#4-dont-use-tile-7f)
## 1. Understanding the problem
diff --git a/toc.py b/toc.py
index 9bdc8cc..3502d3d 100644
--- a/toc.py
+++ b/toc.py
@@ -17,6 +17,7 @@ valid_toc_headings = {'## TOC', '##TOC'}
TocItem = namedtuple('TocItem', ['name', 'anchor', 'level'])
punctuation_regexp = re.compile(r'[^\w\- ]+')
+numbered_heading_regexp = re.compile(r'^[0-9]+\. ')
def name_to_anchor(name):
# GitHub's algorithm for generating anchors from headings
@@ -49,7 +50,12 @@ def toc_string(toc_items):
lines = ['## %s' % toc_name, '']
for name, anchor, level in toc_items:
padding = ' ' * level
- line = '%s- [%s](#%s)' % (padding, name, anchor)
+ if re.match(numbered_heading_regexp, name):
+ number, name = name.split('.', 1)
+ name = name.lstrip()
+ line = '%s%s. [%s](#%s)' % (padding, number, name, anchor)
+ else:
+ line = '%s- [%s](#%s)' % (padding, name, anchor)
lines.append(line)
return '\n'.join(lines) + '\n'