Skip to content

Commit

Permalink
Migrate to new index generation code
Browse files Browse the repository at this point in the history
  • Loading branch information
vitusventure committed Sep 20, 2018
1 parent ed5ee98 commit 8fcaaf5
Show file tree
Hide file tree
Showing 81 changed files with 391 additions and 1,089 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
5th Edition SRD in the style of d20srd.org

# How to Build
Generate the spell lists by running the two python files.
Various indexes are built using build_indexes.py.

Build using mkdocs (http://www.mkdocs.org/): mkdocs build --clean
Build the full site using mkdocs (http://www.mkdocs.org/): mkdocs build --clean

You can also serve locally by running mkdocs serve
79 changes: 79 additions & 0 deletions build_indexes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from srd_index_builder import SRDIndexBuilder
import logging
import argparse

build_config = {
'class_spell_lists': {
'build': True,
'index_path': './docs/spellcasting/spell_lists/'
},
'indexes': {
'spells': {
'source_directory': './docs/spellcasting/spells',
'link_prefix': '/spellcasting/spells',
'index_path': './docs/spellcasting/spell_indexes/',
'indexes_to_generate': {
'school': {
'page_title': 'Spells by School',
'output_file_name': 'spells_by_school.md'
},
'name_category': {
'page_title': 'Spells by Name',
'output_file_name': 'spells_by_name.md'
},
'level': {
'page_title': 'Spells by Level',
'output_file_name': 'spells_by_level.md'
}
}
},
'magic_items': {
'source_directory': './docs/gamemaster_rules/magic_items',
'link_prefix': '/gamemaster_rules/magic_items',
'index_path': './docs/gamemaster_rules/magic_item_indexes/',
'indexes_to_generate': {
'name_category': {
'page_title': 'Magic Items by Name',
'output_file_name': 'items_by_name.md'
},
'type': {
'page_title': 'Magic Items by Type',
'output_file_name': 'items_by_type.md'
}
}

},
'monsters': {
'source_directory': './docs/gamemaster_rules/monsters',
'link_prefix': '/gamemaster_rules/monsters',
'index_path': './docs/gamemaster_rules/monster_indexes/',
'indexes_to_generate': {
'name_category': {
'page_title': 'Monsters by Name',
'output_file_name': 'monsters_by_name.md'
},
'cr': {
'page_title': 'Monsters by CR',
'output_file_name': 'monsters_by_cr.md'
},
'type': {
'page_title': 'Monsters by Type',
'output_file_name': 'monsters_by_type.md'
}
}
}
}
}

if __name__ == '__main__':
# Setup logging
logging.basicConfig(level=logging.INFO)

# Read arguments
parser = argparse.ArgumentParser()
parser.add_argument('--offline', action='store_true', default=False,
help='Generate links in offline mode')
args = parser.parse_args()

# First, build metadata driven indexes using the SRDIndexBuilder
SRDIndexBuilder(args.offline).build_indexes_from_config(build_config)
2 changes: 1 addition & 1 deletion build_to_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

git pull

python2 generate_indexes.py
python build_indexes.py

mkdocs build --clean

Expand Down
8 changes: 4 additions & 4 deletions deploy_to_prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Get the latest changes
git pull

# Generate Offline spell lists
python2 generate_indexes.py --offline
# Generate offline indexes
python build_indexes.py --offline

# Build the offline site
mkdocs build --clean --config-file offline_build_config.yml

# Generate spell lists
python2 generate_indexes.py
# Generate regular indexes
python build_indexes.py

# Build the site
mkdocs build --clean
Expand Down
1 change: 0 additions & 1 deletion docs/spellcasting/spells/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ level: 1
school: enchantment
classes: cleric
paladin
warlock

# Command
_1st-level enchantment_
Expand Down
1 change: 0 additions & 1 deletion docs/spellcasting/spells/dream.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Dream
level: 5
school: illusion
classes: bard
druid
warlock
wizard

Expand Down
2 changes: 1 addition & 1 deletion docs/spellcasting/spells/forcecage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Forcecage
level: 7
school: evocation
classes: bard
druid
warlock
wizard

# Forcecage
_7th-level evocation_
Expand Down
1 change: 0 additions & 1 deletion docs/spellcasting/spells/stoneskin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Stoneskin
level: 4
school: abjuration
classes: druid
paladin
ranger
sorcerer
wizard
Expand Down
Loading

0 comments on commit 8fcaaf5

Please sign in to comment.