Sfoglia il codice sorgente

Merge pull request #288 from 2DU/master

Master
ect (or 2du) 8 anni fa
parent
commit
2554137fb6
2 ha cambiato i file con 60 aggiunte e 36 eliminazioni
  1. 36 22
      app.py
  2. 24 14
      set_mark/table.py

+ 36 - 22
app.py

@@ -104,6 +104,16 @@ try:
     curs.execute("drop table if exists move")
     curs.execute("drop table if exists move")
     curs.execute("create table if not exists filter(name text, regex text, sub text)")
     curs.execute("create table if not exists filter(name text, regex text, sub text)")
 
 
+    try:
+        curs.execute("alter table history add hide text default ''")
+        
+        curs.execute('select title, re from hidhi')
+        for rep in curs.fetchall():
+            curs.execute("update history set hide = 'O' where title = ? and id = ?", [rep[0], rep[1]])
+        curs.execute("drop table if exists hidhi")
+    except:
+        pass
+
     conn.commit()
     conn.commit()
 except:
 except:
     pass
     pass
@@ -146,7 +156,7 @@ def setup():
         curs.execute("select title from data limit 1")
         curs.execute("select title from data limit 1")
     except:
     except:
         curs.execute("create table if not exists data(title text, data text, acl text)")
         curs.execute("create table if not exists data(title text, data text, acl text)")
-        curs.execute("create table if not exists history(id text, title text, data text, date text, ip text, send text, leng text)")
+        curs.execute("create table if not exists history(id text, title text, data text, date text, ip text, send text, leng text, hide text)")
         curs.execute("create table if not exists rd(title text, sub text, date text)")
         curs.execute("create table if not exists rd(title text, sub text, date text)")
         curs.execute("create table if not exists user(id text, pw text, acl text)")
         curs.execute("create table if not exists user(id text, pw text, acl text)")
         curs.execute("create table if not exists ban(block text, end text, why text, band text)")
         curs.execute("create table if not exists ban(block text, end text, why text, band text)")
@@ -154,7 +164,6 @@ def setup():
         curs.execute("create table if not exists stop(title text, sub text, close text)")
         curs.execute("create table if not exists stop(title text, sub text, close text)")
         curs.execute("create table if not exists rb(block text, end text, today text, blocker text, why text)")
         curs.execute("create table if not exists rb(block text, end text, today text, blocker text, why text)")
         curs.execute("create table if not exists back(title text, link text, type text)")
         curs.execute("create table if not exists back(title text, link text, type text)")
-        curs.execute("create table if not exists hidhi(title text, re text)")
         curs.execute("create table if not exists agreedis(title text, sub text)")
         curs.execute("create table if not exists agreedis(title text, sub text)")
         curs.execute("create table if not exists custom(user text, css text)")
         curs.execute("create table if not exists custom(user text, css text)")
         curs.execute("create table if not exists other(name text, data text)")
         curs.execute("create table if not exists other(name text, data text)")
@@ -595,12 +604,11 @@ def admin_list():
 @route('/history/<name:path>/r/<num:int>/hidden')
 @route('/history/<name:path>/r/<num:int>/hidden')
 def history_hidden(name = None, num = None):
 def history_hidden(name = None, num = None):
     if(admin_check(conn, 6, 'history_hidden (' + name + '#' + str(num) + ')') == 1):
     if(admin_check(conn, 6, 'history_hidden (' + name + '#' + str(num) + ')') == 1):
-        curs.execute("select * from hidhi where title = ? and re = ?", [name, str(num)])
-        exist = curs.fetchall()
-        if(exist):
-            curs.execute("delete from hidhi where title = ? and re = ?", [name, str(num)])
+        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
+        if(curs.fetchall()):
+            curs.execute("update history set hide = '' where title = ? and id = ?", [name, str(num)])
         else:
         else:
-            curs.execute("insert into hidhi (title, re) values (?, ?)", [name, str(num)])
+            curs.execute("update history set hide = 'O' where title = ? and id = ?", [name, str(num)])
             
             
         conn.commit()
         conn.commit()
     
     
@@ -727,7 +735,7 @@ def indexing():
     return(redirect('/'))        
     return(redirect('/'))        
         
         
 @route('/xref/<name:path>')
 @route('/xref/<name:path>')
-@route('/xref/<name:path>/<num:int>')
+@route('/xref/<name:path>/num/<num:int>')
 def xref(name = None, num = 1):
 def xref(name = None, num = 1):
     if(num * 50 > 0):
     if(num * 50 > 0):
         sql_num = num * 50 - 50
         sql_num = num * 50 - 50
