new-horizons/docs/lib/utils.py
Ben C 2552d1b8a4
Added XML Schemas To Docs (#57)
* Add Bootstrap Extension

* Rename main.yml

* Artifact Upload

* Fix Bootstrap Reference Error

* BootstrapTreeProcessor

* getiterator removed

* keys function

* Style Images

* Update docs_build.yml

* Added Meta Files

* Template Get

* Fix Page Ref

* Update BASE_URL

* Sort Schemas

* Add Sitemaps

* Add favicons, open-graph, and setup guide

* Update Setup.md

* Update .gitignore

* Update Setup.md

* Use _blank on external links

* Restructured Docs

* Fix Links

* Added XML Schemas

* Name XML Schemas
2022-03-04 23:27:26 -08:00

20 lines
438 B
Python

import re
def camel_to_pretty(raw):
return ' '.join(re.findall(r'[A-Z](?:[a-z]+|[A-Z]*(?=[A-Z]|$))', raw))
def pretty_title(raw: str) -> str:
if '_' in raw:
return ' '.join(x[0].upper() + x[1:] for x in raw.split('_'))
elif any(x.isupper() for x in raw):
if raw[0].islower():
new_raw = raw[0].upper() + raw[1:]
else:
new_raw = raw
return camel_to_pretty(new_raw)