Quellcode durchsuchen

파서 다 때려 고침

ect (or 2du) vor 8 Jahren
Ursprung
Commit
a3cdf6495f

+ 18 - 4
set_mark/end.py

@@ -6,7 +6,7 @@ def end(data, category):
         data += '<div style="margin-top: 30px;" id="cate">분류: ' + category + '</div>'
             
     data = re.sub("\r\n(?P<in><h[0-6])", "\g<in>", data)
-    data = re.sub("(\n<nobr>|<nobr>\n|<nobr>)", "", data)
+    data = re.sub("(\n#no-br#|#no-br#\n|#no-br#)", "", data)
     data = re.sub("&lt;space&gt;", " ", data)
 
     com = re.compile('#base64#((?:(?!#\/base64#|%0A).)+)#\/base64#', re.DOTALL)
@@ -21,7 +21,7 @@ def end(data, category):
     while 1:
         m = com.search(data)
         if m:
-            data = com.sub('<pre>' + parse.unquote(m.groups()[0]).replace('&#95;', '_').replace('\r\n', '<br>') + '</pre>', data, 1)
+            data = com.sub('<pre style="margin-top: 10px;">' + parse.unquote(m.groups()[0]).replace('&#95;', '_').replace('\r\n', '<br>') + '</pre>', data, 1)
         else:
             break
 
@@ -38,11 +38,25 @@ def end(data, category):
     data = re.sub('<\/blockquote>(?:(?:\r)?\n)<br><blockquote>', '</blockquote><blockquote>', data)
 
     data = re.sub('\n', '<br>', data)
-    data = re.sub('<pre><br>', '<pre>', data)
-    data = re.sub('<hr id="under_bar"([^>]*)><br>', '<hr id="under_bar" style="margin-top: -5px;">', data)
+    data = re.sub('<br><ul id="list">', '<ul id="list">', data)
+    data = re.sub('<\/ul>\r<br>', '</ul>', data)
+    data = re.sub('<\/table>\r<br><ul ', '</table><ul ', data)
+    data = re.sub('<pre style="margin-top: 10px;"><br>', '<pre style="margin-top: 10px;">', data)
+    data = re.sub('<\/pre>\r<br>', '</pre>', data)
+    data = re.sub('<hr id="under_bar"([^>]*)>(\r)?<br>', '<hr id="under_bar" style="margin-top: -5px;">', data)
     data = re.sub('&lt;isbr&gt;', '\r\n', data)
     data = re.sub('^(?:<br>|\r|\n| )+', '', data)
     data = re.sub('^<div style="margin-top: 30px;" id="cate">', '<div id="cate">', data)        
     data = re.sub('&amp;#92;', '&#92;', data)
+    
+    data = data.replace('#mid#', '{{{')
+    data = data.replace('#/mid#', '}}}')
+
+    data = data.replace('#mid2#', '{{{')
+    data = data.replace('#/mid2#', '}}}')
+
+    if re.search('&lt;math&gt;((?:(?!&lt;\/math&gt;).)*)&lt;\/math&gt;', data):
+        data += '<script type="text/x-mathjax-config">MathJax.Hub.Config({ extensions: ["tex2jax.js", "AMSmath.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ [\'<math>\',\'</math>\'] ],processEscapes: true }, }); </script>'
+        data += '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>'
 
     return data

+ 10 - 12
set_mark/footnote.py

@@ -5,12 +5,15 @@ def footnote(data, fol_num):
     tou = "<hr style='margin-top: 30px;' id='footnote'><div><br>"
     namu = []
     div = ''
+
+    data = re.sub("\[각주\](?:(?:<br>| |\r|\n)+)?$", "", data)
+
     pop_re = re.compile('(?:\[\*([^\s]*)(?:\s((?:(?!\[|\]).)*))?\]|(\[각주\]))')
     while 1:
         b = pop_re.search(data)
         if b:
             results = b.groups()
-            try:
+            if not results[2]:
                 if not results[1] and results[0]:
                     i = 0
                     
