Files
Emiliano Heyns 39f91d4243 dirname
2022-05-14 22:53:11 +02:00
..
2022-05-09 00:04:47 +02:00
2022-05-09 00:04:47 +02:00
2022-05-14 22:53:11 +02:00
2022-05-10 18:58:22 +02:00
2021-07-26 03:59:03 +02:00
2022-05-05 13:48:12 +02:00
2021-12-24 12:09:34 +01:00
2021-04-23 08:00:31 +02:00
2022-05-05 14:11:18 +02:00
2018-08-17 17:09:53 +02:00
2022-04-12 08:38:11 +02:00
2022-05-13 08:48:11 +02:00
2022-04-12 08:38:11 +02:00
2021-04-18 22:34:27 +02:00
2021-04-17 21:45:05 +02:00
2021-03-24 18:48:37 +01:00
2021-12-24 12:09:34 +01:00
2022-04-05 08:35:33 +02:00
2021-08-11 20:47:49 +02:00
2022-03-05 02:12:54 +01:00
2019-08-10 14:10:45 +02:00
2021-12-22 22:21:46 +01:00
2021-10-06 23:03:26 +02:00
2021-06-25 21:55:24 +02:00
2021-06-13 20:45:26 +02:00

#!/usr/bin/env python3

import re

with open('README.md') as f:
  readme = f.read()
warning = '<!-- WARNING: GENERATED FROM https://github.com/retorquere/zotero-better-bibtex/blob/master/README.md. EDITS WILL BE OVERWRITTEN -->'

index = f"""
---
title: Better BibTeX for Zotero
weight: 5
aliases:
  - /Home
---
{warning}
""".lstrip().split('\n')

sponsoring = f"""
---
title: Sponsoring BBT
---
{warning}
""".lstrip().split('\n')

appendto = index
for line in readme.split('\n'):
  if 'gitter' in line: continue
  if line.startswith('## ') and 'sponsor' in line.lower():
    appendto = sponsoring
    continue

  line = re.sub(r'\[!\[.*', '', line)

  line = re.sub(r'\(https:\/\/(retorquere\.github\.io|retorque\.re)\/zotero-better-bibtex(\/.*?)\/?\)', "({{< ref \"\\2\" >}})", line)
  appendto.append(line)

with open('site/content/_index.md', 'w') as f:
  print("\n".join(index), file=f)
with open('site/content/sponsoring.md', 'w') as f:
  print("\n".join(sponsoring), file=f)