Skip to content

Commit

Permalink
CI: GitHub pages compatible vanity URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Jul 31, 2023
1 parent d20f572 commit 1c268f8
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions generate-html.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,14 @@ def interfaces_menu(current):
crumbtrail=crumbtrail
)

debug(0, '>> Saving: pinout/{}.html'.format(pin_url))
debug(0, '>> Saving: pinout/{}/index.html'.format(pin_url))

with open(os.path.join('output', lang, 'pinout', '{}.html'.format(pin_url)), 'w') as f:
try:
os.mkdir(os.path.join('output', lang, 'pinout', '{}'.format(pin_url)))
except FileExistsError:
pass

with open(os.path.join('output', lang, 'pinout', '{}/index.html'.format(pin_url)), 'w') as f:
f.write(pin_html)


Expand Down Expand Up @@ -876,10 +881,21 @@ def interfaces_menu(current):
if url not in ['index', '404', 'boards']:
url = os.path.join('pinout', url)

output_path = os.path.join('output', lang, f'{url}.html')
output_url = f'{url}.html'

if url == 'boards':
output_path = os.path.join('output', lang, f'{url}/index.html')
output_url = f'{url}/index.html'
try:
os.mkdir(os.path.join('output', lang, url))
except FileExistsError:
pass

if 'source' in pages[key]:
debug(0, '>> Saving: {src} => {url}.html'.format(url=url, src=pages[key]['source']))
debug(0, '>> Saving: {src} => {url}'.format(url=output_url, src=pages[key]['source']))

with open(os.path.join('output', lang, '{}.html'.format(url)), 'w') as f:
with open(output_path, 'w') as f:
f.write(html)

print('\nAll done!')

0 comments on commit 1c268f8

Please sign in to comment.