jph00 DanielCL commited on
Commit
bd669c9
1 Parent(s): c41e3c2

improve the pattern to include situations of no space and no new line for adding top_hide (#4)

Browse files

- improve the pattern to include situations of no space and no new line for adding top_hide (4fb556a35c850052f7da82b847a3b745c167bf50)


Co-authored-by: Liao <DanielCL@users.noreply.huggingface.co>

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"""