|
|
@@ -507,10 +507,7 @@ def namumark(conn, data, title, include_num):
|
|
|
nowiki_num = 0
|
|
|
data = '\n' + data + '\n'
|
|
|
include_name = include_num + '_' if include_num else ''
|
|
|
- plus_data = '' + \
|
|
|
- 'get_link_state("' + include_name + '");\n' + \
|
|
|
- 'get_file_state("' + include_name + '");\n' + \
|
|
|
- ''
|
|
|
+ plus_data = ''
|
|
|
|
|
|
backlink = []
|
|
|
end_data = {}
|
|
|
@@ -957,6 +954,8 @@ def namumark(conn, data, title, include_num):
|
|
|
link = link_re.search(data)
|
|
|
if link:
|
|
|
link = link.group(1)
|
|
|
+ str_e_link_id = str(e_link_id)
|
|
|
+ e_link_id += 1
|
|
|
|
|
|
link_split = re.search(r'((?:(?!\|).)+)(?:\|((?:(?!\|).)+))', link)
|
|
|
if link_split:
|
|
|
@@ -964,9 +963,11 @@ def namumark(conn, data, title, include_num):
|
|
|
|
|
|
main_link = link_split[0]
|
|
|
see_link = link_split[1]
|
|
|
+ inter_same = 0
|
|
|
else:
|
|
|
main_link = link
|
|
|
see_link = link
|
|
|
+ inter_same = 1
|
|
|
|
|
|
if re.search(r'^((?:file|파일)|(?:out|외부)):', main_link):
|
|
|
file_style = ''
|
|
|
@@ -1027,7 +1028,7 @@ def namumark(conn, data, title, include_num):
|
|
|
|
|
|
data = link_re.sub(
|
|
|
'<span style="' + file_align + '">' + \
|
|
|
- '<span style="' + file_color + '"' + \
|
|
|
+ '<span style="' + file_color + '" ' + \
|
|
|
'class="' + include_name + 'file_finder" ' + \
|
|
|
'under_style="' + file_style + '" ' + \
|
|
|
'under_alt="' + file_alt + '" ' + \
|
|
|
@@ -1052,44 +1053,41 @@ def namumark(conn, data, title, include_num):
|
|
|
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> | '
|
|
|
+ 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)
|
|
|
- elif re.search(r'^wiki:', main_link):
|
|
|
- data = re.sub(
|
|
|
- '\[\[((?:(?!\[\[|\]\]|<\/td>).)+)\]\]',
|
|
|
- '<a id="inside" href="/' + tool.url_pas(re.sub('^wiki:', '', main_link)) + '">' + see_link + '</a>',
|
|
|
- data,
|
|
|
- 1
|
|
|
- )
|
|
|
elif re.search(r'^inter:((?:(?!:).)+):', main_link):
|
|
|
- inter_data = re.search(r'^inter:((?:(?!:).)+):((?:(?!\]\]|\|).)+)', main_link)
|
|
|
+ inter_data = re.search(r'^inter:((?:(?!:).)+):((?:(?!\]\]).)+)', main_link)
|
|
|
inter_data = inter_data.groups()
|
|
|
|
|
|
curs.execute(tool.db_change('select link, icon from inter where title = ?'), [inter_data[0]])
|
|
|
inter = curs.fetchall()
|
|
|
if inter:
|
|
|
- if inter[0][1] != '':
|
|
|
- inter_view = inter[0][1]
|
|
|
- else:
|
|
|
- inter_view = inter_data[0] + ':'
|
|
|
-
|
|
|
- if see_link != main_link:
|
|
|
- data = re.sub(
|
|
|
- '\[\[((?:(?!\[\[|\]\]|<\/td>).)+)\]\]',
|
|
|
- '<a id="inside" href="' + inter[0][0] + inter_data[1] + '">' + inter_view + see_link + '</a>',
|
|
|
- data,
|
|
|
- 1
|
|
|
- )
|
|
|
- else:
|
|
|
- data = re.sub(
|
|
|
- '\[\[((?:(?!\[\[|\]\]|<\/td>).)+)\]\]',
|
|
|
- '<a id="inside" href="' + inter[0][0] + inter_data[1] + '">' + inter_view + inter_data[1] + '</a>',
|
|
|
- data,
|
|
|
- 1
|
|
|
- )
|
|
|
+ return_link = link_fix(inter_data[1])
|
|
|
+ main_link = html.unescape(return_link[0])
|
|
|
+ other_link = return_link[1]
|
|
|
+
|
|
|
+ inter_view = inter[0][1] if inter[0][1] != '' else (inter_data[0] + ':')
|
|
|
+
|
|
|
+ data = link_re.sub('<a id="inside" name="set_link_' + str_e_link_id + '" href="">' + inter_view + see_link + '</a>', data, 1)
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].href = '" + \
|
|
|
+ (inter[0][0] + tool.url_pas(main_link) + other_link).replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
+ if inter_same == 1:
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].innerHTML = '" + \
|
|
|
+ (inter_view + main_link + other_link).replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
else:
|
|
|
- data = link_re.sub('Not exist', data, 1)
|
|
|
+ data = link_re.sub('', data, 1)
|
|
|
elif re.search(r'^(\/(?:.+))$', main_link):
|
|
|
under_title = re.search(r'^(\/(?:.+))$', main_link)
|
|
|
under_title = under_title.group(1)
|
|
|
@@ -1099,14 +1097,21 @@ def namumark(conn, data, title, include_num):
|
|
|
else:
|
|
|
data = link_re.sub('[[' + title + under_title + ']]', data, 1)
|
|
|
elif re.search(r'^http(s)?:\/\/', main_link):
|
|
|
- str_e_link_id = str(e_link_id)
|
|
|
- data = link_re.sub('<a id="out_link" class="out_link_' + str_e_link_id + '" rel="nofollow" href="">' + see_link + '</a>', data, 1)
|
|
|
+ data = link_re.sub('<a id="out_link" name="set_link_' + str_e_link_id + '" rel="nofollow" href="">' + see_link + '</a>', data, 1)
|
|
|
+
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].href = '" + \
|
|
|
+ main_link.replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
+ if inter_same == 1:
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].innerHTML = '" + \
|
|
|
+ main_link.replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
|
|
|
- plus_data += "document.getElementsByClassName('out_link_" + str_e_link_id + "')[0].href = '" + main_link.replace('\'', '\\\'') + "';\n"
|
|
|
- if see_link == main_link:
|
|
|
- plus_data += "document.getElementsByClassName('out_link_" + str_e_link_id + "')[0].innerHTML = '" + main_link.replace('\'', '\\\'') + "';\n"
|
|
|
-
|
|
|
- e_link_id += 1
|
|
|
+
|
|
|
else:
|
|
|
return_link = link_fix(main_link)
|
|
|
main_link = html.unescape(return_link[0])
|
|
|
@@ -1119,43 +1124,40 @@ def namumark(conn, data, title, include_num):
|
|
|
elif re.search(r'^\.\.\/', main_link):
|
|
|
main_link = re.sub(r'^\.\.\/', re.sub(r'(?P<in>.+)\/.*$', '\g<in>', title), main_link)
|
|
|
|
|
|
- if not re.search(r'^\|', main_link):
|
|
|
- if main_link != title:
|
|
|
- if main_link != '':
|
|
|
- backlink += [[title, main_link, '']]
|
|
|
-
|
|
|
- curs.execute(tool.db_change("select title from data where title = ?"), [main_link])
|
|
|
- if not curs.fetchall():
|
|
|
- backlink += [[title, main_link, 'no']]
|
|
|
-
|
|
|
- data = re.sub(
|
|
|
- '\[\[((?:(?!\[\[|\]\]|<\/td>).)+)\]\]',
|
|
|
- '<a class="' + include_name + 'link_finder" ' + \
|
|
|
- 'title="' + html.escape(main_link) + other_link + '" ' + \
|
|
|
- 'href="/w/' + tool.url_pas(main_link) + other_link + '"' + \
|
|
|
- '>' + see_link + '</a>',
|
|
|
- data,
|
|
|
- 1
|
|
|
- )
|
|
|
- else:
|
|
|
- data = re.sub(
|
|
|
- '\[\[((?:(?!\[\[|\]\]|<\/td>).)+)\]\]',
|
|
|
- '<a title="' + other_link + '" href="' + other_link + '">' + see_link + '</a>',
|
|
|
- data,
|
|
|
- 1
|
|
|
- )
|
|
|
- else:
|
|
|
- if re.search(r'^#', other_link):
|
|
|
- data = re.sub(
|
|
|
- '\[\[((?:(?!\[\[|\]\]|<\/td>).)+)\]\]',
|
|
|
- '<a title="' + other_link + '" href="' + other_link + '">' + other_link + '</a>',
|
|
|
- data,
|
|
|
- 1
|
|
|
- )
|
|
|
- else:
|
|
|
- data = link_re.sub('<b>' + see_link + '</b>', data, 1)
|
|
|
+ if main_link != title or main_link != '':
|
|
|
+ backlink += [[title, main_link, '']]
|
|
|
+
|
|
|
+ curs.execute(tool.db_change("select title from data where title = ?"), [main_link])
|
|
|
+ if not curs.fetchall():
|
|
|
+ backlink += [[title, main_link, 'no']]
|
|
|
+
|
|
|
+ data = link_re.sub('<a class="' + include_name + 'link_finder" name="set_link_' + str_e_link_id + '" title="" href="">' + see_link + '</a>', data, 1)
|
|
|
+
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].href = '" + \
|
|
|
+ ('/w/' + tool.url_pas(main_link) + other_link).replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].title = '" + \
|
|
|
+ (html.escape(main_link) + other_link).replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
+ if inter_same == 1:
|
|
|
+ plus_data += "" + \
|
|
|
+ "document.getElementsByName('set_link_" + str_e_link_id + "')[0].innerHTML = '" + \
|
|
|
+ (html.escape(main_link) + other_link).replace('\'', '\\\'') + "';" + \
|
|
|
+ "\n" + \
|
|
|
+ ""
|
|
|
else:
|
|
|
- data = link_re.sub('[[' + link + ']]', data, 1)
|
|
|
+ if re.search(r'^#', other_link):
|
|
|
+ data = link_re.sub(
|
|
|
+ '<a title="' + other_link + '" href="' + other_link + '">' + other_link + '</a>',
|
|
|
+ data,
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ data = link_re.sub('<b>' + see_link + '</b>', data, 1)
|
|
|
else:
|
|
|
break
|
|
|
|
|
|
@@ -1299,6 +1301,10 @@ def namumark(conn, data, title, include_num):
|
|
|
data = re.sub(r'\n<\/ul>', '</ul>', data)
|
|
|
data = re.sub(r'\n', '<br>', data)
|
|
|
|
|
|
+ plus_data += '' + \
|
|
|
+ 'get_link_state("' + include_name + '");\n' + \
|
|
|
+ 'get_file_state("' + include_name + '");\n' + \
|
|
|
+ ''
|
|
|
plus_data = 'render_html("' + include_name + 'render_contect");\n' + plus_data
|
|
|
|
|
|
return [data, plus_data, backlink]
|