improve the pattern to include situations of no space and no new line for adding top_hide

#4
by DanielCL - opened
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -24,7 +24,7 @@ def fix_imgs_with_hide(src, dst):
24
  add_hide_top = """\n\n[details='Images']"""
25
  return f'{x.group(1)}{add_hide_top}{x.group(2)}'
26
 
27
- result_top_hide = re.sub(r'([\.|\?|\w|\`][\s]+]?)([\n]+!\[[^|]+\|\S+\]\(\S+\))', add_hide_top_func, result_no_hide)
28
 
29
  def add_hide_bottom_func(x):
30
  add_hide_bottom = """[/details]\n\n"""
 
24
  add_hide_top = """\n\n[details='Images']"""
25
  return f'{x.group(1)}{add_hide_top}{x.group(2)}'
26
 
27
+ result_top_hide = re.sub(r'([\.|\?|\w|\`][\s]*)([\n]*!\[[^|]+\|\S+\]\(\S+\))', add_hide_top_func, result_no_hide)
28
 
29
  def add_hide_bottom_func(x):
30
  add_hide_bottom = """[/details]\n\n"""