Browse Source

code formatting (black)

tags/v2020.2.0
adam j hartz 4 months ago
parent
commit
8eb4f0778f
1 changed files with 3 additions and 5 deletions
  1. +3
    -5
      catsoop/language.py

+ 3
- 5
catsoop/language.py View File

@@ -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…
Cancel
Save