Pārlūkot izejas kodu

사소한 수정

Surplus_Up (2DU) 7 gadi atpakaļ
vecāks
revīzija
438a31b81f
5 mainītis faili ar 23 papildinājumiem un 7 dzēšanām
  1. 12 5
      app.py
  2. 5 0
      set_mark/html_only.py
  3. 1 1
      set_mark/namu.py
  4. 1 1
      views/main_css/main.css
  5. 4 0
      views/neo_yousoro/css/main.css

+ 12 - 5
app.py

@@ -1727,7 +1727,6 @@ def preview(name = None):
     if acl_check(name) == 1:
         return re_error('/ban')
          
-    new_data = re.sub('\r\n#(?:redirect|넘겨주기) (?P<in>(?:(?!\r\n).)+)\r\n', ' * redirect to [[\g<in>]]', '\r\n' + flask.request.form.get('content', None) + '\r\n')
     new_data = re.sub('^\r\n', '', new_data)
     new_data = re.sub('\r\n$', '', new_data)
     
@@ -3103,6 +3102,13 @@ def read_view(name = None):
     num = flask.request.args.get('num', None)
     if num:
         num = int(num)
+    else:
+        if not flask.request.args.get('from', None):
+            curs.execute("select title from back where link = ? and type = 'redirect'", [name])
+            redirect_data = curs.fetchall()
+            if redirect_data:
+                return redirect('/w/' + redirect_data[0][0] + '?from=' + name)
+
 
     curs.execute("select sub from rd where title = ? order by date desc", [name])
     for data in curs.fetchall():
@@ -3111,6 +3117,8 @@ def read_view(name = None):
             sub += ' (' + load_lang('discussion') + ')'
 
             break
+
+    curs.execute("select link from back where title = ? and type = 'cat' order by link asc", [name])
                 
     curs.execute("select title from data where title like ?", ['%' + name + '/%'])
     if curs.fetchall():
@@ -3193,8 +3201,7 @@ def read_view(name = None):
     if data:
         acl += ' (acl)'
             
-    if flask.request.args.get('froms', None):
-        else_data = re.sub('\r\n#(?:redirect|넘겨주기) (?P<in>(?:(?!\r\n).)+)\r\n', ' * redirect to [[\g<in>]]', '\r\n' + else_data + '\r\n')
+    if flask.request.args.get('from', None):
         else_data = re.sub('^\r\n', '', else_data)
         else_data = re.sub('\r\n$', '', else_data)
             
@@ -3216,9 +3223,9 @@ def read_view(name = None):
 
         menu += [['topic/' + url_pas(name), load_lang('discussion')], ['history/' + url_pas(name), load_lang('history')], ['xref/' + url_pas(name), load_lang('backlink')], ['acl/' + url_pas(name), 'acl']]
 
-        if flask.request.args.get('froms', None):
+        if flask.request.args.get('from', None):
             menu += [['w/' + url_pas(name), load_lang('pass')]]
-            end_data = '<ul id="redirect"><li>redirect from <a href="/w/' + url_pas(flask.request.args.get('froms', None)) + '?froms=' + url_pas(name) + '">' + flask.request.args.get('froms', None) + '</a></li></ul><br>' + end_data
+            end_data = '<div id="redirect">redirect from <a href="/w/' + url_pas(flask.request.args.get('from', None)) + '?from=' + url_pas(name) + '">' + flask.request.args.get('from', None) + '</div><br>' + end_data
 
         if uppage != 0:
             menu += [['w/' + url_pas(uppage), load_lang('upper')]]

+ 5 - 0
set_mark/html_only.py

@@ -0,0 +1,5 @@
+from . import tool
+
+import datetime
+import html
+import re

+ 1 - 1
set_mark/namu.py

@@ -601,7 +601,7 @@ def namu(conn, data, title, main_num):
         
         backlink += [[title, main_link, 'redirect']]
         
-        data = redirect_re.sub('<script>location.href="/w/' + tool.url_pas(main_link) + '?froms=' + tool.url_pas(title) + other_link + '";</script>', data, 1)
+        data = redirect_re.sub('\n * redirect to [[' + main_link + ']]\n', data, 1)
 
     # [목차(-)] 처리
     no_toc_re = re.compile('\[(?:목차|toc)\((?:no)\)\]\n', re.I)

+ 1 - 1
views/main_css/main.css

@@ -29,4 +29,4 @@ s:hover, strike:hover, del:hover { color: gray; background-color: gainsboro; tex
 #main_table_set { width: 100%; text-align: center; }
 #main_table_width { width: 33.3%; }
 #main_table_width_half { width: 50%; }
-#redirect { margin-left: 20px; }
+#redirect { border: 1px solid; padding: 10px; }

+ 4 - 0
views/neo_yousoro/css/main.css

@@ -310,4 +310,8 @@ input {
 
 #syntax code {
     background: transparent;
+}
+
+#redirect {
+    border: 2px solid gainsboro;
 }