|
|
@@ -184,23 +184,25 @@ def start(conn, data, title):
|
|
|
# 초기 설정
|
|
|
data = '\n' + data + '\n'
|
|
|
backlink = []
|
|
|
- plus_data = '''<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
|
|
|
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
|
|
- <script>
|
|
|
- hljs.initHighlightingOnLoad();
|
|
|
- function folding(num) {
|
|
|
- var fol = document.getElementById('folding_' + num);
|
|
|
- if(fol.style.display == 'inline-block' || fol.style.display == 'block') {
|
|
|
- fol.style.display = 'none';
|
|
|
- } else {
|
|
|
- if(num % 2 == 0) {
|
|
|
- fol.style.display = 'block';
|
|
|
- } else {
|
|
|
- fol.style.display = 'inline-block';
|
|
|
- }
|
|
|
+ plus_data = '''
|
|
|
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
|
|
|
+ <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
|
|
+ <script>
|
|
|
+ hljs.initHighlightingOnLoad();
|
|
|
+ function folding(num) {
|
|
|
+ var fol = document.getElementById('folding_' + num);
|
|
|
+ if(fol.style.display == 'inline-block' || fol.style.display == 'block') {
|
|
|
+ fol.style.display = 'none';
|
|
|
+ } else {
|
|
|
+ if(num % 2 == 0) {
|
|
|
+ fol.style.display = 'block';
|
|
|
+ } else {
|
|
|
+ fol.style.display = 'inline-block';
|
|
|
}
|
|
|
- }
|
|
|
- </script>'''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ '''
|
|
|
end_data= []
|
|
|
|
|
|
# XSS 이스케이프
|
|
|
@@ -400,7 +402,7 @@ def start(conn, data, title):
|
|
|
else:
|
|
|
folding_data = ['Test']
|
|
|
|
|
|
- data = re.sub('{{{#!folding ?((?:(?!\n).)*)\n?', '<div>' + str(folding_data[0]) + ' <div style="display: inline-block;"><a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ');">[작동]</a></div_end><div id="folding_' + str(fol_num) + '" style="display: none;">', data, 1)
|
|
|
+ data = re.sub('{{{#!folding ?((?:(?!\n).)*)\n?', '<div>' + str(folding_data[0]) + ' <div style="display: inline-block;"><a href="javascript:void(0);" onclick="folding(' + str(fol_num) + ');">[작동]</a></div_end><div id="folding_' + str(fol_num) + '" style="display: none;"><div id="wiki_div" style="">', data, 1)
|
|
|
|
|
|
fol_num += 1
|
|
|
else:
|
|
|
@@ -429,7 +431,7 @@ def start(conn, data, title):
|
|
|
middle_number -= 1
|
|
|
|
|
|
if middle_list[middle_number] == '2div':
|
|
|
- data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</div_end></div_end>', data, 1)
|
|
|
+ data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</div_end></div_end></div_end>', data, 1)
|
|
|
elif middle_list[middle_number] == 'pre':
|
|
|
data = re.sub('(?:{{{((?:(?! |{{{|}}}).)*) ?|(}}}))', '</code></pre>', data, 1)
|
|
|
else:
|
|
|
@@ -471,7 +473,7 @@ def start(conn, data, title):
|
|
|
|
|
|
# 이중 표 처리
|
|
|
while 1:
|
|
|
- wiki_table_data = re.search('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div>).\n*)+)<\/div>', data)
|
|
|
+ wiki_table_data = re.search('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div_end>).\n*)+)<\/div_end>', data)
|
|
|
if wiki_table_data:
|
|
|
wiki_table_data = wiki_table_data.groups()
|
|
|
if re.search('\|\|', wiki_table_data[1]):
|
|
|
@@ -479,7 +481,7 @@ def start(conn, data, title):
|
|
|
else:
|
|
|
end_parser = wiki_table_data[1]
|
|
|
|
|
|
- data = re.sub('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div>).\n*)+)<\/div>', '<div ' + wiki_table_data[0] + '>' + end_parser + '</div_end>', data, 1)
|
|
|
+ data = re.sub('<div id="wiki_div" ((?:(?!>).)+)>((?:(?!<div id="wiki_div"|<\/div_end>).\n*)+)<\/div_end>', '<div ' + wiki_table_data[0] + '>' + end_parser + '</div_end>', data, 1)
|
|
|
else:
|
|
|
break
|
|
|
|