@@ -18,18 +21,18 @@ def footnote(data, fol_num):
                         try:
                             if namu[i] == results[0]:
                                 none_this = 0
+                                
                                 break
                             else:
                                 i += 2
                         except:
                             none_this = 1
+                            
                             break
                             
                     if none_this == 0:
                         data = pop_re.sub("<sup><a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ", 1);' id='rfn-" + str(a) + "'>(" + results[0] + ")</a></sup>", data, 1)
-                        div += "<div class='popup' style='display: none;' id='folding_" + str(fol_num) + "'><a onclick='folding(" + str(fol_num) + ");'" + \
-                                " href='#fn-" + str(a) + "'>(" + results[0] + ")</a> <a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ");'>(X)</a> " + \
-                                namu[i + 1] + "</div>"
+                        div = "<div class='popup' style='display: none;' id='folding_" + str(fol_num) + "'><a onclick='folding(" + str(fol_num) + ");' href='#fn-" + str(a) + "'>(" + results[0] + ")</a> <a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ");'>(X)</a> " + namu[i + 1] + "</div>" + div
                     else:
                         data = pop_re.sub("<sup><a href='javascript:void(0);' id='rfn-" + str(a) + "'>(" + results[0] + ")</a></sup>", data, 1)
                 else:
@@ -40,21 +43,17 @@ def footnote(data, fol_num):
                         data = pop_re.sub("<sup><a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ", 1);' id='rfn-" + str(a) + "'>(" + results[0] + ")</a></sup>", data, 1)
 
                         tou += "<span id='footnote-list'><a href='#rfn-" + str(a) + "' id='fn-" + str(a) + "'>(" + results[0] + ")</a> " + results[1] + "</span><br>"                        
-                        div += "<div class='popup' style='display: none;' id='folding_" + str(fol_num) + "'><a onclick='folding(" + str(fol_num) + ");'" + \
-                                " href='#fn-" + str(a) + "'>(" + results[0] + ")</a> <a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ");'>" + \
-                                "(X)</a> " + results[1] + "</div>"
+                        div = "<div class='popup' style='display: none;' id='folding_" + str(fol_num) + "'><a onclick='folding(" + str(fol_num) + ");'  href='#fn-" + str(a) + "'>(" + results[0] + ")</a> <a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ");'>(X)</a> " + results[1] + "</div>" + div
 
                     else:                    
                         data = pop_re.sub('<sup><a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ', 1);" id="rfn-' + str(a) + '">(' + str(a) + ')</a></sup>', data, 1)
 
                         tou += "<span id='footnote-list'><a href='#rfn-" + str(a) + "' id='fn-" + str(a) + "'>(" + str(a) + ")</a> " + results[1] + "</span><br>"
-                        div += '<div class="popup" style="display: none;" id="folding_' + str(fol_num) + '"><a onclick="folding(' + str(fol_num) + ');"' + \
-                                ' href="#fn-' + str(a) + '">(' + str(a) + ')</a> <a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ');">(X)</a> ' + \
-                                results[1] + '</div>'
+                        div = '<div class="popup" style="display: none;" id="folding_' + str(fol_num) + '"><a onclick="folding(' + str(fol_num) + ');" href="#fn-' + str(a) + '">(' + str(a) + ')</a> <a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ');">(X)</a> ' + results[1] + '</div>' + div
                     a += 1
 
                 fol_num += 2
-            except:
+            else:
                 tou += '</div>'
 
                 if tou == "<hr style='margin-top: 30px;' id='footnote'><div><br></div>":
@@ -70,7 +69,6 @@ def footnote(data, fol_num):
 
             break
     
-    data = re.sub("\[각주\](?:(?:<br>| |\r|\n)+)?$", "", data)
     data = re.sub("(?:(?:<br>| |\r|\n)+)$", "", data)
     data += tou + div
     

+ 2 - 0
set_mark/html_pas.py

@@ -30,6 +30,8 @@ def html_pas(data):
 
     data = html.escape(data)
     data = data.replace('\\', '&#92;')
