Browse Source

Merge pull request #443 from 2DU/master

Master
Surplus_Up (2DU) 8 năm trước cách đây
mục cha
commit
0ec69f3f56
7 tập tin đã thay đổi với 405 bổ sung273 xóa
  1. 20 0
      ISSUE_TEMPLATE.md
  2. 157 156
      app.py
  3. 27 1
      language/ko-KR.json
  4. 1 1
      readme.md
  5. 194 112
      set_mark/start.py
  6. 0 1
      set_mark/tool.py
  7. 6 2
      version.md

+ 20 - 0
ISSUE_TEMPLATE.md

@@ -0,0 +1,20 @@
+## 설명
+[해당 이슈 자체에 대한 자세한 설명을 작성해주세요]
+
+## 과정
+[해당 이슈를 발생시킬 과정을 간략하게 나열해주세요]
+
+## 예상 결과
+[이 과정에서 얻어야할 결과가 무엇인가요?]
+
+## 현재 결과
+[이 과정에서 겪은 이슈를 설명해주세요]
+
+## Fix 요청
+[의무 사항은 아니지만 버그 수정 또는 버그 제안]
+
+* "OO을 입니다." 의 텍스트 문구를 "OO는 입니다." 로 변경해주세요. (Example)
+
+## 문제되는 이슈의 스크린샷 또는 코드
+[관련이 있는 스크린샷] or [관련 코드]
+

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 157 - 156
app.py


+ 27 - 1
language/ko-KR.json

@@ -1,6 +1,9 @@
 {
     "edit" : "편집",
     "history" : "역사",
+    "delete" : "삭제",
+    "bulk_delete" : "대량 삭제",
+    "edit_filter" : "편집 필터",
     "move" : "이동",
     "hide" : "숨김",
     "list" : "목록",
@@ -9,8 +12,31 @@
     "document" : "문서",
     "all" : "모든",
     "ban" : "차단",
-    "admin" : "관리자",
     "release" : "해제",
+    "save" : "저장",
+    "other" : "기타",
+    "tool" : "도구",
+    "plus" : "추가",
+    "user" : "사용자",
+    "alarm" : "알림",
+    "watchlist" : "주시 문서",
+    "my_info" : "내 정보",
+    "recent" : "최근",
+    "recent_changes" : "최근 변경",
+    "discussion" : "토론",
+    "login" : "로그인",
+    "logout" : "로그아웃",
+    "register" : "회원가입",
+    "no_alarm" : "알림이 없습니다.",
+    "able" : "가능",
+    "year" : "년",
+    "month" : "월",
+    "day" : "일",
+    "normal" : "일반",
+    "subscriber" : "가입자",
+    "admin" : "관리자",
+    "owner" : "소유자",
+    "admin_group" : "관리 그룹",
     "user_css_warring" : "비 로그인의 경우에는 사용자 CSS가 로그인하거나 브라우저 닫으면 날아갑니다.",
     "http_warring" : "주의 : 만약 HTTPS 연결이 아닌 경우 데이터가 유출될 가능성이 있습니다. 이에 대해 책임지지 않습니다."
 }

+ 1 - 1
readme.md

@@ -1,5 +1,5 @@
 ## 개요
-오픈나무 정식 버전 입니다. 파이썬으로 돌아 갑니다.
+오픈나무 정식 버전 입니다. 파이썬으로 돌아 갑니다. (3.5 이상)
 
 ## 클론 명령어
 ### 일반

+ 194 - 112
set_mark/start.py

@@ -95,11 +95,11 @@ def table_parser(data, cel_data, start_data, num = 0):
     elif text_left:
         cel_style += 'text-align: left;'
     elif num == 0:
-        if re.search('^ (.*) $', cel_data):
+        if re.search('^ ', cel_data) and re.search(' $', cel_data):
             cel_style += 'text-align: center;'
