ect (or 2du) hace 8 años
padre
commit
d1706d95a2
Se han modificado 1 ficheros con 0 adiciones y 147 borrados
  1. 0 147
      set_mark/mid_pas.py

+ 0 - 147
set_mark/mid_pas.py

@@ -1,147 +0,0 @@
-import re
-from urllib import parse
-
-def mid_pas(data, fol_num, include, in_c, toc_y):
-    syntax = 0
-    folding_test = 0
-
-    com = re.compile("{{{((?!(?:(?:\+|-)(?:[^ ]+))|(?:#|@)(?:(?:[0-9a-f-A-F]{3}){1,2}|(?:\w+))|(?:#!(?:html|wiki|noin|folding|syntax)))(?:(?!{|}).)+)}}}", re.DOTALL)
-    while 1:
-        m = com.search(data)
-        if m:
-            com4 = re.compile('#base64#((?:(?!#\/base64#).)+)#\/base64#', re.DOTALL)
-            test = com4.search(m.groups()[0])
-            if test:
-                test2 = com4.sub('#mid2#' + parse.unquote(test.groups()[0]).replace('_', '_').replace('‐', '-') + '#/mid2#', m.groups()[0])
-            else:
-                test2 = m.groups()[0]
-                
-            data = com.sub('#base64#' + parse.quote(test2).replace('_', '_').replace('-', '‐').replace('%3C', '<').replace('%3E', '>') + '#/base64#', data, 1)
-        else:
-            break
-
-        data = re.sub("{#base64#%7B%7B", "{{{#base64#", data)
-
-    p = re.compile('{{{((?!#mid#)(?:(?:(?:\+|-)(?:[^ ]+))|(?:#|@)(?:(?:[0-9a-f-A-F]{3}){1,2}|(?:\w+))|(?:#!(?:html|wiki|noin|folding|syntax)))(?:(?!{{{|}}}).)+)}}}', re.DOTALL)
-    while 1:
-        m = p.search(data)
-        if m:
-            data = p.sub('#mid#' + m.groups()[0] + '#/mid#', data, 1)
-        else:
-            break
-
-    com = re.compile("{{{((?:(?!{{{|}}}).)*)}}}", re.DOTALL)
-    while 1:
-        m = com.search(data)
-        if m:
-            com4 = re.compile('#base64#((?:(?!#\/base64#).)+)#\/base64#', re.DOTALL)
-            test = com4.search(m.groups()[0])
-            if test:
-                test2 = com4.sub('#mid2#' + parse.unquote(test.groups()[0]).replace('_', '_').replace('‐', '-') + '#/mid2#', m.groups()[0])
-            else:
-                test2 = m.groups()[0]
-                
-            data = com.sub('#base64#' + parse.quote(test2).replace('_', '_').replace('-', '‐').replace('%3C', '<').replace('%3E', '>') + '#/base64#', data, 1)
-        else:
-            break
-
-        data = re.sub("{#base64#%7B%7B", "{{{#base64#", data)
-
-    com3 = re.compile('#mid#((?:(?!#\/mid#).)+)#\/mid#', re.DOTALL)
-    m = com3.search(data)
-    while 1:
-        m = com3.search(data)
-        if m:
-            data = com3.sub('{{{' + m.groups()[0] + '}}}', data, 1)
-        else:
-            break
-
-    while 1:
-        is_it = com.search(data)
-        if is_it:
-            it_d = is_it.groups()[0]
-
-            big_a = re.compile("^\+([1-5]) (.*)$", re.DOTALL)
-            big = big_a.search(it_d)
-
-            small_a = re.compile("^\-([1-5]) (.*)$", re.DOTALL)
-            small = small_a.search(it_d)
-
-            color_b = re.compile("^(#(?:[0-9a-f-A-F]{3}){1,2}) (.*)$", re.DOTALL)
-            color_2 = color_b.search(it_d)
-
-            color_c = re.compile("^#(\w+) (.*)$", re.DOTALL)
-            color_3 = color_c.search(it_d)
-
-            back_a = re.compile("^@((?:[0-9a-f-A-F]{3}){1,2}) (.*)$", re.DOTALL)
-            back = back_a.search(it_d)
-
-            back_c = re.compile("^@(\w+) (.*)$", re.DOTALL)
-            back_3 = back_c.search(it_d)
-
-            include_out_a = re.compile("^#!noin ?(.*)$", re.DOTALL)
-            include_out = include_out_a.search(it_d)
-
-            div_a = re.compile("^#!wiki style=(?:"|')((?:(?!"|').)*)(?:"|')\r\n(.*)$", re.DOTALL)
-            div = div_a.search(it_d)
-
-            html_a = re.compile("^#!html ?(.*)$", re.DOTALL)
-            html_d = html_a.search(it_d)
-
-            fol_a = re.compile("^#!folding ((?:(?!\n).)*)\n(.*)$", re.DOTALL)
-            fol = fol_a.search(it_d)
-
-            syn_a = re.compile("^#!syntax ((?:(?!\n).)*)\n(.*)$", re.DOTALL)
-            syn = syn_a.search(it_d)
-
-            if big:
-                big_d = big.groups()
-                data = com.sub('<span style="font-size: ' + str(int(big_d[0]) * 20 + 100) + '%;">' + big_d[1] + '</span>', data, 1)
-            elif small:
-                sm_d = small.groups()
-                data = com.sub('<span style="font-size: ' + str(100 - int(sm_d[0]) * 10) + '%;">' + sm_d[1] + '</span>', data, 1)
-            elif color_2:
-                c_d_2 = color_2.groups()
-                data = com.sub('<span style="color: ' + c_d_2[0] + '">' + c_d_2[1] + '</span>', data, 1)
-            elif color_3:
-                c_d_3 = color_3.groups()
-                data = com.sub('<span style="color: ' + c_d_3[0] + '">' + c_d_3[1] + '</span>', data, 1)
-            elif back:
-                back_d_1 = back.groups()
-                data = com.sub('<span style="background: #' + back_d_1[0] + '">' + back_d_1[1] + '</span>', data, 1)
-            elif back_3:
-                back_d_3 = back_3.groups()
-                data = com.sub('<span style="background: ' + back_d_3[0] + '">' + back_d_3[1] + '</span>', data, 1)
-            elif div:
-                div_d = div.groups()
-                data = com.sub('<div style="' + div_d[0] + '">' + div_d[1] + '</div>', data, 1)
-            elif html_d:
-                data = com.sub(html_d.groups()[0], data, 1)
-            elif fol:
-                fol_d = fol.groups()
-                if toc_y != 0:
-                    data = com.sub("<div>" + fol_d[0] + " <div id='folding_" + str(fol_num + 1) + "' style='display: inline-block;'>" + "[<a href='javascript:void(0);' onclick='folding(" + str(fol_num + 1) + "); folding(" + str(fol_num + 2) + "); folding(" + str(fol_num) + ");'>펼치기</a>]</div>" + "<div id='folding_" + str(fol_num + 2) + "' style='display: none;'>[" + "<a href='javascript:void(0);' onclick='folding(" + str(fol_num + 1) + "); folding(" + str(fol_num + 2) + ");" + " folding(" + str(fol_num) + ");'>접기</a>]</div><div id='folding_" + str(fol_num) + "' style='display: none;'>" + "<br>" + fol_d[1] + "</div></div>", data, 1)
-                    fol_num += 3
-                else:
-                    data = com.sub("<div>" + fol_d[0] + "<br><br>" + fol_d[1] + "</div>", data, 1)
-                
-            elif syn:
-                if syntax == 0:
-                    data += '<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"><script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script>'
-                    syntax = 1
-
-                syn_d = syn.groups()
-                tax_d = syn_d[1].replace(' ', '<space>')
-                tax_d = tax_d.replace('\r\n', '<isbr>')
-                data = com.sub('<pre id="syntax"><code class="' + syn_d[0] + '"><code>' + tax_d + '</code></code></pre>', data, 1)
-            elif include_out:
-                if (include or in_c) == 1:
-                    data = com.sub("", data, 1)
-                else:
-                    data = com.sub(include_out.groups()[0], data, 1)
-            else:
-                data = com.sub(it_d, data, 1)
-        else:
-            break
-            
-    return [data, fol_num]