2DU 8 gadi atpakaļ
vecāks
revīzija
ec2e7a89b6
2 mainītis faili ar 17 papildinājumiem un 17 dzēšanām
  1. 12 12
      app.py
  2. 5 5
      mark.py

+ 12 - 12
app.py

@@ -701,7 +701,7 @@ def back_reset():
         for end in data:
             print(end[0])
             
-            namumark(end[0], end[1], 1, 0)
+            namumark(end[0], end[1], 1, 0, 0)
         
         return(redirect('/'))
     else:
@@ -1164,7 +1164,7 @@ def revert(name = None, num = None):
                     leng
                 )
                 
-                namumark(name, rows[0][0], 1, 0)
+                namumark(name, rows[0][0], 1, 0, 0)
                 return(redirect('/w/' + url_pas(name)))
     else:
         curs.execute("select title from hidhi where title = ? and re = ?", [name, str(num)])
@@ -1311,7 +1311,7 @@ def edit(name = None, num = None):
             leng
         )
                 
-        namumark(name, content, 1, 0)
+        namumark(name, content, 1, 0, 0)
         include_check(name, content)
         
         conn.commit()
@@ -1390,7 +1390,7 @@ def preview(name = None, num = None):
          
     newdata = request.forms.content
     newdata = re.sub('^#(?:redirect|넘겨주기) (?P<in>[^\n]*)', ' * [[\g<in>]] 문서로 넘겨주기', newdata)
-    enddata = namumark(name, newdata, 0, 0)
+    enddata = namumark(name, newdata, 0, 0, 0)
 
     if(num):
         action = '/section/' + str(num)
@@ -1566,7 +1566,7 @@ def other():
                                     ' * [[wiki:manager/1|관리자 메뉴]]\r\n' + \
                                     ' * [[wiki:upload|파일 올리기]]\r\n' + \
                                     '== 버전 ==\r\n' + \
-                                    '이 오픈나무는 [[https://github.com/2DU/openNAMU/blob/SQLite/version.md|' + r_ver + p_ver + ']]판 입니다.', 0, 0),
+                                    '이 오픈나무는 [[https://github.com/2DU/openNAMU/blob/SQLite/version.md|' + r_ver + p_ver + ']]판 입니다.', 0, 0, 0),
                 menu = 0
             )
         )
@@ -1596,7 +1596,7 @@ def manager(num = 1):
                                         ' * [[wiki:manager/9|JSON 출력]]\r\n' + \
                                         ' * [[wiki:json_in|JSON 입력]]\r\n' + \
                                         '== 기타 ==\r\n' + \
-                                        ' * 이 메뉴에 없는 기능은 해당 문서의 역사나 토론에서 바로 사용 가능함', 0, 0),
+                                        ' * 이 메뉴에 없는 기능은 해당 문서의 역사나 토론에서 바로 사용 가능함', 0, 0, 0),
                     menu = [['other', '기타']]
                 )
             )
@@ -2076,7 +2076,7 @@ def topic(name = None, sub = None):
         top = curs.fetchall()
 
         for dain in top:                     
-            top_data = namumark('', dain[0], 0, 0)
+            top_data = namumark('', dain[0], 0, 0, 0)
             top_data = re.sub("(?P<in>#(?:[0-9]*))", '<a href="\g<in>">\g<in></a>', top_data)
                     
             ip = ip_pas(dain[3], 1)
@@ -2106,7 +2106,7 @@ def topic(name = None, sub = None):
             if(i == 0):
                 start = dain[3]
                 
-            indata = namumark('', dain[0], 0, 0)
+            indata = namumark('', dain[0], 0, 0, 0)
             indata = re.sub("(?P<in>#(?:[0-9]*))", '<a href="\g<in>">\g<in></a>', indata)
             
             chad = ''
@@ -2945,7 +2945,7 @@ def read_view(name = None, num = None, redirect = None):
     if(redirect):
         elsedata = re.sub("^#(?:redirect|넘겨주기) (?P<in>[^\n]*)", " * [[\g<in>]] 문서로 넘겨주기", elsedata)
             
