Skip to content

Component regex tries to match commented out code #102

Closed
@Archmonger

Description

@Archmonger

Current Situation

Currently commented out component tags will attempt to be parsed by our component regex.

For example, this should not be parsed <!-- {% component "my.component" %} -->

Proposed Actions

Modify the regex to avoid any tags within comments.

As a quick test, I attempted to see what would happen if I prefixed the component regex with a negative lookbehind (?<!(<!--))\s*, however, it did not work for any tags containing a space between the comment start <!-- and tag start {%

Additionally, I'm not entirely how to write regex for situations like <!-- {% component "my.component" %} --> while not hitting false negatives for things such as <!-- a comment --> {% component "my.component" %} <!-- another comment -->

If a regex solution can't be made, a quick and dirty solution could be running some kind of HTML minifier to strip out comment tags prior to reading the template HTML.

Or a running a simple regex replace on all comments prior to parsing.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions