ソースを参照

문법 추가

2DU 9 年 前
コミット
100cc260fc
3 ファイル変更30 行追加11 行削除
  1. 1 4
      app.py
  2. 28 6
      mark.py
  3. 1 1
      readme.md

+ 1 - 4
app.py

@@ -137,9 +137,7 @@ if(version):
         db_ex("update other set data = '" + r_ver + "' where name = 'version'")
 else:
     db_ex("insert into other (name, data) value ('version', '" + r_ver + "')")
-    
-db_com()
-    
+db_com()    
 
 @route('/upload', method=['GET', 'POST'])
 def upload():
@@ -1990,7 +1988,6 @@ def register():
                         else:
                             hashed = bcrypt.hashpw(bytes(request.forms.pw, 'utf-8'), bcrypt.gensalt())
                             
-                            
                             db_ex("select * from user limit 1")
                             user_ex = db_get()
                             if(not user_ex):

+ 28 - 6
mark.py

@@ -688,26 +688,48 @@ def namumark(session, title, data):
     
     a = 1
     tou = "<hr id='footnote'><div class='wiki-macro-footnote'><br>"
+    namu = []
     while(True):
-        b = re.search("\[\*([^\s]*)\s(((?!\]).)*)\]", data)
+        b = re.search("\[\*([^\s]*)(?:\s(((?!\]).)*))?\]", data)
         if(b):
             results = b.groups()
-            if(results[0]):
+            if(not results[1] and results[0]):
+                i = 0
+                
+                while(True):
+                    try:
+                        if(namu[i] == results[0]):
+                            none_this = False
+                            break
+                        else:
+                            i += 1
+                    except:
+                        none_this = True
+                        break
+                        
+                if(none_this == False):
+                    data = re.sub("\[\*([^\s]*)(?:\s(((?!\]).)*))?\]", "<sup><a class=\"footnotes\" title=\"" + namu[i + 1] + "\" id=\"rfn-" + str(a) + "\" href=\"#fn-" + str(a) + "\">[" + results[0] + "]</a></sup>", data, 1)
+                else:
+                    data = re.sub("\[\*([^\s]*)(?:\s(((?!\]).)*))?\]", "<sup><a class=\"footnotes\" id=\"rfn-" + str(a) + "\" href=\"#fn-" + str(a) + "\">[" + results[0] + "]</a></sup>", data, 1)
+            elif(results[0]):
                 c = results[1]
                 c = re.sub("<(?:[^>]*)>", '', c)
+                
+                namu += [results[0]]
+                namu += [c]
 
                 tou = tou + "<span class='footnote-list'><a href=\"#rfn-" + str(a) + "\" id=\"fn-" + str(a) + "\">[" + results[0] + "]</a> " + results[1] + "</span><br>"
-                data = re.sub("\[\*([^\s]*)\s(((?!\]).)*)\]", "<sup><a class=\"footnotes\" title=\"" + c + "\" id=\"rfn-" + str(a) + "\" href=\"#fn-" + str(a) + "\">[" + results[0] + "]</a></sup>", data, 1)
+                data = re.sub("\[\*([^\s]*)(?:\s(((?!\]).)*))?\]", "<sup><a class=\"footnotes\" title=\"" + c + "\" id=\"rfn-" + str(a) + "\" href=\"#fn-" + str(a) + "\">[" + results[0] + "]</a></sup>", data, 1)
             else:
                 c = results[1]
                 c = re.sub("<(?:[^>]*)>", '', c)
 
                 tou = tou + "<span class='footnote-list'><a href=\"#rfn-" + str(a) + "\" id=\"fn-" + str(a) + "\">[" + str(a) + "]</a> " + results[1] + "</span><br>"
-                data = re.sub("\[\*([^\s]*)\s(((?!\]).)*)\]", '<sup><a class="footnotes" title="' + c + '" id="rfn-' + str(a) + '" href="#fn-' + str(a) + '">[' + str(a) + ']</a></sup>', data, 1)
+                data = re.sub("\[\*([^\s]*)(?:\s(((?!\]).)*))?\]", '<sup><a class="footnotes" title="' + c + '" id="rfn-' + str(a) + '" href="#fn-' + str(a) + '">[' + str(a) + ']</a></sup>', data, 1)
 
-            a = a + 1
+            a += 1
         else:
-            tou = tou + '</div>'
+            tou += '</div>'
 
             if(tou == "<hr id='footnote'><div class='wiki-macro-footnote'><br></div>"):
                 tou = ""

+ 1 - 1
readme.md

@@ -1,4 +1,4 @@
-## 개요
+## 개요
 오픈나무 정식 버전 입니다. 파이썬 Bottle 기반으로 돌아 갑니다.
 
 ## 설치법