+
+    print([data])
     
     end = re.findall('%H%((?:(?!%/H%).)*)%/H%', data)
     for d_end in end:

+ 1 - 1
set_mark/include_pas.py

@@ -61,7 +61,7 @@ def include_pas(conn, data, title, in_c, num, toc_y, fol_num):
                     else:
                         test = ''
 
-                data = include.sub('<nobr><a id="include_link" href="/w/' + url_pas(results[0]) + '">[' + results[0] + ' 이동]</a><br><span>' + in_data + '</span>' + test, data, 1)
+                data = include.sub('#no-br#<a id="include_link" href="/w/' + url_pas(results[0]) + '">[' + results[0] + ' 이동]</a><br><span>' + in_data + '</span>' + test, data, 1)
             else:
                 data = include.sub("<a class=\"not_thing\" href=\"/w/" + url_pas(results[0]) + "\">" + results[0] + "</a>", data, 1)
 

+ 3 - 6
set_mark/indent.py

@@ -1,13 +1,10 @@
 import re
 
 def indent(data):
-    data = re.sub('\n \|\|', '\n||', data)
-
     while 1:
         m = re.search("(\n(?:(?:( *)\* ?(?:[^\n]*))\n?)+)", data)
         if m:
-            result = m.groups()
-            end = str(result[0])
+            end = m.groups()[0]
 
             while 1:
                 isspace = re.search("\n( *)\* ?([^\n]*)", end)
@@ -18,12 +15,12 @@ def indent(data):
                     else:
                         up = len(spacebar[0]) * 20
 
-                    end = re.sub("\n( *)\* ?([^\n]*)", "<li style='margin-left:" + str(up) + "px'>" + spacebar[1] + "</li>", end, 1)
+                    end = re.sub("\n( *)\* ?([^\n]*)", '<li style="margin-left: ' + str(up) + 'px">' + spacebar[1] + '</li>', end, 1)
                 else:
                     break
 
             end = re.sub("\n", '', end)
-            data = re.sub("(\n(?:(?:( *)\* ?(?:[^\n]*))\n?)+)", '<ul style="margin-top: 10px; margin-bottom: 10px;" id="list">' + end + '</ul>', data, 1)
+            data = re.sub("(\n(?:(?:( *)\* ?(?:[^\n]*))\n?)+)", '\r\n<ul style="margin-top: 10px; margin-bottom: 10px;" id="list">' + end + '</ul>\r\n', data, 1)
         else:
             break
 

+ 21 - 14
set_mark/mid_pas.py

@@ -5,6 +5,23 @@ 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('&#95;', '_').replace('&#8208;', '-') + '#/mid2#', m.groups()[0])
+            else:
+                test2 = m.groups()[0]
+                
+            data = com.sub('#base64#' + parse.quote(test2).replace('_', '&#95;').replace('-', '&#8208;').replace('%3C', '&lt;').replace('%3E', '&gt;') + '#/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)
@@ -20,13 +37,11 @@ def mid_pas(data, fol_num, include, in_c, toc_y):
             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('&#95;', '_').replace('&#8208;', '-') + \
-                                '#/mid2#', m.groups()[0])
+                test2 = com4.sub('#mid2#' + parse.unquote(test.groups()[0]).replace('&#95;', '_').replace('&#8208;', '-') + '#/mid2#', m.groups()[0])
             else:
                 test2 = m.groups()[0]
                 
-            data = com.sub('#base64#' + parse.quote(test2).replace('_', '&#95;').replace('-', '&#8208;').replace('%3C', '&lt;').replace('%3E', '&gt;') + \
-                            '#/base64#', data, 1)
+            data = com.sub('#base64#' + parse.quote(test2).replace('_', '&#95;').replace('-', '&#8208;').replace('%3C', '&lt;').replace('%3E', '&gt;') + '#/base64#', data, 1)
         else:
             break
 
@@ -105,22 +120,14 @@ def mid_pas(data, fol_num, include, in_c, toc_y):
             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)
