import re


def extract_doc_title(string):
	"""Extracts a correctly parsed doc title from a string
	
	:param string: The raw doc title
	:type string: str
	:return: The normalized doc title, with excess blank lines removed
	:rtype: str"""
	doc_title = string.split("===")[0]
	# If there is a title, strip out excess line returns
	if len(doc_title) > 0:
		if re.match("^\n", doc_title):
			doc_title = doc_title[1:]
		if doc_title[-1] == '\n':
			doc_title = doc_title[:-1]
	return doc_title