#note to self: to convert existing ctf diaries, check whether `\n([0-9a-zA-Z]+)` (or `^((?:[a-zA-Z0-9] ?)+)\n- ` for some messier writeups) looks like a chall name, then replace with `\n### $1`
#remove all first level -s that i use for paragraph into 2 \ns
#push all ```s to the left without spaces
#TODO aggregate stats (total ctfs, total solves, solve and co-solve amt, category solves breakdown, avg chall per ctf?, avg points?, avg solve count??)
#exclude organized events
CWD=os.path.dirname(os.path.realpath(__file__))
alphanum=re.compile(r'[^A-Za-z0-9\- ]+')
merge_space=re.compile(r'\s+')
remove_formatting=lambdastr:merge_space.sub('-',alphanum.sub('',str).strip()).lower()#for name formats
if'challenges'inobjects[name]andnotall('writeup-url'inchallandchall['writeup-url']forchallinobjects[name]['challenges']):#only print if ctf should have comments
print(f'Cannot read comments for {file} ({type(e).__name__}), skipping...')
if'challenges'invelse"<div class='text-center'>No specific challenges have been logged; It's all a team effort!</div>",#allow no challenge specified (e.g. A/D ctfs where its basically fully team effort so no specific challs that i wouldve fully solved)