-    enddata = namumark(name, elsedata, 0, 0)
+    enddata = namumark(name, elsedata, 0, 0, 1)
 
     if(data_none == 1):
         menu = [['edit/' + url_pas(name), '생성'], ['topic/' + url_pas(name), topic], ['history/' + url_pas(name), '역사'], ['move/' + url_pas(name), '이동'], ['xref/' + url_pas(name), '역링크']]
@@ -2981,7 +2981,7 @@ def read_view(name = None, num = None, redirect = None):
         html_minify(
             template('index', 
                 imp = [name, wiki_set(1), wiki_set(3), login_check(), custom_css(), custom_js(), sub + acl, r_date],
-                data = enddata + namumark(name, div, 0, 0),
+                data = enddata + namumark(name, div, 0, 0, 0),
                 menu = menu
             )
         )
@@ -3174,7 +3174,7 @@ def user_info():
                                                         ' * [[wiki:change|비밀번호 변경]]\r\n' + \
                                                         ' * [[wiki:count|기여 횟수]]\r\n' + \
                                                         ' * [[wiki:custom_css|사용자 CSS]]\r\n' + \
-                                                        ' * [[wiki:custom_js|사용자 JS]]\r\n', 0, 0),
+                                                        ' * [[wiki:custom_js|사용자 JS]]\r\n', 0, 0, 0),
                 menu = 0
             )
         )
@@ -3311,7 +3311,7 @@ def count_edit(name = None):
         html_minify(
             template('index', 
                 imp = ['기여 횟수', wiki_set(1), wiki_set(3), login_check(), custom_css(), custom_js(), 0, 0],
-                data = namumark("", "||<-2><:> " + that + " ||\r\n||<:> 기여 횟수 ||<:> " + str(data) + "||\r\n||<:> 토론 횟수 ||<:> " + str(t_data) + "||", 0, 1),
+                data = namumark("", "||<-2><:> " + that + " ||\r\n||<:> 기여 횟수 ||<:> " + str(data) + "||\r\n||<:> 토론 횟수 ||<:> " + str(t_data) + "||", 0, 0, 0),
                 menu = [['user', '사용자']]
             )
         )

+ 5 - 5
mark.py

@@ -316,7 +316,7 @@ def mid_pas(data, fol_num, include, in_c):
             
     return([data, fol_num])
 
-def toc_pas(data, title, num):
+def toc_pas(data, title, num, toc_y):
     i = [0, 0, 0, 0, 0, 0, 0]
     last = 0
     toc_c = -1
@@ -371,7 +371,7 @@ def toc_pas(data, title, num):
             c = re.sub("\[\[(([^|]*)\|)?(?P<in>[^\]]*)\]\]", "\g<in>", c)
 
             edit_d = ''
-            if(num != 0):
+            if(toc_y == 1):
                 edit_d = ' <span style="font-size:11px;">[<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 style="margin-top: -5px;">', data, 1)
@@ -394,7 +394,7 @@ def cat_plus(name, link, num):
         curs.execute("delete from cat where title = ? and cat = ?", [link, name])
         curs.execute("insert into cat (title, cat) values (?, ?)", [link, name])
 
-def namumark(title, data, num, in_c):    
+def namumark(title, data, num, in_c, toc_y):    
     data = re.sub("\n", "\r\n", re.sub("\r\n", "\n", data))
     data = html_pas(data)
     data = '\r\n' + data + '\r\n'
@@ -438,7 +438,7 @@ def namumark(title, data, num, in_c):
                             else:
                                 break       
 
-                    in_data = toc_pas(in_data, results[0], num)
+                    in_data = toc_pas(in_data, results[0], num, toc_y)
                                 
                     data = include.sub('\n<nobr><a href="/w/' + url_pas(results[0]) + '">[' + results[0] + ' 이동]</a><div>' + in_data + '</div><nobr>\n', data, 1)
                 else:
@@ -485,7 +485,7 @@ def namumark(title, data, num, in_c):
         
     data = re.sub("(\n)(?P<in>\r\n(={1,6})\s?([^=]*)\s?(?:={1,6})(?:\s+)?\n)", "\g<in>", data)
     
-    data = toc_pas(data, title, num)
+    data = toc_pas(data, title, num, toc_y)
     
     category = ''
     while(1):