@@ -755,7 +763,7 @@ def xref(name = None, num = 1):
         if(re.search('^틀:', data[0])):
         if(re.search('^틀:', data[0])):
             div += '<li><a id="inside" href="/xref/' + url_pas(data[0]) + '">' + data[0] + '</a> (역링크)</li>'
             div += '<li><a id="inside" href="/xref/' + url_pas(data[0]) + '">' + data[0] + '</a> (역링크)</li>'
       
       
-    div += '</ul><hr><a href="/xref/' + url_pas(name) + '/' + str(num - 1) + '">(이전)</a> <a href="/xref/' + url_pas(name) + '/' + str(num + 1) + '">(이후)</a>'
+    div += '</ul><hr><a href="/xref/' + url_pas(name) + '/num/' + str(num - 1) + '">(이전)</a> <a href="/xref/' + url_pas(name) + '/num/' + str(num + 1) + '">(이후)</a>'
     
     
     return(html_minify(template('index', 
     return(html_minify(template('index', 
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (역링크)', 0])],
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (역링크)', 0])],
@@ -993,7 +1001,7 @@ def raw_view(name = None, sub_t = None, num = None):
     sub = ' (원본)'
     sub = ' (원본)'
     
     
     if(not sub_t and num):
     if(not sub_t and num):
-        curs.execute("select title from hidhi where title = ? and re = ?", [name, str(num)])
+        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
         hid = curs.fetchall()
         hid = curs.fetchall()
         if(hid and admin_check(conn, 6, None) != 1):
         if(hid and admin_check(conn, 6, None) != 1):
             return(re_error(conn, '/error/3'))
             return(re_error(conn, '/error/3'))
@@ -1039,7 +1047,7 @@ def revert(name = None, num = None):
         else:
         else:
             captcha_post('', conn, 0)
             captcha_post('', conn, 0)
 
 
-        curs.execute("select title from hidhi where title = ? and re = ?", [name, str(num)])
+        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
         if(curs.fetchall() and admin_check(conn, 6, None) != 1):
         if(curs.fetchall() and admin_check(conn, 6, None) != 1):
             return(re_error(conn, '/error/3'))
             return(re_error(conn, '/error/3'))
 
 
@@ -1068,7 +1076,7 @@ def revert(name = None, num = None):
             
             
             return(redirect('/w/' + url_pas(name)))
             return(redirect('/w/' + url_pas(name)))
     else:
     else:
-        curs.execute("select title from hidhi where title = ? and re = ?", [name, str(num)])
+        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
         hid = curs.fetchall()
         hid = curs.fetchall()
         if(hid and admin_check(conn, 6, None) != 1):
         if(hid and admin_check(conn, 6, None) != 1):
             return(re_error(conn, '/error/3'))    
             return(re_error(conn, '/error/3'))    
@@ -1516,7 +1524,7 @@ def delete(name = None):
         )))            
         )))            
             
             
 @route('/move_data/<name:path>')
 @route('/move_data/<name:path>')
-@route('/move_data/<name:path>/<num:int>')
+@route('/move_data/<name:path>/num/<num:int>')
 def move_data(name = None, num = 1):
 def move_data(name = None, num = 1):
     if(num * 50 > 0):
     if(num * 50 > 0):
         sql_num = num * 50 - 50
         sql_num = num * 50 - 50
@@ -1535,7 +1543,7 @@ def move_data(name = None, num = 1):
         data += '<li><a href="/move_data/' + url_pas(match[0]) + '">' + match[0] + '</a> - <a href="/move_data/' + url_pas(match[1]) + '">' + match[1] + '</a>'
         data += '<li><a href="/move_data/' + url_pas(match[0]) + '">' + match[0] + '</a> - <a href="/move_data/' + url_pas(match[1]) + '">' + match[1] + '</a>'
         data += ' / ' + for_data[2] + ' / ' + for_data[1] + ' / ' + send + '</li>'
         data += ' / ' + for_data[2] + ' / ' + for_data[1] + ' / ' + send + '</li>'
     
     
