|
@@ -39,11 +39,11 @@ def link_fix(main_link, no_change = 0):
|
|
|
main_link = main_link.replace("<link_comma>", "'")
|
|
main_link = main_link.replace("<link_comma>", "'")
|
|
|
main_link = main_link.replace('\\#', '%23')
|
|
main_link = main_link.replace('\\#', '%23')
|
|
|
|
|
|
|
|
- find_data = re.findall(r'<span id="(nowiki_[0-9]+)">', main_link)
|
|
|
|
|
|
|
+ find_data = re.findall(r'<span id="((?:include_(?:[0-9]+)_)?(?:nowiki_[0-9]+))">', main_link)
|
|
|
for i in find_data:
|
|
for i in find_data:
|
|
|
main_link = main_link.replace('<span id="' + i + '"></span>', end_data[i])
|
|
main_link = main_link.replace('<span id="' + i + '"></span>', end_data[i])
|
|
|
|
|
|
|
|
- find_data = re.findall(r'<span id="(nowiki_[0-9]+)">', other_link)
|
|
|
|
|
|
|
+ find_data = re.findall(r'<span id="((?:include_(?:[0-9]+)_)?(?:nowiki_[0-9]+))">', other_link)
|
|
|
for i in find_data:
|
|
for i in find_data:
|
|
|
other_link = other_link.replace('<span id="' + i + '"></span>', end_data[i])
|
|
other_link = other_link.replace('<span id="' + i + '"></span>', end_data[i])
|
|
|
|
|
|
|
@@ -536,19 +536,23 @@ def namumark(conn, data, title, include_num):
|
|
|
|
|
|
|
|
nowiki_num = 0
|
|
nowiki_num = 0
|
|
|
data = '\n' + data + '\n'
|
|
data = '\n' + data + '\n'
|
|
|
- include_name = include_num + '_' if include_num else ''
|
|
|
|
|
|
|
+ include_name = (include_num + '_') if include_num else ''
|
|
|
now_time = tool.get_time().split()[0]
|
|
now_time = tool.get_time().split()[0]
|
|
|
plus_data = ''
|
|
plus_data = ''
|
|
|
|
|
|
|
|
backlink = []
|
|
backlink = []
|
|
|
end_data = {}
|
|
end_data = {}
|
|
|
|
|
|
|
|
- data = re.sub(r'@([^=@]+)=(?P<in>[^=@]+)@', '\g<in>', data)
|
|
|
|
|
|
|
+ data = re.sub(r'@((?:(?!(?:=|{{{|}}}|\[\[|\]\]|@)).)+)=(?P<in>(?:(?!(?:=|{{{|}}}|\[\[|\]\]|@)).)+)@', '\g<in>', data)
|
|
|
data = re.sub(r'<math>(?P<in>(?:(?!<\/math>).)+)<\/math>', '[math(\g<in>)]', data)
|
|
data = re.sub(r'<math>(?P<in>(?:(?!<\/math>).)+)<\/math>', '[math(\g<in>)]', data)
|
|
|
|
|
|
|
|
data = html.escape(data)
|
|
data = html.escape(data)
|
|
|
data = data.replace('\r\n', '\n')
|
|
data = data.replace('\r\n', '\n')
|
|
|
|
|
|
|
|
|
|
+ # 테이블 앞에 공백 있는 경우 처리 필요
|
|
|
|
|
+ # 테이블 col 옵션 적용시 셀 병합 고려 필요
|
|
|
|
|
+ data = re.sub(r'\n +\|\|', '\n||', data)
|
|
|
|
|
+
|
|
|
math_re = re.compile(r'\[math\(((?:(?!\)\]).)+)\)\]', re.I)
|
|
math_re = re.compile(r'\[math\(((?:(?!\)\]).)+)\)\]', re.I)
|
|
|
while 1:
|
|
while 1:
|
|
|
math = math_re.search(data)
|
|
math = math_re.search(data)
|
|
@@ -608,48 +612,51 @@ def namumark(conn, data, title, include_num):
|
|
|
break
|
|
break
|
|
|
|
|
|
|
|
include_re = re.compile(r'\[include\(((?:(?!\)\]).)+)\)\]', re.I)
|
|
include_re = re.compile(r'\[include\(((?:(?!\)\]).)+)\)\]', re.I)
|
|
|
- i = 0
|
|
|
|
|
- while 1:
|
|
|
|
|
- i += 1
|
|
|
|
|
-
|
|
|
|
|
- include = include_re.search(data)
|
|
|
|
|
- if include:
|
|
|
|
|
- include = include.group(1)
|
|
|
|
|
-
|
|
|
|
|
- include_data = re.search(r'^((?:(?!,).)+)', include)
|
|
|
|
|
- if include_data:
|
|
|
|
|
- include_data = include_data.group(1)
|
|
|
|
|
- else:
|
|
|
|
|
- include_data = 'Test'
|
|
|
|
|
|
|
+ if include_name == '':
|
|
|
|
|
+ i = 0
|
|
|
|
|
+ while 1:
|
|
|
|
|
+ i += 1
|
|
|
|
|
+
|
|
|
|
|
+ include = include_re.search(data)
|
|
|
|
|
+ if include:
|
|
|
|
|
+ include = include.group(1)
|
|
|
|
|
+
|
|
|
|
|
+ include_data = re.search(r'^((?:(?!,).)+)', include)
|
|
|
|
|
+ if include_data:
|
|
|
|
|
+ include_data = include_data.group(1)
|
|
|
|
|
+ else:
|
|
|
|
|
+ include_data = 'Test'
|
|
|
|
|
|
|
|
- include_link = include_data
|
|
|
|
|
- backlink += [[title, include_link, 'include']]
|
|
|
|
|
|
|
+ include_link = include_data
|
|
|
|
|
+ backlink += [[title, include_link, 'include']]
|
|
|
|
|
|
|
|
- data = include_re.sub('' + \
|
|
|
|
|
- '<a id="' + include_name + 'include_link" class="include_' + str(i) + '" href="/w/' + tool.url_pas(include_link) + '">(' + include_link + ')</a>' + \
|
|
|
|
|
- '<div id="' + include_name + 'include_' + str(i) + '"></div>' + \
|
|
|
|
|
- '', data, 1)
|
|
|
|
|
|
|
+ data = include_re.sub('' + \
|
|
|
|
|
+ '<a id="' + include_name + 'include_link" class="include_' + str(i) + '" href="/w/' + tool.url_pas(include_link) + '">(' + include_link + ')</a>' + \
|
|
|
|
|
+ '<div id="' + include_name + 'include_' + str(i) + '"></div>' + \
|
|
|
|
|
+ '', data, 1)
|
|
|
|
|
|
|
|
- include_plus_data = []
|
|
|
|
|
- while 1:
|
|
|
|
|
- include_plus = re.search(r', ?((?:(?!=).)+)=((?:(?!,).)+)', include)
|
|
|
|
|
- if include_plus:
|
|
|
|
|
- include_plus = include_plus.groups()
|
|
|
|
|
|
|
+ include_plus_data = []
|
|
|
|
|
+ while 1:
|
|
|
|
|
+ include_plus = re.search(r', ?((?:(?!=).)+)=((?:(?!,).)+)', include)
|
|
|
|
|
+ if include_plus:
|
|
|
|
|
+ include_plus = include_plus.groups()
|
|
|
|
|
|
|
|
- include_data_set = include_plus[1]
|
|
|
|
|
- find_data = re.findall(r'<span id="(nowiki_[0-9]+)">', include_data_set)
|
|
|
|
|
- for j in find_data:
|
|
|
|
|
- include_data_set = include_data_set.replace('<span id="' + j + '"></span>', end_data[j])
|
|
|
|
|
|
|
+ include_data_set = include_plus[1]
|
|
|
|
|
+ find_data = re.findall(r'<span id="((?:include_(?:[0-9]+)_)?(?:nowiki_[0-9]+))">', include_data_set)
|
|
|
|
|
+ for j in find_data:
|
|
|
|
|
+ include_data_set = include_data_set.replace('<span id="' + j + '"></span>', end_data[j])
|
|
|
|
|
|
|
|
- include_plus_data += [[include_plus[0], include_data_set]]
|
|
|
|
|
|
|
+ include_plus_data += [[include_plus[0], include_data_set]]
|
|
|
|
|
|
|
|
- include = re.sub(r', ?((?:(?!=).)+)=((?:(?!,).)+)', '', include, 1)
|
|
|
|
|
- else:
|
|
|
|
|
- break
|
|
|
|
|
|
|
+ include = re.sub(r', ?((?:(?!=).)+)=((?:(?!,).)+)', '', include, 1)
|
|
|
|
|
+ else:
|
|
|
|
|
+ break
|
|
|
|
|
|
|
|
- plus_data += 'load_include("' + include_link + '", "' + include_name + 'include_' + str(i) + '", ' + str(include_plus_data) + ');\n'
|
|
|
|
|
- else:
|
|
|
|
|
- break
|
|
|
|
|
|
|
+ plus_data += 'load_include("' + include_link + '", "' + include_name + 'include_' + str(i) + '", ' + str(include_plus_data) + ');\n'
|
|
|
|
|
+ else:
|
|
|
|
|
+ break
|
|
|
|
|
+ else:
|
|
|
|
|
+ data = include_re.sub('', data)
|
|
|
|
|
|
|
|
data = data.replace('&', '&')
|
|
data = data.replace('&', '&')
|
|
|
data = re.sub(r'\n##[^\n]+', '', data)
|
|
data = re.sub(r'\n##[^\n]+', '', data)
|
|
@@ -1018,25 +1025,26 @@ def namumark(conn, data, title, include_num):
|
|
|
1
|
|
1
|
|
|
)
|
|
)
|
|
|
elif category_re.search(main_link):
|
|
elif category_re.search(main_link):
|
|
|
- if category == '':
|
|
|
|
|
- category += '<div id="cate_all"><div id="cate">Category : '
|
|
|
|
|
-
|
|
|
|
|
- main_link = category_re.sub('category:', main_link)
|
|
|
|
|
- link_id = ''
|
|
|
|
|
-
|
|
|
|
|
- curs.execute(tool.db_change("select title from data where title = ?"), [main_link])
|
|
|
|
|
- if re.search(r'#blur', main_link):
|
|
|
|
|
- link_id = ' hidden_link'
|
|
|
|
|
- main_link = main_link.replace('#blur', '')
|
|
|
|
|
- see_link = see_link.replace('#blur', '')
|
|
|
|
|
-
|
|
|
|
|
- backlink += [[title, main_link, 'cat']]
|
|
|
|
|
- category += '' + \
|
|
|
|
|
- '<a class="' + include_name + 'link_finder' + link_id + '" ' + \
|
|
|
|
|
- 'href="/w/' + tool.url_pas(main_link) + '">' + \
|
|
|
|
|
- category_re.sub('', see_link) + \
|
|
|
|
|
- '</a> | ' + \
|
|
|
|
|
- ''
|
|
|
|
|
|
|
+ if include_name == '':
|
|
|
|
|
+ if category == '':
|
|
|
|
|
+ category += '<div id="cate_all"><div id="cate">Category : '
|
|
|
|
|
+
|
|
|
|
|
+ main_link = category_re.sub('category:', main_link)
|
|
|
|
|
+ link_id = ''
|
|
|
|
|
+
|
|
|
|
|
+ curs.execute(tool.db_change("select title from data where title = ?"), [main_link])
|
|
|
|
|
+ if re.search(r'#blur', main_link):
|
|
|
|
|
+ link_id = ' hidden_link'
|
|
|
|
|
+ main_link = main_link.replace('#blur', '')
|
|
|
|
|
+ see_link = see_link.replace('#blur', '')
|
|
|
|
|
+
|
|
|
|
|
+ backlink += [[title, main_link, 'cat']]
|
|
|
|
|
+ category += '' + \
|
|
|
|
|
+ '<a class="' + include_name + 'link_finder' + link_id + '" ' + \
|
|
|
|
|
+ 'href="/w/' + tool.url_pas(main_link) + '">' + \
|
|
|
|
|
+ category_re.sub('', see_link) + \
|
|
|
|
|
+ '</a> | ' + \
|
|
|
|
|
+ ''
|
|
|
|
|
|
|
|
data = link_re.sub('', data, 1)
|
|
data = link_re.sub('', data, 1)
|
|
|
elif re.search(r'^inter:((?:(?!:).)+):', main_link):
|
|
elif re.search(r'^inter:((?:(?!:).)+):', main_link):
|