#!/usr/bin/gawk -f function end_section() { print ""; in_section=0; } function end_subsection() { print ""; in_subsection=0; } function end_paragraph() { print "

"; in_paragraph=0; } function end_bullets() { print ""; in_bullets=0; } function end_subbullets() { print ""; in_subbullets=0; } BEGIN { ignore=1; in_section=0; in_subsection=0; in_bullets=0; in_subbullets=0; in_paragraph=0; print ""; print ""; print ""; print ""; print "CV | Dominic Ricottone"; print ""; print ""; print "
"; print "

Dominic Ricottone

"; } { if (ignore==0) { gsub("&","\\&"); gsub("'","\\’"); $0 = gensub(/\[([^\]]+)\]\(([^\)]+)\)/, "\\1", "g"); if ($0 ~ /^## /) { if (in_paragraph==1) end_paragraph(); if (in_subbullets==1) end_subbullets(); if (in_bullets==1) end_bullets(); if (in_subsection==1) end_subsection(); if (in_section==1) end_section(); print "

" substr($0,4) "

"; } # start of a section (which is a pair of a paragraph and an unordered list) else if ($0 ~ /^### /) { if (in_paragraph==1) end_paragraph(); if (in_subbullets==1) end_subbullets(); if (in_bullets==1) end_bullets(); if (in_subsection==1) end_subsection(); if (in_section==1) end_section(); print "

" substr($0,5) "

"; in_section=1; } # start of a subsection (which is a list item) else if ($0 ~ /^ \+ #### /) { if (in_paragraph==1) end_paragraph(); if (in_subbullets==1) end_subbullets(); if (in_bullets==1) end_bullets(); if (in_subsection==1) end_subsection(); else print "
"; print ""; }