-    data += '</ul><hr><a href="/move_data/' + url_pas(name) + '/' + str(num - 1) + '">(이전)</a> <a href="/move_data/' + url_pas(name) + '/' + str(num + 1) + '">(이후)</a>'
+    data += '</ul><hr><a href="/move_data/' + url_pas(name) + '/num/' + str(num - 1) + '">(이전)</a> <a href="/move_data/' + url_pas(name) + '/num/' + str(num + 1) + '">(이후)</a>'
     
     
     return(html_minify(template('index', 
     return(html_minify(template('index', 
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (이동 기록)', 0])],
         imp = [name, wiki_set(conn, 1), custom(conn), other2([' (이동 기록)', 0])],
@@ -1628,7 +1636,7 @@ def other():
                             '== 관리자 ==\r\n' + \
                             '== 관리자 ==\r\n' + \
                             ' * [[wiki:manager/1|관리자 메뉴]]\r\n' + \
                             ' * [[wiki:manager/1|관리자 메뉴]]\r\n' + \
                             '== 버전 ==\r\n' + \
                             '== 버전 ==\r\n' + \
-                            '이 오픈나무는 [[https://github.com/2DU/openNAMU/blob/SQLite/version.md|' + r_ver + ']]판 입니다.', 0, 0, 0),
+                            ' * 이 오픈나무는 [[https://github.com/2DU/openNAMU/blob/SQLite/version.md|' + r_ver + ']]판 입니다.', 0, 0, 0),
         menu = 0
         menu = 0
     )))
     )))
     
     
@@ -1883,7 +1891,12 @@ def topic_admin(name = None, sub = None, num = None):
     ban += '== 기타 도구 ==\r\n'
     ban += '== 기타 도구 ==\r\n'
     ban += ' * [[wiki:/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '/raw/' + str(num) + '|원본]]\r\n'
     ban += ' * [[wiki:/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '/raw/' + str(num) + '|원본]]\r\n'
     ban = ' * 작성 시간 : ' + data[0][2] + '\r\n' + ban
     ban = ' * 작성 시간 : ' + data[0][2] + '\r\n' + ban
-    ban = ' * 작성인 : ' + data[0][1] + ' [[wiki:record/' + url_pas(data[0][1]) + '|(기록)]]\r\n' + ban
+
+    if(re.search('(\.|:)', data[0][1])):
+        ban = ' * 작성인 : ' + data[0][1] + ' [[wiki:record/' + url_pas(data[0][1]) + '|(기록)]]\r\n' + ban
+    else:
+        ban = ' * 작성인 : [[사용자:' + data[0][1] + '|' + data[0][1] + ']] [[wiki:record/' + url_pas(data[0][1]) + '|(기록)]]\r\n' + ban
+
     ban = '== 정보 ==\r\n' + ban
     ban = '== 정보 ==\r\n' + ban
     ban = '[목차(없음)]\r\n' + ban
     ban = '[목차(없음)]\r\n' + ban
 
 
@@ -2751,7 +2764,7 @@ def read_view(name = None, num = None, redirect = None):
             div += u_div
             div += u_div
 
 
     if(num):
     if(num):
-        curs.execute("select title from hidhi where title = ? and re = ?", [name, str(num)])
+        curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [name, str(num)])
         hid = curs.fetchall()
         hid = curs.fetchall()
         if(hid and admin_check(conn, 6, None) != 1):
         if(hid and admin_check(conn, 6, None) != 1):
             return(redirect('/history/' + url_pas(name)))
             return(redirect('/history/' + url_pas(name)))
@@ -2908,7 +2921,7 @@ def user_topic_list(name = None, num = 1):
     )))
     )))
 
 
 @route('/<tool:re:history|record>/<name:path>', method=['POST', 'GET'])
 @route('/<tool:re:history|record>/<name:path>', method=['POST', 'GET'])
-@route('/<tool:re:history|record>/<name:path>/<num:int>', method=['POST', 'GET'])
+@route('/<tool:re:history|record>/<name:path>/num/<num:int>', method=['POST', 'GET'])
 @route('/record/<name:path>/<num:int>/<what:path>')
 @route('/record/<name:path>/<num:int>/<what:path>')
 @route('/recent_changes')
 @route('/recent_changes')
 @route('/recent_changes/<what:path>')
 @route('/recent_changes/<what:path>')
@@ -3006,7 +3019,8 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
             
             
             style = ['', '']
             style = ['', '']
             date = data[2]
             date = data[2]
-            curs.execute("select title from hidhi where title = ? and re = ?", [data[1], data[0]])
+
+            curs.execute("select title from history where title = ? and id = ? and hide = 'O'", [data[1], data[0]])
             hide = curs.fetchall()
             hide = curs.fetchall()
             if(six_admin == 1):
             if(six_admin == 1):
                 if(hide):                            
                 if(hide):                            
