#!/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 = re.sub(r'=\?=(.*?)=\?=', r'

\1

', value) value = re.sub(r'\n======(.*?)======', r'\n
\1
', value) value = re.sub(r'\n=====(.*?)=====', r'\n

\1

', value) value = re.sub(r'\n====(.*?)====', r'\n

\1

', value) value = re.sub(r'\n===(.*?)===', r'\n

\1

', value) value = re.sub(r'\n==(.*?)==', r'\n

\1

', '\n' + value) value = value[1:] return value