瀏覽代碼

code formatting (black)

tags/current_release
adam j hartz 5 月之前
父節點
當前提交
8eb4f0778f
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. +3
    -5
      catsoop/language.py

+ 3
- 5
catsoop/language.py 查看文件

@@ -792,14 +792,13 @@ def handle_custom_tags(context, text):

# hints (<showhide>)
def _showhide_replacer(match):
body = source_transform_string(context, match.groupdict()['body'])
out = '''<div class="response"><button class="btn-catsoop" onclick="if(this.parentElement.children[1].style.display === 'none'){this.parentElement.children[1].style.display = 'block';}else{this.parentElement.children[1].style.display = 'none';}">Show/Hide</button>\n'''
body = source_transform_string(context, match.groupdict()["body"])
out = """<div class="response"><button class="btn-catsoop" onclick="if(this.parentElement.children[1].style.display === 'none'){this.parentElement.children[1].style.display = 'block';}else{this.parentElement.children[1].style.display = 'none';}">Show/Hide</button>\n"""
out += '<div style="display:none;">%s</div>' % (body,)
return out + '</div>'
return out + "</div>"

text = re.sub(_environment_matcher("showhide"), _showhide_replacer, text)


tree = BeautifulSoup(text, "html.parser")

# handle sections, etc.
@@ -944,7 +943,6 @@ def handle_custom_tags(context, text):
if not context.get("cs_footnotes", ""):
context["cs_footnotes"] = fnote


# custom URL handling in img, a, script, link

URL_FIX_LIST = [("img", "src"), ("a", "href"), ("script", "src"), ("link", "href")]


Loading…
取消
儲存