Replace header collapse/expand for link copying.

This commit is contained in:
Sergio Martínez Portela 2023-04-28 00:11:15 +02:00
parent fce2d3c935
commit bdda2f3676
2 changed files with 7 additions and 23 deletions

View file

@ -755,7 +755,7 @@ def render(headline, doc, graph, headlineLevel):
title = render_inline(headline.title, render_tag, headline, graph)
if headlineLevel > 0:
title = f"<a href=\"javascript:toggle_expand('{html.escape(headline.id)}')\">{title}</a>"
title = f"<a href=\"#{html.escape(headline.id)}\">{title}</a>"
return f"""
<div id="{html.escape(headline.id)}" class="node {todo_state} {display_state}">
@ -792,20 +792,6 @@ def as_document(html, title, global_toc):
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
function toggle_expand(header_id) {{
var e = document.getElementById(header_id);
if (e.classList.contains('expanded')) {{
e.classList.add('collapsed');
e.classList.remove('expanded');
}}
else {{
e.classList.add('expanded');
e.classList.remove('collapsed');
}}
}}
</script>
</head>
<body>
<nav>