-        elif re.search('^ (.*)$', cel_data):
+        elif re.search('^ ', cel_data):
             cel_style += 'text-align: right;'
-        elif re.search('^(.*) $', cel_data):
+        elif re.search(' $', cel_data):
             cel_style += 'text-align: left;'
 
     text_class = re.search("<table ?class=((?:(?!>).)+)>", data)
@@ -113,6 +113,56 @@ def table_parser(data, cel_data, start_data, num = 0):
 
     return [all_table, row_style, cel_style, row, cel, table_class, num]
     
+def table_start(data):
+    while 1:
+        table = re.search('\n((?:(?:(?:(?:\|\|)+(?:(?:(?!\|\|).(?:\n)*)*))+)\|\|(?:\n)?)+)', data)
+        if table:
+            table = table.groups()[0]
+            
+            # return [all_table, row_style, cel_style, row, cel, table_class, num]
+            while 1:
+                all_table = re.search('^((?:\|\|)+)((?:<(?:(?:(?!>).)+)>)*)\n*((?:(?!\|\|).\n*)*)', table)
+                if all_table:
+                    all_table = all_table.groups()
+                    
+                    return_table = table_parser(all_table[1], all_table[2], all_table[0])
+                    
+                    number = return_table[6]
+                    
+                    table = re.sub('^((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*', '\n<table ' + return_table[5] + ' ' + return_table[0] + '><tbody><tr ' + return_table[1] + '><td ' + return_table[2] + ' ' + return_table[3] + ' ' + return_table[4] + '>', table, 1)
+                else:
+                    break
+                    
+            table = re.sub('\|\|\n?$', '</td></tr></tbody></table>', table)
+
+            while 1:
+                row_table = re.search('\|\|\n((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*((?:(?!\|\||<\/td>).\n*)*)', table)
+                if row_table:
+                    row_table = row_table.groups()
+                    
+                    return_table = table_parser(row_table[1], row_table[2], row_table[0], number)
+                    
+                    table = re.sub('\|\|\n((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*', '</td></tr><tr ' + return_table[1] + '><td ' + return_table[2] + ' ' + return_table[3] + ' ' + return_table[4] + '>', table, 1)
+                else:
+                    break
+
+            while 1:
+                cel_table = re.search('((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*((?:(?:(?!\|\||<\/td>).)|\n)*\n*)', table)
+                if cel_table:
+                    cel_table = cel_table.groups()
+                    
+                    return_table = table_parser(cel_table[1], re.sub('\n', ' ', cel_table[2]), cel_table[0], number)
+                    
+                    table = re.sub('((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*', '</td><td ' + return_table[2] + ' ' + return_table[3] + ' ' + return_table[4] + '>', table, 1)
+                else:
+                    break
+
+            data = re.sub('\n((?:(?:(?:(?:\|\|)+(?:(?:(?!\|\|).(?:\n)*)*))+)\|\|(?:\n)?)+)', table, data, 1)
+        else:
+            break
+            
+    return data
+    
 def link_fix(main_link):
     if re.search('^:', main_link):
         main_link = re.sub('^:', '', main_link)
@@ -134,7 +184,9 @@ def start(conn, data, title):
     # 초기 설정
     data = '\n' + data + '\n'
     backlink = []
-
+    plus_data = '<link rel="stylesheet" href="https://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(); function folding(num, test = 0) { var fol = document.getElementById(\'folding_\' + num); if(fol.style.display == \'inline-block\' || fol.style.display == \'block\') { fol.style.display = \'none\'; } else { if(num % 3 == 0 && test != 1) { fol.style.display = \'block\'; } else { fol.style.display = \'inline-block\'; } } }</script>'
+    end_data= []
+    
     # XSS 이스케이프
     data = html.escape(data)
 
@@ -155,6 +207,21 @@ def start(conn, data, title):
             backlink += [[title, include_link, 'include']]
 
             include = re.sub('^((?:(?!,).)+)', '', include)
+            
+            # 틀 NoWiki
+            num = 0
+            while 1:
+                include_one_nowiki = re.search('(?:\\\\){2}(.)', include)
+                if include_one_nowiki:
+                    include_one_nowiki = include_one_nowiki.groups()
+
+                    num += 1
+
+                    end_data += [['include_one_nowiki_' + str(num), include_one_nowiki[0]]]
+
+                    include = re.sub('(?:\\\\){2}(.)', '<span id="include_one_nowiki_' + str(num) + '"></span>', include, 1)
+                else:
+                    break
 
             curs.execute("select data from data where title = ?", [include_data])
             include_data = curs.fetchall()
@@ -174,7 +241,7 @@ def start(conn, data, title):
                 include_parser = re.sub('\[\[분류:(((?!\]\]|#include).)+)\]\]', '', include_parser)
                 include_parser = html.escape(include_parser)
 
-                data = re.sub('\[include\(((?:(?!\)\]).)+)\)\]', '\n' + include_parser + '\n', data, 1)
+                data = re.sub('\[include\(((?:(?!\)\]).)+)\)\]', '<include>\n<a id="include_link" href="/w/' + tool.url_pas(include_link) + '">[' + include_link + ']</a>\n' + include_parser + '\n</include>', data, 1)
             else:
                 data = re.sub('\[include\(((?:(?!\)\]).)+)\)\]', '<a id="not_thing" href="/w/' + tool.url_pas(include_link) + '">' + include_link + '</a>', data, 1)
         else:
@@ -189,7 +256,7 @@ def start(conn, data, title):
     # HTML 허용
     src_list = ["www.youtube.com", "serviceapi.nmv.naver.com", "tv.kakao.com", "www.google.com", "serviceapi.rmcnmv.naver.com"]
     html_list = ['div', 'span', 'embed', 'iframe', 'ruby', 'rp', 'rt']
-
+    
     html_data = re.findall('&lt;(\/)?((?:(?!&gt;| ).)+)( (?:(?:(?!&gt;).)+)?)?&gt;', data)
     for in_data in html_data:
         if in_data[0] == '':
@@ -207,8 +274,9 @@ def start(conn, data, title):
                             and_data = re.sub('&#x27;', '\'', re.sub('&quot;', '"', re.sub('src=([^ ]*)', '', in_data[2])))
                     else:
                         and_data = re.sub('&#x27;', '\'', re.sub('&quot;', '"', in_data[2]))
+                        
 
-                    data = re.sub('&lt;' + in_data[1] + in_data[2] + '&gt;', '<' + in_data[1] + and_data + '>', data, 1)
+                    data = data.replace('&lt;' + in_data[1] + in_data[2] + '&gt;', '<' + in_data[1] + and_data + '>', 1)
                     data = re.sub('&lt;\/' + in_data[1] + '&gt;', '</' + in_data[1] + '>', data, 1)
 
     position = re.compile('position', re.I)
@@ -225,17 +293,18 @@ def start(conn, data, title):
     middle_stack = 0
     middle_list = []
     middle_number = 0
+    fol_num = 0
     while 1:
         middle_data = re.search('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', data)
         if middle_data:
             middle_data = middle_data.groups()
-            if middle_data[0]:
+            if not middle_data[1]:
                 if middle_stack > 0:
                     middle_stack += 1
                     
-                    data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '&#123;&#123;&#123;' + middle_data[0], data, 1)
+                    data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*)(?P<in> ?)|(}}}))', '&#123;&#123;&#123;' + middle_data[0] + '\g<in>', data, 1)
                 else:
-                    if middle_data[0] != '':
+                    if re.search('^(#|@|\+|\-)', middle_data[0]):
                         middle_search = re.search('^(#(?:[0-9a-f-A-F]{3}){1,2})', middle_data[0])
                         if middle_search:                            
                             middle_list += ['span']
