def docstring(app, what, name, obj, options, lines): md = "\n".join(lines) rst = m2r2.convert(md) lines.clear() for line in rst.splitlines(): lines.append(line)
def docstring(app, what, name, obj, options, lines): md = '\n'.join(lines) rst = m2r.convert(md) lines.clear() lines += rst.splitlines()
def conv_no_check(self, src, **kwargs): out = convert(src, **kwargs) return out
def conv(self, src, **kwargs): out = convert(src, **kwargs) self.check_rst(out) return out
files = [ 'wiki/Manual', 'wiki/Exchange-Markets-By-Country', 'wiki/Exchange-Markets', 'wiki/ccxt.pro.manual', 'README', ] for file in files: with open(file + '.md', 'r') as f: contents = f.read() stripped = re.sub(r'</?su[bp]>', r'', contents) remove_italic_links = re.sub(r'\*\*\[', '[', stripped) remove_italic_links2 = re.sub(r'\)\*\*', ')', remove_italic_links) rst = m2r2.convert(remove_italic_links2, parse_relative_links=True, anonymous_references=True) blank_lines = re.sub(r'([-*]) \n {2,5}.. image', r'\1 .. image', rst) indent_level = re.sub(r':(target|alt):', r' :\1:', blank_lines) reference_links = re.sub(r'<(\w+)-(\w+)-(\w+)-(\w+)>`', r'<\1 \2 \3 \4>`', indent_level) reference_links2 = re.sub(r'<(\w+)-(\w+)-(\w+)>`', r'<\1 \2 \3>`', reference_links) reference_links3 = re.sub(r'<(\w+)-(\w+)>`', r'<\1 \2>`', reference_links2) remove_sublinks = re.sub(r'^\* :ref:`.+`$\n', '', reference_links3, flags=re.MULTILINE) remove_newline = re.sub(r'\n(Supported Cryptocurrency Exchange Markets)', r'\1', remove_sublinks) add_space = re.sub(r'^\*', r' *', remove_newline, flags=re.MULTILINE)
import os files = [ 'wiki/Manual', 'wiki/Exchange-Markets-By-Country', 'wiki/Exchange-Markets', 'wiki/ccxt.pro.manual', 'README', ] for file in files: with open(file + '.md', 'r') as f: contents = f.read() stripped = re.sub(r'</?su[bp]>', r'', contents) rst = m2r2.convert(stripped, parse_relative_links=True, anonymous_references=True) blank_lines = re.sub(r'([-*]) \n {2,5}.. image', r'\1 .. image', rst) indent_level = re.sub(r':(target|alt):', r' :\1:', blank_lines) reference_links = re.sub(r'<(\w+)-(\w+)-(\w+)-(\w+)>`', r'<\1 \2 \3 \4>`', indent_level) reference_links2 = re.sub(r'<(\w+)-(\w+)-(\w+)>`', r'<\1 \2 \3>`', reference_links) reference_links3 = re.sub(r'<(\w+)-(\w+)>`', r'<\1 \2>`', reference_links2) remove_sublinks = re.sub(r'^\* :ref:`.+`$\n', '', reference_links3, flags=re.MULTILINE) remove_newline = re.sub(r'\n(Supported Cryptocurrency Exchange Markets)', r'\1', remove_sublinks) add_space = re.sub(r'^\*', r' *', remove_newline, flags=re.MULTILINE)