2DU 9 лет назад
Родитель
Сommit
817eb1d9e0
3 измененных файлов с 334 добавлено и 445 удалено
  1. 319 435
      app.py
  2. 13 8
      mark.py
  3. 2 2
      views/read.tpl

Разница между файлами не показана из-за своего большого размера
+ 319 - 435
app.py


+ 13 - 8
mark.py

@@ -191,7 +191,7 @@ def mid_pas(data, fol_num, include):
                 fol_num += 3
             elif(syn):
                 result = syn.groups()
-                data = com.sub('<pre id="syntax"><code class="' + result[0] + '">' + re.sub(' ', '<space>', result[1]) + '</code></pre>', data, 1)
+                data = com.sub('<pre id="syntax"><code class="' + result[0] + '">' + re.sub('\r\n', '<isbr>', re.sub(' ', '<space>', result[1])) + '</code></pre>', data, 1)
             elif(html):
                 result = html.groups()
                 data = com.sub(result[0], data, 1)
@@ -538,13 +538,17 @@ def namumark(title, data):
             
             result = m.groups()
             if(result[0]):
-                yudt = re.search('(?:\?v=(.*)|\/([^/?]*)|^([a-zA-Z0-9]*))$', result[0])
-                if(yudt.groups()[0]):
-                    src = yudt.groups()[0]
-                elif(yudt.groups()[1]):
-                    src = yudt.groups()[1]
-                elif(yudt.groups()[2]):
-                    src = yudt.groups()[2]
+                yudt = re.search('(?:\?v=(.*)|\/([^/?]*)|^([a-zA-Z0-9\-]*))$', result[0])
+                print(yudt)
+                if(yudt):
+                    if(yudt.groups()[0]):
+                        src = yudt.groups()[0]
+                    elif(yudt.groups()[1]):
+                        src = yudt.groups()[1]
+                    elif(yudt.groups()[2]):
+                        src = yudt.groups()[2]
+                else:
+                    src = ''
                     
             if(result[1]):
                 mdata = re.search('width=([0-9]*)', result[1])
@@ -1118,6 +1122,7 @@ def namumark(title, data):
 
     data = re.sub('<\/blockquote>((\r)?\n){2}<blockquote>', '</blockquote><br><blockquote>', data)
     data = re.sub('\n', '<br>', data)
+    data = re.sub('<isbr>', '\r\n', data)
     data = re.sub('^<br>', '', data)
     
     conn.close()

+ 2 - 2
views/read.tpl

@@ -26,8 +26,8 @@
         % if(data_none == False and admin == "ACL"):
             <a class="menu-item" href="/acl/{{page}}">ACL</a>
         % end
-        % if(uppage):
-            <a class="menu-item" style="{{style}}" href="/w/{{uppage}}">상위</a>
+        % if(not uppage == False):
+            <a class="menu-item" href="/w/{{uppage}}">상위</a>
         % end
         % if(down == True):
             <a class="menu-item" style="{{down}}" href="/down/{{page}}">하위</a>

Некоторые файлы не были показаны из-за большого количества измененных файлов