示例#1
0
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)
示例#2
0
def docstring(app, what, name, obj, options, lines):
    md  = '\n'.join(lines)
    rst = m2r.convert(md)
    lines.clear()
    lines += rst.splitlines()
示例#3
0
 def conv_no_check(self, src, **kwargs):
     out = convert(src, **kwargs)
     return out
示例#4
0
 def conv(self, src, **kwargs):
     out = convert(src, **kwargs)
     self.check_rst(out)
     return out
示例#5
0
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)
示例#6
0
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)