@@ -274,22 +343,27 @@ def start(conn, data, title):
                                         else:
                                             middle_search = re.search('^#!wiki', middle_data[0])
                                             if middle_search:
-                                                middle_data_2 = re.search('{{{#!wiki style=(?:&quot;|&#x27;)((?:(?!&quot;|&#x27;).)*)(?:&quot;|&#x27;)\n', data)
-                                                middle_data_2 = middle_data_2.groups()
+                                                middle_data_2 = re.search('{{{#!wiki(?: style=(?:&quot;|&#x27;)((?:(?!&quot;|&#x27;).)*)(?:&quot;|&#x27;))?\n?', data)
+                                                if middle_data_2:
+                                                    middle_data_2 = middle_data_2.groups()
+                                                else:
+                                                    middle_data_2 = ['']
 
                                                 middle_list += ['div']
                                                 
-                                                data = re.sub('{{{#!wiki style=(?:&quot;|&#x27;)((?:(?!&quot;|&#x27;).)*)(?:&quot;|&#x27;)\n', '<div style="' + middle_data_2[0] + '">', data, 1)
+                                                data = re.sub('{{{#!wiki(?: style=(?:&quot;|&#x27;)((?:(?!&quot;|&#x27;).)*)(?:&quot;|&#x27;))?\n?', '<div id="wiki_div" style="' + str(middle_data_2[0]) + '">', data, 1)
                                             else:
                                                 middle_search = re.search('^#!syntax', middle_data[0])
-                                                if middle_search:
-                                                    middle_data_2 = re.search('{{{#!syntax ((?:(?!\n).)+)\n', data)
-                                                    middle_data_2 = middle_data_2.groups()
+                                                if middle_search:                                                
+                                                    middle_data_2 = re.search('{{{#!syntax ((?:(?!\n).)+)\n?', data)
+                                                    if middle_data_2:
+                                                        middle_data_2 = middle_data_2.groups()
+                                                    else:
+                                                        middle_data_2 = ['python']
 
-                                                    middle_list += ['code', 'pre']
-                                                    middle_number += 1
+                                                    middle_list += ['pre']
                                                     
-                                                    data = re.sub('{{{#!syntax ((?:(?!\n).)+)\n', '<pre id="syntax"><code class="' + middle_data_2[0] + '">', data, 1)
+                                                    data = re.sub('{{{#!syntax ((?:(?!\n).)+)\n?', '<pre id="syntax"><code class="' + middle_data_2[0] + '">', data, 1)
                                                 else:
                                                     middle_search = re.search('^#!html', middle_data[0])
                                                     if middle_search:
@@ -299,9 +373,17 @@ def start(conn, data, title):
                                                     else:
                                                         middle_search = re.search('^#!folding', middle_data[0])
                                                         if middle_search:
-                                                            middle_list += ['span']
+                                                            middle_list += ['2div']
                                                             
-                                                            data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '<span>', data, 1)
+                                                            folding_data = re.search('{{{#!folding ?((?:(?!\n).)*)\n?', data)
+                                                            if folding_data:
+                                                                folding_data = folding_data.groups()
+                                                            else:
+                                                                folding_data = ['Test']
+                                                            
+                                                            data = re.sub('{{{#!folding ?((?:(?!\n).)*)\n?', "<div>" + str(folding_data[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_end><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_end><div id='folding_" + str(fol_num) + "' style='display: none;'>\n", data, 1)
+                                                            
+                                                            fol_num += 3
                                                         else:
                                                             middle_list += ['span']
 
@@ -311,46 +393,45 @@ def start(conn, data, title):
                         
                         middle_stack += 1
                         
-                        data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*)|(}}}))', '<code>' + middle_data[0], data, 1)
+                        data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*)|(}}}))', '<code>' + middle_data[0].replace('\\', '\\\\'), data, 1)
                 
                     middle_number += 1
             else:
