|
|
@@ -72,27 +72,27 @@ def table_parser(data, cel_data, cel_num, start_data, num = 0, cel_color = {}):
|
|
|
|
|
|
table_state = re.findall(r'<((?:(?!>).)+)>', data)
|
|
|
for in_state in table_state:
|
|
|
- if re.search("^table ?width=([^=]+)$", in_state):
|
|
|
+ if re.search(r"^table ?width=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^table ?width=', '', in_state)
|
|
|
div_style += 'width: ' + ((table_data + 'px') if re.search(r'^[0-9]+$', table_data) else table_data) + ';'
|
|
|
all_table += 'width: 100%;'
|
|
|
- elif re.search("^table ?height=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^table ?height=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^table ?height=', '', in_state)
|
|
|
div_style += 'height: ' + ((table_data + 'px') if re.search(r'^[0-9]+$', table_data) else table_data) + ';'
|
|
|
- elif re.search("^table ?align=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^table ?align=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^table ?align=', '', in_state)
|
|
|
if table_data == 'right':
|
|
|
div_style += 'float: right;'
|
|
|
elif table_data == 'center':
|
|
|
all_table += 'margin: auto;'
|
|
|
- elif re.search("^table ?textalign=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^table ?textalign=([^=]+)$", in_state):
|
|
|
num = 1
|
|
|
table_data = re.sub(r'^table ?textalign=', '', in_state)
|
|
|
if table_data == 'right':
|
|
|
all_table += 'text-align: right;'
|
|
|
elif table_data == 'center':
|
|
|
all_table += 'text-align: center;'
|
|
|
- elif re.search("^row ?textalign=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^row ?textalign=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^row ?textalign=', '', in_state)
|
|
|
if table_data == 'right':
|
|
|
row_style += 'text-align: right;'
|
|
|
@@ -102,48 +102,48 @@ def table_parser(data, cel_data, cel_num, start_data, num = 0, cel_color = {}):
|
|
|
row_style += 'text-align: left;'
|
|
|
elif re.search(r'^-([0-9]+)$', in_state):
|
|
|
cel = 'colspan="' + re.sub(r'^-', '', in_state) + '"'
|
|
|
- elif re.search("^(\^|v)?\|([^|]+)$", in_state):
|
|
|
+ elif re.search(r"^(\^|v)?\|([^|]+)$", in_state):
|
|
|
if re.search(r'^\^', in_state):
|
|
|
cel_style += 'vertical-align: top;'
|
|
|
elif re.search(r'^v', in_state):
|
|
|
cel_style += 'vertical-align: bottom;'
|
|
|
|
|
|
row = 'rowspan="' + re.sub(r'^(\^|v)?\|', '', in_state) + '"'
|
|
|
- elif re.search("^row ?bgcolor=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^row ?bgcolor=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^row ?bgcolor=', '', in_state)
|
|
|
row_style += 'background: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ';'
|
|
|
- elif re.search("^row ?color=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^row ?color=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^row ?color=', '', in_state)
|
|
|
row_style += 'color: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ';'
|
|
|
- elif re.search("^table ?bordercolor=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^table ?bordercolor=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^table ?bordercolor=', '', in_state)
|
|
|
all_table += 'border: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ' 2px solid;'
|
|
|
- elif re.search("^table ?bgcolor=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^table ?bgcolor=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^table ?bgcolor=', '', in_state)
|
|
|
all_table += 'background: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ';'
|
|
|
- elif re.search("^table ?color=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^table ?color=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^table ?color=', '', in_state)
|
|
|
all_table += 'color: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ';'
|
|
|
- elif re.search("^col ?bgcolor=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^col ?bgcolor=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^col ?bgcolor=', '', in_state)
|
|
|
table_data = (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data)
|
|
|
cel_color[cel_num] += 'background: ' + table_data + ';'
|
|
|
cel_style += 'background: ' + table_data + ';'
|
|
|
- elif re.search("^col ?color=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^col ?color=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^col ?color=', '', in_state)
|
|
|
table_data = (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data)
|
|
|
cel_color[cel_num] += 'color: ' + table_data + ';'
|
|
|
cel_style += 'color: ' + table_data + ';'
|
|
|
- elif re.search("^(bgcolor=([^=]+)|#(?:[0-9a-f-A-F]{3}){1,2}|\w+)$", in_state):
|
|
|
+ elif re.search(r"^(bgcolor=([^=]+)|#(?:[0-9a-f-A-F]{3}){1,2}|\w+)$", in_state):
|
|
|
table_data = re.sub(r'^bgcolor=', '', in_state)
|
|
|
cel_style += 'background: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ';'
|
|
|
- elif re.search("^color=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^color=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^color=', '', in_state)
|
|
|
cel_style += 'color: ' + (re.sub(',([^,]*)', '', table_data) if re.search(r',', table_data) else table_data) + ';'
|
|
|
- elif re.search("^width=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^width=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^width=', '', in_state)
|
|
|
cel_style += 'width: ' + ((table_data + 'px') if re.search(r'^[0-9]+$', table_data) else table_data) + ';'
|
|
|
- elif re.search("^height=([^=]+)$", in_state):
|
|
|
+ elif re.search(r"^height=([^=]+)$", in_state):
|
|
|
table_data = re.sub(r'^height=', '', in_state)
|
|
|
cel_style += 'height: ' + ((table_data + 'px') if re.search(r'^[0-9]+$', table_data) else table_data) + ';'
|
|
|
elif re.search(r'^\(|:|\)$', in_state):
|
|
|
@@ -153,8 +153,8 @@ def table_parser(data, cel_data, cel_num, start_data, num = 0, cel_color = {}):
|
|
|
cel_style += 'text-align: center;'
|
|
|
else:
|
|
|
cel_style += 'text-align: left;'
|
|
|
- elif re.search("^table ?class=([^=]+)$", in_state):
|
|
|
- table_class += re.sub("^table ?class=", '', in_state)
|
|
|
+ elif re.search(r"^table ?class=([^=]+)$", in_state):
|
|
|
+ table_class += re.sub(r"^table ?class=", '', in_state)
|
|
|
|
|
|
div_style += '"'
|
|
|
all_table += '"'
|
|
|
@@ -498,7 +498,10 @@ def namumark(conn, data, title, include_num):
|
|
|
nowiki_num = 0
|
|
|
data = '\n' + data + '\n'
|
|
|
include_num = include_num + '_' if include_num else ''
|
|
|
- plus_data = 'get_link_state("' + include_num + '");\nget_file_state("' + include_num + '");\n'
|
|
|
+ plus_data = '' + \
|
|
|
+ 'get_link_state("' + include_num + '");\n' + \
|
|
|
+ 'get_file_state("' + include_num + '");\n' + \
|
|
|
+ ''
|
|
|
|
|
|
backlink = []
|
|
|
end_data = {}
|