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,14 +71,15 @@ 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 */
while ((match = /\((\d+)\)/.exec(text.textContent!))) { let text = comment.firstChild as Text
const marker = text.splitText(match.index) if (text instanceof Text)
text = marker.splitText(match[0].length) while ((match = /\((\d+)\)/.exec(text.textContent!))) {
markers.push(marker) const marker = text.splitText(match.index)
} text = marker.splitText(match[0].length)
markers.push(marker)
}
} }
return markers return markers
} }