-                if middle_stack > 0:
-                    middle_stack -= 1
-
-                if middle_stack > 0:
+                if middle_list == []:
                     data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '&#125;&#125;&#125;', data, 1)
                 else:
-                    if middle_number > 0:
-                        middle_number -= 1
-
-                    if middle_list[middle_number] == 'pre':
-                        data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</code></pre>', data, 1)
-
+                    if middle_stack > 0:
+                        middle_stack -= 1
+
+                    if middle_stack > 0:
+                        data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '&#125;&#125;&#125;', data, 1)
+                    else:                    
+                        if middle_number > 0:
+                            middle_number -= 1
+                            
+                        if middle_list[middle_number] == '2div':
+                            data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</div_end></div_end>', data, 1)
+                        elif middle_list[middle_number] == 'pre':
+                            data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</code></pre>', data, 1)
+                        else:
+                            data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</' + middle_list[middle_number] + '>', data, 1)
+                        
                         del(middle_list[middle_number])
-                        middle_number -= 1
-                    else:
-                        data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</' + middle_list[middle_number] + '>', data, 1)
-                    
-                    del(middle_list[middle_number])
         else:
             break
 
-    # 추가 데이터 지정
-    plus_data = '<link rel="stylesheet" href="https://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>'
-
     # NoWiki 처리
     num = 0
     while 1:
-        nowiki_data = re.search('<code>((?:(?:(?!<\/code>).)+\n*)+)<\/code>', data)
+        nowiki_data = re.search('<code>((?:(?:(?!<\/code>).)*\n*)*)<\/code>', data)
         if nowiki_data:
             nowiki_data = nowiki_data.groups()
 
             num += 1
 
-            plus_data += '<script>function func_nowiki_' + str(num) + '() { document.all("nowiki_' + str(num) + '").innerHTML = "' + re.sub('\n', '\\\\n', nowiki_data[0]) + '"; } func_nowiki_' + str(num) + '();</script>'
+            end_data += [['nowiki_' + str(num), nowiki_data[0]]]
 
-            data = re.sub('<code>((?:(?:(?!<\/code>).)+\n*)+)<\/code>', '<span id="nowiki_' + str(num) + '">(NoWiki Error)</span>', data, 1)
+            data = re.sub('<code>((?:(?:(?!<\/code>).)*\n*)*)<\/code>', '<span id="nowiki_' + str(num) + '"></span>', data, 1)
         else:
             break
 
@@ -363,12 +444,29 @@ def start(conn, data, title):
 
             num += 1
 
-            plus_data += '<script>function func_syntax_' + str(num) + '() { document.all("syntax_' + str(num) + '").innerHTML = "' + re.sub('\n', '\\\\n', syntax_data[1]) + '"; } func_syntax_' + str(num) + '();</script>'
+            end_data += [['syntax_' + str(num), syntax_data[1]]]
 
-            data = re.sub('<code class="((?:(?!").)+)">((?:(?:(?:(?!<\/code>|<span id="syntax_)).)+\n*)+)<\/code>', '<code class="' + syntax_data[0] + '"><span id="syntax_' + str(num) + '">(Syntax Error)</span></code>', data, 1)
+            data = re.sub('<code class="((?:(?!").)+)">((?:(?:(?:(?!<\/code>|<span id="syntax_)).)+\n*)+)<\/code>', '<code class="' + syntax_data[0] + '"><span id="syntax_' + str(num) + '"></span></code>', data, 1)
         else:
             break
+           
+    # 이중 표 처리
+    while 1:
+        wiki_table_data = re.search('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div>).\n*)+)<\/div>', data)
+        if wiki_table_data:
+            wiki_table_data = wiki_table_data.groups()
+            if re.search('\|\|', wiki_table_data[1]):
+                end_parser = re.sub('\n$', '', re.sub('^\n', '', table_start('\n' + wiki_table_data[1] + '\n')))
+            else:
+                end_parser = wiki_table_data[1]
 