+                    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>'
+                    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()

+ 1 - 0
set_mark/start.py

@@ -5,5 +5,6 @@ def start(data):
     data = data.replace('\\n', '&#92;n')
     data = re.sub("\n", "\r\n", re.sub("\r\n", "\n", data))
     data = '\r\n' + data + '\r\n'
+    data = re.sub('\n \|\|', '\n||', data)
         
     return data

+ 16 - 20
set_mark/table.py

@@ -105,7 +105,7 @@ def table_p(d, d2, d3, num = 0):
         d = text_class.groups()
         table_class += d[0]
         
-    alltable += '"'
+    alltable += 'margin-top: 10px;"'
     celstyle += '"'
     rowstyle += '"'
     table_class += '"'
@@ -113,28 +113,31 @@ def table_p(d, d2, d3, num = 0):
     return [alltable, rowstyle, celstyle, row, cel, table_class, num]
 
 def table(data):
-    data = re.sub("(?:\|\|\r\n)", "#table#<tablenobr>", data)
+    data += '\r\n'
+    data = re.sub('(\r+)', '\r', data)
+    data = re.sub("(?:\|\|\r\n)", "#table-start##table-no-br#", data)
         
     while 1:
-        y = re.search("(\|\|(?:(?:(?:(?:(?!\|\|).)*)(?:\n?))+))", data)
+        y = re.search("(\|\|(?:(?:(?!\|\|).)+(?:\n*))+)", data)
         if y:
             a = y.groups()
             
-            mid_data = re.sub("\|\|", "#table#", a[0])
+            mid_data = re.sub("\|\|", "#table-start#", a[0])
             mid_data = re.sub("\r\n", "<br>", mid_data)
             
-            data = re.sub("(\|\|((?:(?:(?:(?!\|\|).)*)(?:\n?))+))", mid_data, data, 1)
+            data = re.sub("(\|\|(?:(?:(?!\|\|).)+(?:\n*))+)", mid_data, data, 1)
         else:
             break
             
-    data = re.sub("#table#", "||", data)
-    data = re.sub("<tablenobr>", "\r\n", data)
+    data = re.sub("#table-start#", "||", data)
+    data = re.sub("#table-no-br#", "\r\n", data)
     
     while 1:
         m = re.search("(\|\|(?:(?:(?:.*)\n?)\|\|)+)", data)
         if m:
             results = m.groups()
             table = results[0]
+
             while 1:
                 a = re.search("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\||<\/td>).)*)", table)
                 if a:
@@ -157,9 +160,7 @@ def table(data):
                         table_class = table_d[5]
                         num = table_d[6]
                             
-                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", \
-                                        "<table " + table_class + " " + alltable + "><tbody><tr " + rowstyle + \
-                                        "><td " + cel + " " + row + " " + celstyle + ">", table, 1)
+                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "<table " + table_class + " " + alltable + "><tbody><tr " + rowstyle + "><td " + cel + " " + row + " " + celstyle + ">", table, 1)
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
 
@@ -170,8 +171,7 @@ def table(data):
                         elif re.search('^(.*) $', result[2]):
                             celstyle += 'text-align: left;'
 
-                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", \
-                                        "<table><tbody><tr><td " + cel + " style='" + celstyle + "'>", table, 1)
+                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "<table style='margin-top: 10px;'><tbody><tr><td " + cel + " style='" + celstyle + "'>", table, 1)
                 else:
                     break
                     
@@ -194,8 +194,7 @@ def table(data):
                         row = table_d[3]
                         cel = table_d[4]
                         
-                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", \
-                                        "</td></tr><tr " + rowstyle + "><td " + cel + " " + row + " " + celstyle + ">", table, 1)
+                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td></tr><tr " + rowstyle + "><td " + cel + " " + row + " " + celstyle + ">", table, 1)
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
 
@@ -206,8 +205,7 @@ def table(data):
                         elif re.search('^(.*) $', result[2]):
                             celstyle += 'text-align: left;'
 
