Explorar el Código

이것도 그냥 이걸로 바꾸자

2DU hace 9 años
padre
commit
b813acf5c9
Se han modificado 1 ficheros con 5 adiciones y 4 borrados
  1. 5 4
      app.py

+ 5 - 4
app.py

@@ -1630,10 +1630,11 @@ def preview(name = None):
         newdata = request.form["content"]
         newdata = re.sub('^#(?:redirect|넘겨주기)\s(?P<in>[^\n]*)', ' * \g<in> 문서로 넘겨주기', newdata)
         enddata = namumark(name, newdata)
-        m = re.search('<div id="toc">((?:(?!\/div>).)*)<\/div>', enddata)
-        if(m):
-            result = m.groups()
-            left = result[0]
+        curs.execute("select * from data where title = '" + pymysql.escape_string(data["help"]) + "'")
+        rows = curs.fetchall()
+        if(rows):
+            newdata = re.sub('^#(?:redirect|넘겨주기)\s(?P<in>[^\n]*)', ' * \g<in> 문서로 넘겨주기', rows[0]["data"])
+            left = namumark(name, newdata)
         else:
             left = ''
         return render_template('index.html', title = name, logo = data['name'], page = parse.quote(name).replace('/','%2F'), data = request.form["content"], tn = 2, preview = 1, enddata = enddata, left = left, notice = notice)