+            data = re.sub('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div>).\n*)+)<\/div>', '<div ' + wiki_table_data[0] + '>' + end_parser + '</div_end>', data, 1)
+        else:
+            break
+            
+    data = re.sub('<\/div_end>', '</div>', data)
+    data = re.sub('<\/td>', '</td_end>', data)
+    
     # 수식 처리
     first = 0
     while 1:
@@ -383,7 +481,22 @@ def start(conn, data, title):
             
             data = re.sub('&lt;math&gt;((?:(?!&lt;\/math&gt;).)+)&lt;\/math&gt;', '<span id="math_' + str(first) + '"></span>', data, 1)
 
-            plus_data += '<script>katex.render("' + math.replace('\\', '\\\\') +'", document.getElementById("math_' + str(first) + '"));</script>'
+            plus_data += '<script>katex.render("' + math.replace('\\', '\\\\').replace('&lt;', '<').replace('&gt;', '>') +'", document.getElementById("math_' + str(first) + '"));</script>'
+        else:
+            break
+            
+    # 한 글자 NoWiki
+    num = 0
+    while 1:
+        one_nowiki = re.search('(?:\\\\)(.)', data)
+        if one_nowiki:
+            one_nowiki = one_nowiki.groups()
+
+            num += 1
+
+            end_data += [['one_nowiki_' + str(num), one_nowiki[0]]]
+
+            data = re.sub('(?:\\\\)(.)', '<span id="one_nowiki_' + str(num) + '"></span>', data, 1)
         else:
             break
 
@@ -418,7 +531,7 @@ def start(conn, data, title):
             data = re.sub('\n(?P<in>={1,6}) ?(?P<out>(?:(?!=).)+) ?={1,6}\n', '\n[목차]\n\g<in> \g<out> \g<in>\n', data, 1)
     else:
         data = re.sub('\[목차\(없음\)\]\n', '', data)
-
+        
     # 문단 문법
     toc_full = 0
     toc_top_stack = 6
@@ -426,7 +539,7 @@ def start(conn, data, title):
     edit_number = 0
     toc_data = '<div id="toc"><span style="font-size: 18px;">목차</span>\n\n'
     while 1:
-        toc = re.search('\n(={1,6}) ?((?:(?!=).)+) ?={1,6}\n', data)
+        toc = re.search('\n(={1,6}) ?((?:(?!\n).)+) ?\n', data)
         if toc:
             toc = toc.groups()
             
@@ -452,9 +565,9 @@ def start(conn, data, title):
 
             all_stack = re.sub('0.', '', all_stack)
             
-            data = re.sub('\n(={1,6}) ?((?:(?!=).)+) ?={1,6}\n', '\n<h' + toc_number + ' id="s-' + re.sub('\.$', '', all_stack) + '"><a href="#toc">' + all_stack + '</a> ' + toc[1] + ' <span style="font-size: 12px"><a href="/edit/' + tool.url_pas(title) + '?section=' + str(edit_number) + '">(편집)</a></span></h' + toc_number + '>\n', data, 1)
+            data = re.sub('\n(={1,6}) ?((?:(?!\n).)+) ?\n', '\n<h' + toc_number + ' id="s-' + re.sub('\.$', '', all_stack) + '"><a href="#toc">' + all_stack + '</a> ' + re.sub('=*$', '', toc[1]) + ' <span style="font-size: 12px"><a href="/edit/' + tool.url_pas(title) + '?section=' + str(edit_number) + '">(편집)</a></span></h' + toc_number + '>\n', data, 1)
             
-            toc_data += '<span style="margin-left: ' + str((toc_full - toc_top_stack) * 10) + 'px;"><a href="#s-' + re.sub('\.$', '', all_stack) + '">' + all_stack + '</a> ' + re.sub('\[\*((?:(?! |\]).)*)(?: ((?:(?!\]).)+))?\]', '', toc[1]) + '</span>\n'
+            toc_data += '<span style="margin-left: ' + str((toc_full - toc_top_stack) * 10) + 'px;"><a href="#s-' + re.sub('\.$', '', all_stack) + '">' + all_stack + '</a> ' + re.sub('\[\*((?:(?! |\]).)*)(?: ((?:(?!\]).)+))?\]', '', re.sub('=*$', '', toc[1])) + '</span>\n'
         else:
             break
 
@@ -603,52 +716,7 @@ def start(conn, data, title):
             break
 
     # 표 처리
-    while 1:
-        table = re.search('\n((?:(?:(?:(?:\|\|)+(?:(?:(?!\|\|).(?:\n)*)*))+)\|\|(?:\n)?)+)', data)
-        if table:
-            table = table.groups()[0]
-            
-            # return [all_table, row_style, cel_style, row, cel, table_class, num]
-            while 1:
-                all_table = re.search('^((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*((?:(?!\|\||<\/td>).)*\n*)', table)
-                if all_table:
-                    all_table = all_table.groups()
-                    
-                    return_table = table_parser(all_table[1], all_table[2], all_table[0])
-                    
-                    number = return_table[6]
-                    
-                    table = re.sub('^((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*', '\n<table ' + return_table[5] + ' ' + return_table[0] + '><tbody><tr ' + return_table[1] + '><td ' + return_table[2] + ' ' + return_table[3] + ' ' + return_table[4] + '>\n', table, 1)
-                else:
-                    break
-
-            table = re.sub('\|\|\n$', '</td></tr></tbody></table>', table)
-
-            while 1:
-                row_table = re.search('\|\|\n((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*((?:(?!\|\||<\/td>).)*\n*)', table)
-                if row_table:
-                    row_table = row_table.groups()
-                    
-                    return_table = table_parser(row_table[1], row_table[2], row_table[0], number)
-                    
-                    table = re.sub('\|\|\n((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*', '</td></tr><tr ' + return_table[1] + '><td ' + return_table[2] + ' ' + return_table[3] + ' ' + return_table[4] + '>', table, 1)
-                else:
-                    break
-
-            while 1:
-                cel_table = re.search('((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*((?:(?:(?!\|\||<\/td>).)|\n)*\n*)', table)
-                if cel_table:
-                    cel_table = cel_table.groups()
-                    
-                    return_table = table_parser(cel_table[1], re.sub('\n', ' ', cel_table[2]), cel_table[0], number)
-                    
-                    table = re.sub('((?:\|\|)+)((?:&lt;(?:(?:(?!&gt;).)+)&gt;)*)\n*', '</td><td ' + return_table[2] + ' ' + return_table[3] + ' ' + return_table[4] + '>', table, 1)
-                else:
-                    break
-
-            data = re.sub('\n((?:(?:(?:(?:\|\|)+(?:(?:(?!\|\|).(?:\n)*)*))+)\|\|(?:\n)?)+)', table, data, 1)
-        else:
-            break
+    data = table_start(data)
 
     # 하위 문서
     while 1:
@@ -790,27 +858,33 @@ def start(conn, data, title):
                 return_link = link_fix(main_link)
                 main_link = return_link[0]
                 other_link = return_link[1]
-                  
-                if main_link != title:
-                    if main_link != '':
-                        curs.execute("select title from data where title = ?", [main_link])
-                        if not curs.fetchall():
-                            link_id = 'id="not_thing"'
-
-                            backlink += [[title, main_link, 'no']]
-                        else:
-                            link_id = ''
-                    
-                        backlink += [[title, main_link, '']]
+                
+                if not re.search('^\|', main_link):
+                    if main_link != title:
+                        if main_link != '':
+                            curs.execute("select title from data where title = ?", [main_link])
+                            if not curs.fetchall():
+                                link_id = 'id="not_thing"'
+
+                                backlink += [[title, main_link, 'no']]
+                            else:
+                                link_id = ''
                         
