Commit b33c4efc authored by primetoxinz's avatar primetoxinz

Add gen-search script.

(cherry picked from commit 73d6b5e9)
parent 3a82521d
.idea
site
\ No newline at end of file
site
search-list.json
\ No newline at end of file
......@@ -8,6 +8,8 @@ pages:
script:
- mkdocs build
- mv site public
- ./gen-search.py
- mv search-list.json public
artifacts:
paths:
- public
......
Industry Module
WIP
\ No newline at end of file
#!/usr/bin/env python
"""
This program generates a parsable index file to allow this to be searchable easily
"""
import json
import os
def generate_search_list(dir):
dirlist = {}
for dirpath, _, filenames in os.walk(dir):
relative = dirpath.replace(dir, '')
if relative:
# remove index.md
if 'index.md' in filenames:
filenames.remove('index.md')
if filenames:
dirlist[relative] = [f.replace('.md', '').replace('_', '') for f in filenames]
return dirlist
if __name__ == '__main__':
with open('search-list.json', 'w+') as file:
json.dump(generate_search_list('docs/en_us/'), file, indent=4, sort_keys=True)
......@@ -113,7 +113,8 @@ pages:
- 'Hardcore Fishing': 'en_us/hardcore/fishing.md'
- 'Hardcore Hunger': 'en_us/hardcore/hunger.md'
- 'Hardcore Spawn': 'en_us/hardcore/spawn.md'
- 'Tweaks':
- 'Index': 'en_us/tweaks/index.md'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment