Przeglądaj źródła

각주 버그 수정

ect (or 2du) 8 lat temu
rodzic
commit
fad4404189
2 zmienionych plików z 21 dodań i 15 usunięć
  1. 19 14
      set_mark/footnote.py
  2. 2 1
      set_mark/toc_pas.py

+ 19 - 14
set_mark/footnote.py

@@ -4,6 +4,8 @@ def footnote(data, fol_num):
     a = 1
     tou = "<hr style='margin-top: 30px;' id='footnote'><div><br>"
     namu = []
+    div = ''
+    print(data)
     pop_re = re.compile('(?:\[\*([^\s]*)(?:\s((?:(?!\[|\]).)*))?\]|(\[각주\]))')
     while 1:
         b = pop_re.search(data)
@@ -25,10 +27,10 @@ def footnote(data, fol_num):
                             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>" + \
-                                        "<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>", data, 1)
+                        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>"
                     else:
                         data = pop_re.sub("<sup><a href='javascript:void(0);' id='rfn-" + str(a) + "'>(" + results[0] + ")</a></sup>", data, 1)
                 else:
@@ -36,17 +38,20 @@ def footnote(data, fol_num):
                         namu += [results[0]]
                         namu += [results[1]]
 
-                        tou += "<span id='footnote-list'><a href='#rfn-" + str(a) + "' id='fn-" + str(a) + "'>(" + results[0] + ")</a> " + results[1] + "</span><br>"
-                        data = pop_re.sub("<sup><a href='javascript:void(0);' onclick='folding(" + str(fol_num) + ", 1);' id='rfn-" + str(a) + "'>(" + results[0] + ")</a>" + \
-                                        "</sup><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>", data, 1)     
+                        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>"
+
                     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>"
-                        data = pop_re.sub('<sup><a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ', 1);" id="rfn-' + str(a) + '">(' + str(a) + ')</a></sup>' + \
-                                        '<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>', data, 1)
+                        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>'
                     a += 1
 
                 fol_num += 2
@@ -68,6 +73,6 @@ def footnote(data, fol_num):
     
     data = re.sub("\[각주\](?:(?:<br>| |\r|\n)+)?$", "", data)
     data = re.sub("(?:(?:<br>| |\r|\n)+)$", "", data)
-    data += tou
+    data += tou + div
     
     return data

+ 2 - 1
set_mark/toc_pas.py

@@ -60,11 +60,12 @@ def toc_pas(data, title, num, toc_y):
             t = toc.count('.')
             span = '<span style="margin-left: 5px;"></span>' * t
 
-            rtoc += span + '<a href="#s-' + toc + '">' + toc + '</a>. ' + result[1] + '<br>'
+            rtoc += span + '<a href="#s-' + toc + '">' + toc + '</a>. ' + re.sub('(?:\[\*([^\s]*)(?:\s((?:(?!\[|\]).)*))?\])', '', result[1]) + '<br>'
 
             c = re.sub(" $", "", result[1])
             d = c
             c = re.sub("\[\[(([^|]*)\|)?(?P<in>[^\]]*)\]\]", "\g<in>", c)
+            c = re.sub('(?:\[\*([^\s]*)(?:\s((?:(?!\[|\]).)*))?\])', '', c)
 
             edit_d = ''
             if toc_y == 1: