#!/usr/bin/python import monkDebug as debug import sys import monkTools import re ## ## @brief Transcode . ## =?=Page Title=?= ## ==Title 1== ## ===Title 2=== ## ====Title 3==== ## =====Title 4===== ## ======Title 5====== ## @param[in] value String to transform. ## @return Transformed string. ## def transcode(value): value = "\n" + value value = re.sub(r'@tableofcontents', r'', value) value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n====*', r'\n

\1

', value) value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n---*', r'\n

\1

', value) value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})* ######', r'\n
\1
', value) value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})*', r'\n
\1
', value) value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})* #####', r'\n
\1
', value) value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})*', r'\n
\1
', value) value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})* ####', r'\n

\1

', value) value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})*', r'\n

\1

', value) value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})* ###', r'\n

\1

', value) value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})*', r'\n

\1

', value) value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})* ##', r'\n

\1

', value) value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})*', r'\n

\1

', value) value = value[1:] return value