ソースを参照

버그 수정

ect (or 2du) 8 年 前
コミット
293edc150b
4 ファイル変更14 行追加11 行削除
  1. 1 1
      app.py
  2. 1 1
      set_mark/include_pas.py
  3. 1 1
      set_mark/mark.py
  4. 11 8
      set_mark/mid_pas.py

+ 1 - 1
app.py

@@ -1432,7 +1432,7 @@ def preview(name = None, num = None):
          
     newdata = request.forms.content
     newdata = re.sub('^#(?:redirect|넘겨주기) (?P<in>[^\n]*)', ' * [[\g<in>]] 문서로 넘겨주기', newdata)
-    enddata = namumark(conn, name, newdata, 0, 0, 0)
+    enddata = namumark(conn, name, newdata, 0, 0, 1)
     captcha = captcha_get(conn)
 
     if(num):

+ 1 - 1
set_mark/include_pas.py

@@ -31,7 +31,7 @@ def include_pas(conn, data, title, in_c, num, toc_y, fol_num):
                 in_data = re.sub("\n", "\r\n", re.sub("\r\n", "\n", in_data))
                 in_data = html_pas.html_pas(in_data)
                 
-                var_d = mid_pas.mid_pas(in_data, fol_num, 1, in_c)
+                var_d = mid_pas.mid_pas(in_data, fol_num, 1, in_c, toc_y)
                 var_d2 = link.link(conn, title, var_d[0], 0, category, backlink)
 
                 in_data = var_d2[0]

+ 1 - 1
set_mark/mark.py

@@ -43,7 +43,7 @@ def namumark(conn, title, data, num, in_c, toc_y):
     data = html_pas.html_pas(data)
     
     fol_num = 0
-    a = mid_pas.mid_pas(data, fol_num, 0, in_c)
+    a = mid_pas.mid_pas(data, fol_num, 0, in_c, toc_y)
     data = a[0]
     fol_num = a[1]
 

+ 11 - 8
set_mark/mid_pas.py

@@ -1,6 +1,6 @@
 import re
 
-def mid_pas(data, fol_num, include, in_c):
+def mid_pas(data, fol_num, include, in_c, toc_y):
     p = re.compile('{{{((?:(?:(?:\+|-)[0-5])|(?:#|@)(?:(?:[0-9a-f-A-F]{3}){1,2}|(?:\w+))|(?:#!(?:html|wiki|noin|folding|syntax)))(?:(?!{{{|}}}).)+)}}}', re.DOTALL)
     while(1):
         m = p.search(data)
@@ -96,13 +96,16 @@ def mid_pas(data, fol_num, include, in_c):
                 data = com.sub(html_d.groups()[0], data, 1)
             elif(fol):
                 fol_d = fol.groups()
-                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
+                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):
                 syn_d = syn.groups()
                 tax_d = syn_d[1].replace(' ', '<space>')