@@ -3050,7 +3064,7 @@ def recent_changes(name = None, num = 1, what = 'all', tool = 'record'):
                 title = name
                 title = name
                 sub += ' (역사)'
                 sub += ' (역사)'
                 menu = [['w/' + url_pas(name), '문서'], ['move_data/' + url_pas(name), '이동 기록']]
                 menu = [['w/' + url_pas(name), '문서'], ['move_data/' + url_pas(name), '이동 기록']]
-                div += '<hr><a href="/history/' + url_pas(name) + '/' + str(num - 1) + '">(이전)</a> <a href="/history/' + url_pas(name) + '/' + str(num + 1) + '">(이후)</a>'
+                div += '<hr><a href="/history/' + url_pas(name) + '/num/' + str(num - 1) + '">(이전)</a> <a href="/history/' + url_pas(name) + '/num/' + str(num + 1) + '">(이후)</a>'
             else:
             else:
                 curs.execute("select end, why from ban where block = ?", [name])
                 curs.execute("select end, why from ban where block = ?", [name])
                 ban_it = curs.fetchall()
                 ban_it = curs.fetchall()
@@ -3196,8 +3210,8 @@ def user_info():
         imp = ['사용자 메뉴', wiki_set(conn, 1), custom_data, other2([0, 0])],
         imp = ['사용자 메뉴', wiki_set(conn, 1), custom_data, other2([0, 0])],
         data =  namumark(conn, '',  '[목차(없음)]\r\n' + \
         data =  namumark(conn, '',  '[목차(없음)]\r\n' + \
                                     '== 상태 ==\r\n' + \
                                     '== 상태 ==\r\n' + \
-                                    ip_user + '\r\n\r\n'
-                                    '권한 상태 : ' + acl + '\r\n' + \
+                                    ' * ' + ip_user + '\r\n'
+                                    ' * 권한 상태 : ' + acl + '\r\n' + \
                                     '== 로그인 ==\r\n' + \
                                     '== 로그인 ==\r\n' + \
                                     plus + '\r\n' + \
                                     plus + '\r\n' + \
                                     ' * [[wiki:register|회원가입]]\r\n' + \
                                     ' * [[wiki:register|회원가입]]\r\n' + \

+ 24 - 14
set_mark/table.py

@@ -1,6 +1,6 @@
 import re
 import re
 
 
-def table_p(d, d2):
+def table_p(d, d2, d3, num = 0):
     table_class = 'class="'
     table_class = 'class="'
     alltable = 'style="'
     alltable = 'style="'
     celstyle = 'style="'
     celstyle = 'style="'
@@ -23,6 +23,7 @@ def table_p(d, d2):
             
             
     table_t_a = re.search("&lt;table\s?textalign=((?:(?!&gt;).)*)&gt;", d)
     table_t_a = re.search("&lt;table\s?textalign=((?:(?!&gt;).)*)&gt;", d)
     if(table_t_a):
     if(table_t_a):
+        num = 1
         if(table_t_a.groups()[0] == 'right'):
         if(table_t_a.groups()[0] == 'right'):
             alltable += 'text-align: right;'
             alltable += 'text-align: right;'
         elif(table_t_a.groups()[0] == 'center'):
         elif(table_t_a.groups()[0] == 'center'):
@@ -91,6 +92,13 @@ def table_p(d, d2):
         celstyle += 'text-align: center;'
         celstyle += 'text-align: center;'
     elif(text_left):
     elif(text_left):
         celstyle += 'text-align: left;'
         celstyle += 'text-align: left;'
+    elif(num == 0):
+        if(re.search('^ (.*) $', d3)):
+            celstyle += 'text-align: center;'
+        elif(re.search('^ (.*)$', d3)):
+            celstyle += 'text-align: right;'
+        elif(re.search('^(.*) $', d3)):
+            celstyle += 'text-align: left;'
 
 
     text_class = re.search("&lt;table\s?class=((?:(?!&gt;).)+)&gt;", d)
     text_class = re.search("&lt;table\s?class=((?:(?!&gt;).)+)&gt;", d)
     if(text_class):
     if(text_class):
@@ -102,7 +110,7 @@ def table_p(d, d2):
     rowstyle += '"'
     rowstyle += '"'
     table_class += '"'
     table_class += '"'
 
 
-    return([alltable, rowstyle, celstyle, row, cel, table_class])
+    return([alltable, rowstyle, celstyle, row, cel, table_class, num])
 
 
 def table(data):
 def table(data):
     data = re.sub("(?:\|\|\r\n)", "#table#<tablenobr>", data)
     data = re.sub("(?:\|\|\r\n)", "#table#<tablenobr>", data)
@@ -128,7 +136,7 @@ def table(data):
             results = m.groups()
             results = m.groups()
             table = results[0]
             table = results[0]
             while(1):
             while(1):
-                a = re.search("^(\|\|(?:(?:\|\|)+)?)((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)?", table)
+                a = re.search("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\|).)*)", table)
                 if(a):
                 if(a):
                     row = ''
                     row = ''
                     cel = ''
                     cel = ''
@@ -136,28 +144,30 @@ def table(data):
                     rowstyle = ''
                     rowstyle = ''
                     alltable = ''
                     alltable = ''
                     table_d = ''
                     table_d = ''
+                    num = 0
 
 
                     result = a.groups()
                     result = a.groups()
                     if(result[1]):
                     if(result[1]):
-                        table_d = table_p(result[1], result[0])
+                        table_d = table_p(result[1], result[0], result[2])
                         alltable = table_d[0]
                         alltable = table_d[0]
                         rowstyle = table_d[1]
                         rowstyle = table_d[1]
                         celstyle = table_d[2]
                         celstyle = table_d[2]
                         row = table_d[3]
                         row = table_d[3]
                         cel = table_d[4]
                         cel = table_d[4]
                         table_class = table_d[5]
                         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:
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
-                        table = re.sub("^(\|\|(?:(?:\|\|)+)?)((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)?",   "<table><tbody><tr><td " + cel + ">", table, 1)
+                        table = re.sub("^(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "<table><tbody><tr><td " + cel + ">", table, 1)
                 else:
                 else:
                     break
                     break
                     
                     
             table = re.sub("\|\|$", "</td></tr></tbody></table>", table)
             table = re.sub("\|\|$", "</td></tr></tbody></table>", table)
             
             
             while(1):
             while(1):
-                b = re.search("\|\|\r\n(\|\|(?:(?:\|\|)+)?)((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)?", table)
+                b = re.search("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\|).)*)", table)
                 if(b):
                 if(b):
                     row = ''
                     row = ''
                     cel = ''
                     cel = ''
@@ -167,21 +177,21 @@ def table(data):
 
 
                     result = b.groups()
                     result = b.groups()
                     if(result[1]):
                     if(result[1]):
-                        table_d = table_p(result[1], result[0])
+                        table_d = table_p(result[1], result[0], result[2], num)
                         rowstyle = table_d[1]
                         rowstyle = table_d[1]
                         celstyle = table_d[2]
                         celstyle = table_d[2]
                         row = table_d[3]
                         row = table_d[3]
                         cel = table_d[4]
                         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:
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
-                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)+)?)((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)?", "</td></tr><tr><td " + cel + ">", table, 1)
+                        table = re.sub("\|\|\r\n(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td></tr><tr><td " + cel + ">", table, 1)
                 else:
                 else:
                     break
                     break
 
 
             while(1):
             while(1):
-                c = re.search("(\|\|(?:(?:\|\|)+)?)((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)?", table)
+                c = re.search("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)((?:(?!\|\|).)*)", table)
                 if(c):
                 if(c):
                     row = ''
                     row = ''
                     cel = ''
                     cel = ''
@@ -190,15 +200,15 @@ def table(data):
 
 
                     result = c.groups()
                     result = c.groups()
                     if(result[1]):
                     if(result[1]):
-                        table_d = table_p(result[1], result[0])
+                        table_d = table_p(result[1], result[0], result[2], num)
                         celstyle = table_d[2]
                         celstyle = table_d[2]
                         row = table_d[3]
                         row = table_d[3]
                         cel = table_d[4]
                         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:
                     else:
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
                         cel = 'colspan="' + str(round(len(result[0]) / 2)) + '"'
-                        table = re.sub("(\|\|(?:(?:\|\|)+)?)((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)?", "</td><td " + cel + ">", table, 1)
+                        table = re.sub("(\|\|(?:(?:\|\|)*))((?:&lt;(?:(?:(?!&gt;).)*)&gt;)*)", "</td><td " + cel + ">", table, 1)
                 else:
                 else:
                     break
                     break