잉여개발기 (SPDV) před 3 roky
rodič
revize
6b9cdd08a0
2 změnil soubory, kde provedl 15 přidání a 4 odebrání
  1. 1 1
      route/edit.py
  2. 14 3
      route/tool/func_render_namumark.py

+ 1 - 1
route/edit.py

@@ -138,7 +138,7 @@ def edit(name = 'Test', section = 0, do_type = ''):
                     curs.execute(db_change('select data from other where name = "markup"'))
                     db_data = curs.fetchall()
                     db_data = db_data[0][0] if db_data else 'namumark'
-                    if db_data == 'namumark':
+                    if db_data in ('namumark', 'namumark_beta'):
                         count = 1
                         data_section = '\n' + data + '\n'
                         

+ 14 - 3
route/tool/func_render_namumark.py

@@ -208,7 +208,10 @@ class class_do_render_namumark:
         heading_regex = r'\n((={1,6})(#?) ?([^\n]+))\n'
         heading_count_all = len(re.findall(heading_regex, self.render_data)) * 3
         heading_stack = [0, 0, 0, 0, 0, 0]
+        heading_count = 0
         while 1:
+            heading_count += 1
+
             if not re.search(heading_regex, self.render_data):
                 break
             elif heading_count_all < 0:
@@ -219,9 +222,13 @@ class class_do_render_namumark:
                 heading_data = re.search(heading_regex, self.render_data)
                 heading_data = heading_data.groups()
 
-                heading_data_last_regex = r' ?(#?={1,6})$'
+                heading_data_last_regex = r' ?(#?={1,6}[^=]*)$'
                 heading_data_last = re.search(heading_data_last_regex, heading_data[3])
-                heading_data_last = heading_data_last.group(1)
+                if heading_data_last:
+                    heading_data_last = heading_data_last.group(1)
+                else:
+                    heading_data_last = ''
+
                 heading_data_text = re.sub(heading_data_last_regex, '', heading_data[3])
 
                 heading_data_diff = heading_data[2] + heading_data[1]
@@ -253,7 +260,11 @@ class class_do_render_namumark:
 
                     heading_data_text_fix = re.sub(r'<([^<>]*)>', '', heading_data_text)
                     
-                    data_name = self.get_tool_data_storage('<h' + heading_level_str + ' id="' + heading_data_text_fix + '">', '</h' + heading_level_str + '>', '')
+                    data_name = self.get_tool_data_storage(
+                        '<h' + heading_level_str + ' id="' + heading_data_text_fix + '">', 
+                        ' <sub><a href="/edit_section/' + str(heading_count) + '/' + url_pas(self.doc_name) + '">✎</a></sub></h' + heading_level_str + '>', 
+                        ''
+                    )
 
                     heading_data_complete = '' + \
                         '\n<front_br>' + \