Sfoglia il codice sorgente

테이블 캡션 기능 다시 추가

Surplus_Up (2DU) 6 anni fa
parent
commit
92caf89e7e
1 ha cambiato i file con 12 aggiunte e 1 eliminazioni
  1. 12 1
      route/tool/set_mark/namumark.py

+ 12 - 1
route/tool/set_mark/namumark.py

@@ -165,7 +165,18 @@ def table_start(data):
 
         table = re.search('\n((?:(?:(?:(?:\|\||\|[^|]+\|)+(?:(?:(?!\|\|).\n*)*))+)\|\|(?:\n)?)+)', data)
         if table:
-            table = '\n' + re.sub('(\|\|)+\n', '||\n', table.groups()[0])
+            table = re.sub('(\|\|)+\n', '||\n', table.groups()[0])
+            
+            table_caption = re.search('^\|([^|]+)\|', table)
+            if table_caption:
+                table_caption = '<caption>' + table_caption.groups()[0] + '</caption>'
+                
+                table = re.sub('^\|([^|]+)\|', '||', table)
+            else:
+                table_caption = ''
+            
+            table = '\n' + table
+            
             table_cel = re.findall('(\n(?:(?:\|\|)+)|\|\|\n(?:(?:\|\|)+)|(?:(?:\|\|)+))((?:(?:(?!\n|\|\|).)+\n*)+)', table)
             for i in table_cel:
                 cel_plus = re.search('^((?:&lt;(?:(?:(?!&gt;).)*)&gt;)+)', i[1])