Loading asn2md.py +9 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ RE_DOXY_CATEGORY = re.compile(r'^\s*@category[\s:]+(.+)\n', re.MULTILINE) RE_DOXY_PARAM = re.compile(r'^\s*@(?:param|field):?\s+([\w-]+)\s*(.*?)\n\s*$', re.MULTILINE | re.DOTALL) RE_DOXY_SECTION = re.compile(r"^\s*@(brief|note|(class|struct|param|field|details)\s+([-\w]+)):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL) RE_NOTE_SECTION = re.compile(r"^\s*@(note):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL) # RE_TYPE = re.compile(r'(([A-Z][\w-]*)\s*::=[\w \t]+(?:{+(.*?)}+)?.*?)\n\s*\n', re.MULTILINE | re.DOTALL) RE_TYPE = re.compile(r'^\s*([A-Z][\w-]*)?\s*([{} \t:\w-]*?)?::=([\w \t]+.*?)\n\s*\n', re.MULTILINE | re.DOTALL) Loading Loading @@ -98,7 +99,7 @@ def parseText(content, indent=None): content = RE_GREATEQ_SIGN.sub('≥', content) content = RE_REFERENCE_NUMBER.sub('[\\g<0>](#markdown-header-references)', content) content = RE_REFERENCE_NUMBER.sub('[\\g<0>](#references)', content) return indentLines(content, indent) Loading Loading @@ -306,6 +307,13 @@ def parseModule(mname, content): for m in RE_TYPE.finditer(content[cpos:]): ret += repl_type (m, m.string[pos:m.start()]) pos = m.end() v = parseText(parseOptions(parseDoxyComments(content[pos:]), m_options)) if len(v): def repl_note (m): return '\n>>>\n' + 'NOTE: ' + m.group(2).lstrip(":, \t").lstrip('\n').rstrip() + '\n>>>\n' ret += '\n\n' + RE_NOTE_SECTION.sub(repl_note, v).strip() +'\n' return ret Loading Loading
asn2md.py +9 −1 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ RE_DOXY_CATEGORY = re.compile(r'^\s*@category[\s:]+(.+)\n', re.MULTILINE) RE_DOXY_PARAM = re.compile(r'^\s*@(?:param|field):?\s+([\w-]+)\s*(.*?)\n\s*$', re.MULTILINE | re.DOTALL) RE_DOXY_SECTION = re.compile(r"^\s*@(brief|note|(class|struct|param|field|details)\s+([-\w]+)):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL) RE_NOTE_SECTION = re.compile(r"^\s*@(note):?(.*?)(?=\n\s*@|\n\s*\n|\Z)", re.MULTILINE | re.DOTALL) # RE_TYPE = re.compile(r'(([A-Z][\w-]*)\s*::=[\w \t]+(?:{+(.*?)}+)?.*?)\n\s*\n', re.MULTILINE | re.DOTALL) RE_TYPE = re.compile(r'^\s*([A-Z][\w-]*)?\s*([{} \t:\w-]*?)?::=([\w \t]+.*?)\n\s*\n', re.MULTILINE | re.DOTALL) Loading Loading @@ -98,7 +99,7 @@ def parseText(content, indent=None): content = RE_GREATEQ_SIGN.sub('≥', content) content = RE_REFERENCE_NUMBER.sub('[\\g<0>](#markdown-header-references)', content) content = RE_REFERENCE_NUMBER.sub('[\\g<0>](#references)', content) return indentLines(content, indent) Loading Loading @@ -306,6 +307,13 @@ def parseModule(mname, content): for m in RE_TYPE.finditer(content[cpos:]): ret += repl_type (m, m.string[pos:m.start()]) pos = m.end() v = parseText(parseOptions(parseDoxyComments(content[pos:]), m_options)) if len(v): def repl_note (m): return '\n>>>\n' + 'NOTE: ' + m.group(2).lstrip(":, \t").lstrip('\n').rstrip() + '\n>>>\n' ret += '\n\n' + RE_NOTE_SECTION.sub(repl_note, v).strip() +'\n' return ret Loading