|
@@ -39,6 +39,7 @@ class class_do_render_namumark:
|
|
|
|
|
|
|
|
self.data_math_count = 0
|
|
self.data_math_count = 0
|
|
|
self.data_redirect = 0
|
|
self.data_redirect = 0
|
|
|
|
|
+ self.link_count = 0
|
|
|
|
|
|
|
|
self.data_toc = ''
|
|
self.data_toc = ''
|
|
|
self.data_footnote = {}
|
|
self.data_footnote = {}
|
|
@@ -227,14 +228,7 @@ class class_do_render_namumark:
|
|
|
doc_set = self.doc_set
|
|
doc_set = self.doc_set
|
|
|
doc_set['doc_include'] = doc_include
|
|
doc_set['doc_include'] = doc_include
|
|
|
|
|
|
|
|
- data_end = class_do_render_namumark(
|
|
|
|
|
- self.curs,
|
|
|
|
|
- self.doc_name,
|
|
|
|
|
- data,
|
|
|
|
|
- doc_set,
|
|
|
|
|
- self.lang_data,
|
|
|
|
|
- do_type = 'inter'
|
|
|
|
|
- )()
|
|
|
|
|
|
|
+ data_end = class_do_render_namumark(self.curs, self.doc_name, data, doc_set, self.lang_data, do_type = 'inter')()
|
|
|
|
|
|
|
|
self.render_data_js += data_end[1]
|
|
self.render_data_js += data_end[1]
|
|
|
self.data_include += data_end[2]['include']
|
|
self.data_include += data_end[2]['include']
|
|
@@ -242,6 +236,7 @@ class class_do_render_namumark:
|
|
|
self.data_backlink = dict(self.data_backlink, **data_end[2]['backlink_dict'])
|
|
self.data_backlink = dict(self.data_backlink, **data_end[2]['backlink_dict'])
|
|
|
self.data_temp_storage = dict(self.data_temp_storage, **data_end[2]['temp_storage'][0])
|
|
self.data_temp_storage = dict(self.data_temp_storage, **data_end[2]['temp_storage'][0])
|
|
|
self.data_temp_storage_count += data_end[2]['temp_storage'][1]
|
|
self.data_temp_storage_count += data_end[2]['temp_storage'][1]
|
|
|
|
|
+ self.link_count += data_end[2]['link_count']
|
|
|
|
|
|
|
|
return data_end[0]
|
|
return data_end[0]
|
|
|
|
|
|
|
@@ -1197,6 +1192,8 @@ class class_do_render_namumark:
|
|
|
link_sub = ''
|
|
link_sub = ''
|
|
|
link_sub_storage = link_main_org
|
|
link_sub_storage = link_main_org
|
|
|
|
|
|
|
|
|
|
+ self.link_count += 1
|
|
|
|
|
+
|
|
|
data_name = self.get_tool_data_storage('<a class="' + link_exist + ' ' + link_same + '" title="' + link_title + '" href="' + link_main + link_data_sharp + '">' + link_sub_storage, '</a>', link_data_full)
|
|
data_name = self.get_tool_data_storage('<a class="' + link_exist + ' ' + link_same + '" title="' + link_title + '" href="' + link_main + link_data_sharp + '">' + link_sub_storage, '</a>', link_data_full)
|
|
|
self.render_data = re.sub(link_regex, lambda x : ('<' + data_name + '>' + link_sub + '</' + data_name + '>'), self.render_data, 1)
|
|
self.render_data = re.sub(link_regex, lambda x : ('<' + data_name + '>' + link_sub + '</' + data_name + '>'), self.render_data, 1)
|
|
|
|
|
|
|
@@ -2054,44 +2051,7 @@ class class_do_render_namumark:
|
|
|
quote_count_max -= 1
|
|
quote_count_max -= 1
|
|
|
quote_count += 1
|
|
quote_count += 1
|
|
|
|
|
|
|
|
- # 일반 리스트
|
|
|
|
|
- list_style = {
|
|
|
|
|
- 1 : 'opennamu_list_1',
|
|
|
|
|
- 2 : 'opennamu_list_2',
|
|
|
|
|
- 3 : 'opennamu_list_3',
|
|
|
|
|
- 4 : 'opennamu_list_4'
|
|
|
|
|
- }
|
|
|
|
|
- def do_render_list_sub(match):
|
|
|
|
|
- list_data = match.group(2)
|
|
|
|
|
- list_len = len(match.group(1))
|
|
|
|
|
- if list_len == 0:
|
|
|
|
|
- list_len = 1
|
|
|
|
|
-
|
|
|
|
|
- list_style_data = 'opennamu_list_5'
|
|
|
|
|
- if list_len in list_style:
|
|
|
|
|
- list_style_data = list_style[list_len]
|
|
|
|
|
-
|
|
|
|
|
- return '<li style="margin-left: ' + str(list_len * 20) + 'px;" class="' + list_style_data + '">' + list_data + '</li>'
|
|
|
|
|
-
|
|
|
|
|
- list_regex = r'((?:\n *\* ?[^\n]*)+)\n'
|
|
|
|
|
- list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
|
|
|
- while 1:
|
|
|
|
|
- list_data = re.search(list_regex, self.render_data)
|
|
|
|
|
- if list_count_max < 0:
|
|
|
|
|
- break
|
|
|
|
|
- elif not list_data:
|
|
|
|
|
- break
|
|
|
|
|
- else:
|
|
|
|
|
- list_data = list_data.group(1)
|
|
|
|
|
- list_sub_regex = r'\n( *)\* ?([^\n]*)'
|
|
|
|
|
-
|
|
|
|
|
- list_data = re.sub(list_sub_regex, do_render_list_sub, list_data)
|
|
|
|
|
-
|
|
|
|
|
- self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
|
|
|
-
|
|
|
|
|
- list_count_max -= 1
|
|
|
|
|
-
|
|
|
|
|
- # 기타 리스트 공통 파트
|
|
|
|
|
|
|
+ # 리스트 공통 파트
|
|
|
def int_to_alpha(num):
|
|
def int_to_alpha(num):
|
|
|
alpha_list = string.ascii_lowercase
|
|
alpha_list = string.ascii_lowercase
|
|
|
alpha_len = len(alpha_list)
|
|
alpha_len = len(alpha_list)
|
|
@@ -2124,128 +2084,84 @@ class class_do_render_namumark:
|
|
|
|
|
|
|
|
list_view_set = get_main_skin_set(self.curs, self.flask_session, 'main_css_list_view_change', self.ip)
|
|
list_view_set = get_main_skin_set(self.curs, self.flask_session, 'main_css_list_view_change', self.ip)
|
|
|
|
|
|
|
|
|
|
+ list_style = {
|
|
|
|
|
+ 1 : 'opennamu_list_1',
|
|
|
|
|
+ 2 : 'opennamu_list_2',
|
|
|
|
|
+ 3 : 'opennamu_list_3',
|
|
|
|
|
+ 4 : 'opennamu_list_4'
|
|
|
|
|
+ }
|
|
|
class do_render_list_int_to:
|
|
class do_render_list_int_to:
|
|
|
- def __init__(self, do_type, list_view_set = ''):
|
|
|
|
|
- self.list_num = []
|
|
|
|
|
- self.do_type = do_type
|
|
|
|
|
|
|
+ def __init__(self, list_view_set = ''):
|
|
|
|
|
+ self.list_num = {}
|
|
|
self.list_view_set = list_view_set
|
|
self.list_view_set = list_view_set
|
|
|
|
|
|
|
|
def __call__(self, match):
|
|
def __call__(self, match):
|
|
|
- list_data = match.group(3)
|
|
|
|
|
- list_start = match.group(2)
|
|
|
|
|
- list_len = len(match.group(1))
|
|
|
|
|
- if list_len == 0:
|
|
|
|
|
- list_len = 1
|
|
|
|
|
|
|
+ if match.group(4):
|
|
|
|
|
+ list_data = match.group(5)
|
|
|
|
|
+ list_len = len(match.group(1))
|
|
|
|
|
+ if list_len == 0:
|
|
|
|
|
+ list_len = 1
|
|
|
|
|
|
|
|
- if len(self.list_num) >= list_len:
|
|
|
|
|
- self.list_num[list_len - 1] += 1
|
|
|
|
|
|
|
+ list_style_data = 'opennamu_list_5'
|
|
|
|
|
+ if list_len in list_style:
|
|
|
|
|
+ list_style_data = list_style[list_len]
|
|
|
|
|
|
|
|
- for for_a in range(list_len, len(self.list_num)):
|
|
|
|
|
- self.list_num[for_a] = 0
|
|
|
|
|
|
|
+ return '<li style="margin-left: ' + str(list_len * 20) + 'px;" class="' + list_style_data + '">' + list_data + '</li>'
|
|
|
else:
|
|
else:
|
|
|
- self.list_num += [1] * (list_len - len(self.list_num))
|
|
|
|
|
-
|
|
|
|
|
- if list_start:
|
|
|
|
|
- self.list_num[list_len - 1] = int(list_start)
|
|
|
|
|
-
|
|
|
|
|
- if self.do_type == 'int':
|
|
|
|
|
- if self.list_view_set == 'on':
|
|
|
|
|
- change_text = str('-'.join([str(for_a) for for_a in self.list_num if for_a != 0]))
|
|
|
|
|
- else:
|
|
|
|
|
- change_text = str(self.list_num[list_len - 1])
|
|
|
|
|
- elif self.do_type == 'roman_big':
|
|
|
|
|
- change_text = int_to_roman(self.list_num[list_len - 1]).upper()
|
|
|
|
|
- elif self.do_type == 'roman_small':
|
|
|
|
|
- change_text = int_to_roman(self.list_num[list_len - 1]).lower()
|
|
|
|
|
- elif self.do_type == 'alpha_big':
|
|
|
|
|
- change_text = int_to_alpha(self.list_num[list_len - 1]).upper()
|
|
|
|
|
- else:
|
|
|
|
|
- change_text = int_to_alpha(self.list_num[list_len - 1]).lower()
|
|
|
|
|
-
|
|
|
|
|
- return '<li style="margin-left: ' + str((list_len - 1) * 20) + 'px;" class="opennamu_list_none">' + change_text + '. ' + list_data + '</li>'
|
|
|
|
|
-
|
|
|
|
|
- # 숫자 리스트
|
|
|
|
|
- list_regex = r'((?:\n *1\. ?[^\n]*){2,})\n'
|
|
|
|
|
- list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
|
|
|
- while 1:
|
|
|
|
|
- list_data = re.search(list_regex, self.render_data)
|
|
|
|
|
- if list_count_max < 0:
|
|
|
|
|
- break
|
|
|
|
|
- elif not list_data:
|
|
|
|
|
- break
|
|
|
|
|
- else:
|
|
|
|
|
- list_data = list_data.group(1)
|
|
|
|
|
- list_sub_regex = r'\n( *)1\.(?:#([0-9]*))? ?([^\n]*)'
|
|
|
|
|
-
|
|
|
|
|
- list_class = do_render_list_int_to('int', list_view_set)
|
|
|
|
|
- list_data = re.sub(list_sub_regex, list_class, list_data)
|
|
|
|
|
-
|
|
|
|
|
- self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
|
|
|
-
|
|
|
|
|
- list_count_max -= 1
|
|
|
|
|
-
|
|
|
|
|
- # 소문자 리스트
|
|
|
|
|
- list_regex = r'((?:\n *a\. ?[^\n]*){2,})\n'
|
|
|
|
|
- list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
|
|
|
- while 1:
|
|
|
|
|
- list_data = re.search(list_regex, self.render_data)
|
|
|
|
|
- if list_count_max < 0:
|
|
|
|
|
- break
|
|
|
|
|
- elif not list_data:
|
|
|
|
|
- break
|
|
|
|
|
- else:
|
|
|
|
|
- list_data = list_data.group(1)
|
|
|
|
|
- list_sub_regex = r'\n( *)a.(?:#([0-9]*))? ?([^\n]*)'
|
|
|
|
|
-
|
|
|
|
|
- list_class = do_render_list_int_to('alpha_small')
|
|
|
|
|
- list_data = re.sub(list_sub_regex, list_class, list_data)
|
|
|
|
|
-
|
|
|
|
|
- self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
|
|
|
-
|
|
|
|
|
- list_count_max -= 1
|
|
|
|
|
-
|
|
|
|
|
- # 대문자 리스트
|
|
|
|
|
- list_regex = r'((?:\n *A\. ?[^\n]*){2,})\n'
|
|
|
|
|
- list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
|
|
|
- while 1:
|
|
|
|
|
- list_data = re.search(list_regex, self.render_data)
|
|
|
|
|
- if list_count_max < 0:
|
|
|
|
|
- break
|
|
|
|
|
- elif not list_data:
|
|
|
|
|
- break
|
|
|
|
|
- else:
|
|
|
|
|
- list_data = list_data.group(1)
|
|
|
|
|
- list_sub_regex = r'\n( *)A.(?:#([0-9]*))? ?([^\n]*)'
|
|
|
|
|
|
|
+ list_type = match.group(2)
|
|
|
|
|
+
|
|
|
|
|
+ do_type = 'int'
|
|
|
|
|
+ if list_type == 'a':
|
|
|
|
|
+ do_type = 'alpha_small'
|
|
|
|
|
+ elif list_type == 'A':
|
|
|
|
|
+ do_type = 'alpha_big'
|
|
|
|
|
+ elif list_type == 'i':
|
|
|
|
|
+ do_type = 'roman_small'
|
|
|
|
|
+ elif list_type == 'I':
|
|
|
|
|
+ do_type = 'roman_big'
|
|
|
|
|
+
|
|
|
|
|
+ if not do_type in self.list_num:
|
|
|
|
|
+ self.list_num[do_type] = []
|
|
|
|
|
+
|
|
|
|
|
+ for for_a in self.list_num:
|
|
|
|
|
+ if for_a != do_type:
|
|
|
|
|
+ self.list_num[for_a] = []
|
|
|
|
|
|
|
|
- list_class = do_render_list_int_to('alpha_big')
|
|
|
|
|
- list_data = re.sub(list_sub_regex, list_class, list_data)
|
|
|
|
|
|
|
+ list_data = match.group(5)
|
|
|
|
|
+ list_start = match.group(3)
|
|
|
|
|
+ list_len = len(match.group(1))
|
|
|
|
|
+ if list_len == 0:
|
|
|
|
|
+ list_len = 1
|
|
|
|
|
|
|
|
- self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
|
|
|
|
|
+ if len(self.list_num[do_type]) >= list_len:
|
|
|
|
|
+ self.list_num[do_type][list_len - 1] += 1
|
|
|
|
|
|
|
|
- list_count_max -= 1
|
|
|
|
|
-
|
|
|
|
|
- # 로마자 대문자 리스트
|
|
|
|
|
- list_regex = r'((?:\n *I\. ?[^\n]*){2,})\n'
|
|
|
|
|
- list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
|
|
|
- while 1:
|
|
|
|
|
- list_data = re.search(list_regex, self.render_data)
|
|
|
|
|
- if list_count_max < 0:
|
|
|
|
|
- break
|
|
|
|
|
- elif not list_data:
|
|
|
|
|
- break
|
|
|
|
|
- else:
|
|
|
|
|
- list_data = list_data.group(1)
|
|
|
|
|
- list_sub_regex = r'\n( *)I.(?:#([0-9]*))? ?([^\n]*)'
|
|
|
|
|
|
|
+ for for_a in range(list_len, len(self.list_num[do_type])):
|
|
|
|
|
+ self.list_num[do_type][for_a] = 0
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.list_num[do_type] += [1] * (list_len - len(self.list_num[do_type]))
|
|
|
|
|
|
|
|
- list_class = do_render_list_int_to('roman_big')
|
|
|
|
|
- list_data = re.sub(list_sub_regex, list_class, list_data)
|
|
|
|
|
|
|
+ if list_start:
|
|
|
|
|
+ self.list_num[do_type][list_len - 1] = int(list_start)
|
|
|
|
|
|
|
|
- self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
|
|
|
|
|
+ if do_type == 'int':
|
|
|
|
|
+ if self.list_view_set == 'on':
|
|
|
|
|
+ change_text = str('-'.join([str(for_a) for for_a in self.list_num[do_type] if for_a != 0]))
|
|
|
|
|
+ else:
|
|
|
|
|
+ change_text = str(self.list_num[do_type][list_len - 1])
|
|
|
|
|
+ elif do_type == 'roman_big':
|
|
|
|
|
+ change_text = int_to_roman(self.list_num[do_type][list_len - 1]).upper()
|
|
|
|
|
+ elif do_type == 'roman_small':
|
|
|
|
|
+ change_text = int_to_roman(self.list_num[do_type][list_len - 1]).lower()
|
|
|
|
|
+ elif do_type == 'alpha_big':
|
|
|
|
|
+ change_text = int_to_alpha(self.list_num[do_type][list_len - 1]).upper()
|
|
|
|
|
+ else:
|
|
|
|
|
+ change_text = int_to_alpha(self.list_num[do_type][list_len - 1]).lower()
|
|
|
|
|
|
|
|
- list_count_max -= 1
|
|
|
|
|
|
|
+ return '<li style="margin-left: ' + str((list_len - 1) * 20) + 'px;" class="opennamu_list_none">' + change_text + '. ' + list_data + '</li>'
|
|
|
|
|
|
|
|
- # 로마자 소문자 리스트
|
|
|
|
|
- list_regex = r'((?:\n *i\. ?[^\n]*){2,})\n'
|
|
|
|
|
|
|
+ # 숫자 리스트
|
|
|
|
|
+ list_regex = r'((?:\n( *)(?:(1|a|A|I|i)\.(?:#([0-9]*))?|(\*)) ?([^\n]*))+)\n'
|
|
|
list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
list_count_max = len(re.findall(list_regex, self.render_data)) * 3
|
|
|
while 1:
|
|
while 1:
|
|
|
list_data = re.search(list_regex, self.render_data)
|
|
list_data = re.search(list_regex, self.render_data)
|
|
@@ -2255,9 +2171,9 @@ class class_do_render_namumark:
|
|
|
break
|
|
break
|
|
|
else:
|
|
else:
|
|
|
list_data = list_data.group(1)
|
|
list_data = list_data.group(1)
|
|
|
- list_sub_regex = r'\n( *)i.(?:#([0-9]*))? ?([^\n]*)'
|
|
|
|
|
|
|
+ list_sub_regex = r'\n( *)(?:(1|a|A|I|i)\.(?:#([0-9]*))?|(\*)) ?([^\n]*)'
|
|
|
|
|
|
|
|
- list_class = do_render_list_int_to('roman_small')
|
|
|
|
|
|
|
+ list_class = do_render_list_int_to(list_view_set)
|
|
|
list_data = re.sub(list_sub_regex, list_class, list_data)
|
|
list_data = re.sub(list_sub_regex, list_class, list_data)
|
|
|
|
|
|
|
|
self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
self.render_data = re.sub(list_regex, lambda x : ('\n<front_br><ul class="opennamu_ul">' + list_data + '</ul><back_br>\n'), self.render_data, 1)
|
|
@@ -2327,17 +2243,25 @@ class class_do_render_namumark:
|
|
|
|
|
|
|
|
self.render_data = re.sub(r'(<a(?: [^<>]*)?>|<\/a>)', do_render_last_a_link, self.render_data)
|
|
self.render_data = re.sub(r'(<a(?: [^<>]*)?>|<\/a>)', do_render_last_a_link, self.render_data)
|
|
|
|
|
|
|
|
|
|
+ def do_render_last_toc_filter(match):
|
|
|
|
|
+ data = match.group(1).split(' ')
|
|
|
|
|
+ if data[0] == 'a' or data[0] == '/a':
|
|
|
|
|
+ return '<' + match[1] + '>'
|
|
|
|
|
+ else:
|
|
|
|
|
+ return ''
|
|
|
|
|
+
|
|
|
# add toc
|
|
# add toc
|
|
|
def do_render_last_toc(match):
|
|
def do_render_last_toc(match):
|
|
|
data = match.group(1)
|
|
data = match.group(1)
|
|
|
-
|
|
|
|
|
- data = re.sub(r'<[^<>]*>', '', data)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ data_sub = re.sub(r'<([^<>]*)>', '', data)
|
|
|
|
|
+ data = re.sub(r'<([^<>]*)>', do_render_last_toc_filter, data)
|
|
|
|
|
|
|
|
heading_regex = r'<h([1-6])>'
|
|
heading_regex = r'<h([1-6])>'
|
|
|
heading_data = re.search(heading_regex, self.render_data)
|
|
heading_data = re.search(heading_regex, self.render_data)
|
|
|
if heading_data:
|
|
if heading_data:
|
|
|
heading_data = heading_data.group(1)
|
|
heading_data = heading_data.group(1)
|
|
|
- self.render_data = re.sub(heading_regex, lambda x : ('<h' + heading_data + ' id="' + data + '">'), self.render_data, 1)
|
|
|
|
|
|
|
+ self.render_data = re.sub(heading_regex, lambda x : ('<h' + heading_data + ' id="' + data_sub + '">'), self.render_data, 1)
|
|
|
|
|
|
|
|
return data
|
|
return data
|
|
|
|
|
|
|
@@ -2421,6 +2345,7 @@ class class_do_render_namumark:
|
|
|
data_backlink_dict = self.data_backlink
|
|
data_backlink_dict = self.data_backlink
|
|
|
self.data_backlink = [[self.doc_name, for_a, for_b, self.data_backlink[for_a][for_b]] for for_a in self.data_backlink for for_b in self.data_backlink[for_a]]
|
|
self.data_backlink = [[self.doc_name, for_a, for_b, self.data_backlink[for_a][for_b]] for for_a in self.data_backlink for for_b in self.data_backlink[for_a]]
|
|
|
|
|
|
|
|
|
|
+ # 여기 수정시 do_inter_render도 수정 필요
|
|
|
return [
|
|
return [
|
|
|
self.render_data, # html
|
|
self.render_data, # html
|
|
|
self.render_data_js, # js
|
|
self.render_data_js, # js
|
|
@@ -2430,6 +2355,8 @@ class class_do_render_namumark:
|
|
|
'include' : self.data_include, # include data
|
|
'include' : self.data_include, # include data
|
|
|
'footnote' : self.data_footnote_all, # footnote
|
|
'footnote' : self.data_footnote_all, # footnote
|
|
|
'category' : self.data_category_list,
|
|
'category' : self.data_category_list,
|
|
|
- 'temp_storage' : [self.data_temp_storage, self.data_temp_storage_count]
|
|
|
|
|
|
|
+ 'temp_storage' : [self.data_temp_storage, self.data_temp_storage_count],
|
|
|
|
|
+ 'link_count' : self.link_count,
|
|
|
|
|
+ 'redirect' : self.data_redirect
|
|
|
} # other
|
|
} # other
|
|
|
]
|
|
]
|