-                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", \
-                                        "</td></tr><tr><td " + cel + " style='" + celstyle + "'>", table, 1)
+                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td></tr><tr><td " + cel + " style='" + celstyle + "'>", table, 1)
                 else:
                     break
 
@@ -226,8 +224,7 @@ def table(data):
                         row = table_d[3]
                         cel = table_d[4]
 
-                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", \
-                                        "</td><td " + cel + " " + row + " " + celstyle + ">", table, 1)
+                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td><td " + cel + " " + row + " " + celstyle + ">", table, 1)
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
 
@@ -238,8 +235,7 @@ def table(data):
                         elif re.search('^(.*) $', result[2]):
                             celstyle += 'text-align: left;'
 
-                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", \
-                                        "</td><td " + cel + " style='" + celstyle + "'>", table, 1)
+                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td><td " + cel + " style='" + celstyle + "'>", table, 1)
                 else:
                     break
             

+ 7 - 8
set_mark/text_help.py

@@ -6,14 +6,13 @@ def text_help(data):
     data = re.sub('(?:~~|--)(?P<in>(?:(?!~~|--).)+)(?:~~|--)', '<s>\g<in></s>', data)
     data = re.sub('__(?P<in>.+?)__(?!_)', '<u>\g<in></u>', data)
     data = re.sub('\^\^(?P<in>.+?)\^\^(?!\^)', '<sup>\g<in></sup>', data)
-    data = re.sub(',,(?P<in>.+?),,(?!,)', '<sub>\g<in></sub>', data)
-
-    if re.search('&lt;math&gt;((?:(?!&lt;\/math&gt;).)*)&lt;\/math&gt;', data):
-        data = re.sub('&lt;math&gt;(?P<in>(?:(?!&lt;\/math&gt;).)*)&lt;\/math&gt;', '[math]\g<in>[/math]', data)
-        data += '<script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { inlineMath: [["[math]","[/math]"], processEscapes: true } });</script> \
-                <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config=TeX-AMS_CHTML"></script>'
- 
+    data = re.sub(',,(?P<in>.+?),,(?!,)', '<sub>\g<in></sub>', data) 
     data = re.sub('{{\|(?P<in>(?:(?:(?:(?!\|}}).)*)(?:\n?))+)\|}}', '<table><tbody><tr><td>\g<in></td></tr></tbody></table>', data)
-    data = re.sub("-{4,11}", "<hr>", data)
+
+    while 1:
+        if re.search("\n-{4,9}( *)\r\n", data):
+            data = re.sub("\n-{4,9}( *)\r\n", "\n<hr style='margin-top: 10px; margin-bottom: -10px;'>\n", data, 1)
+        else:
+            break
         
     return data

+ 1 - 3
set_mark/toc_pas.py

@@ -71,9 +71,7 @@ def toc_pas(data, title, num, toc_y):
             if toc_y == 1:
                 edit_d = ' <span style="font-size: 12px;"><a href="/edit/' + url_pas(title) + '?section=' + str(i[0]) + '">(편집)</a></span>'
 
-            data = re.sub('(={1,6})\s?([^=]*)\s?(?:={1,6})(?:\s+)?\n', '<tablenobr><h' + str(wiki) + ' id="' + c + '" ' + margin + '><a href="#toc" id="s-' + toc + '">' \
-                                                                         + toc + '.<span style="margin-left: 5px;"></span></a> ' \
-                                                                         + d + edit_d + '</h' + str(wiki) + '><hr id="under_bar" style="margin-top: -5px;">\n', data, 1)
+            data = re.sub('(={1,6})\s?([^=]*)\s?(?:={1,6})(?:\s+)?\n', '#table-no-br#<h' + str(wiki) + ' id="' + c + '" ' + margin + '><a href="#toc" id="s-' + toc + '">' + toc + '.<span style="margin-left: 5px;"></span></a> ' + d + edit_d + '</h' + str(wiki) + '><hr id="under_bar" style="margin-top: -5px;">\n', data, 1)
         else:
             rtoc += '</div>'