Fixed problems with empty comment nodes generated by Terraform lexer

This commit is contained in:
squidfunk
2022-03-22 17:59:01 +01:00
parent 366a5ea3a4
commit 104c8c85e0
4 changed files with 12 additions and 11 deletions

View File

@@ -214,7 +214,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.897f3768.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.703c595d.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %} {% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script> <script src="{{ path | url }}"></script>
{% endfor %} {% endfor %}

View File

@@ -71,9 +71,10 @@ function findAnnotationMarkers(container: HTMLElement): Text[] {
const markers: Text[] = [] const markers: Text[] = []
for (const comment of getElements(".c, .c1, .cm", container)) { for (const comment of getElements(".c, .c1, .cm", container)) {
let match: RegExpExecArray | null let match: RegExpExecArray | null
let text = comment.firstChild as Text
/* Split text at marker and add to list */ /* Split text at marker and add to list */
let text = comment.firstChild as Text
if (text instanceof Text)
while ((match = /\((\d+)\)/.exec(text.textContent!))) { while ((match = /\((\d+)\)/.exec(text.textContent!))) {
const marker = text.splitText(match.index) const marker = text.splitText(match.index)
text = marker.splitText(match[0].length) text = marker.splitText(match[0].length)