-                        data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '<a ' + link_id + ' href="/w/' + tool.url_pas(main_link) + other_link + '">' + see_link + '</a>', data, 1)
+                            backlink += [[title, main_link, '']]
+                            
+                            data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '<a ' + link_id + ' href="/w/' + tool.url_pas(main_link) + other_link + '">' + see_link + '</a>', data, 1)
+                        else:
+                            data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '<a href="' + other_link + '">' + see_link + '</a>', data, 1)
                     else:
-                        data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '<a href="' + other_link + '">' + see_link + '</a>', data, 1)
+                        data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '<b>' + see_link + '</b>', data, 1)
                 else:
-                    data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '<b>' + see_link + '</b>', data, 1)
+                    data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '&#91;&#91;' + link + '&#93;&#93;', data, 1)
         else:
             break
 
+    # br 처리
+    data = re.sub("\[br\]", '<br>', data)
+            
     # 각주 처리
     footnote_number = 0
     footnote_all = '\n<hr><ul id="footnote_data">'
@@ -862,7 +936,16 @@ def start(conn, data, title):
 
     data += category
     
+    # NoWiki 마지막 처리
+    for re_data in end_data:
+        data = data.replace('<span id="' + re_data[0] + '"></span>', re_data[1])
+        data = data.replace(tool.url_pas('<span id="' + re_data[0] + '"></span>'), tool.url_pas(re_data[1]))
+    
     # 마지막 처리
+    data = re.sub('<\/td_end>', '</td>', data)
+    data = re.sub('<include>\n', '', data)
+    data = re.sub('\n<\/include>', '', data)
+
     data = re.sub('(?P<in><\/h[0-9]>)(\n)+', '\g<in>', data)
     data = re.sub('\n\n<ul>', '\n<ul>', data)
     data = re.sub('<\/ul>\n\n', '</ul>\n', data)
@@ -871,7 +954,6 @@ def start(conn, data, title):
     data = re.sub('(?P<in><td(((?!>).)*)>)\n', '\g<in>', data)
     data = re.sub('(\n)?<hr>(\n)?', '<hr>', data)
     data = re.sub('<\/ul>\n\n<ul>', '</ul>\n<ul>', data)
-    data = re.sub("\[br\]", '\n', data)
     data = re.sub('\n', '<br>', data)
 
     return [data, plus_data, backlink]

+ 0 - 1
set_mark/tool.py

@@ -4,7 +4,6 @@ from urllib import parse
 import time
 import datetime
 import re
-import json
 import hashlib
 
 def get_time():

+ 6 - 2
version.md

@@ -147,6 +147,7 @@
  * 사용자 스킨 기능
  * 차단 관련 조정
  * 스킨 JinJa로 변경
+ * 파서 완성
 
 
 ## 자세한 내용
@@ -154,12 +155,15 @@
 
 ----
 ## 오픈나무 라이선스
- * BSD 3-Clause License
+ * [BSD 3-Clause License](https://github.com/2DU/openNAMU/blob/master/license.md)
 
 ## 외부 파일 라이선스
  * 인용문 아이콘 [Dave Gandy](http://www.flaticon.com/free-icon/quote-left_25672) CC 3.0 BY
  * 구문 강조 [highlightjs](https://highlightjs.org/)
  * 수식 [MathJax](https://www.mathjax.org/)
+ 
+## 기여자들
+ * [참조](https://github.com/2DU/openNAMU/graphs/contributors)
 
 ## 도움 준 사람들
  * [Team Croatia](https://github.com/TeamCroatia)
@@ -169,7 +173,7 @@
 
 ----
 ## 기타
- * 현재 버전 : v3.0.2
+ * 현재 버전 : v3.0.3
 
 ----
 ## 개발 이념

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác