Skip to content

Blade comment syntax not supported. #5

Closed
@dima2306

Description

@dima2306

Here's my config:

{
  "folder": "resources/views/new/auth",
  "file_types": [
    "blade.php"
  ],
"ignore": ["#", "_", ">", "^", "*", "=", "@", "{{--"],
  "warnings": ["%", "{", "(", "}", ")", "$", "'"],
  "methods": [
    "text",
    "placeholder",
    "alt",
    "title",
    "hashtag"
  ],
  "prefix": "{{ trans('auth.",
  "suffix": "') }}",
  "detailed": false,
  "warn_as_Table": false,
  "force": false,
  "log_folder": "hsa/log"
}

I ran replace command and got the result:

Config file used successfully                                                                                                                                                                                                                                                                                        ─╯
Confirm: You have uncommitted changes. Recommended to commit or stash them first. Continue anyway? y/n [yes]: 
y
- You have uncommitted changes, you can use -force parameter in cli or set 'force' to true in config file to avoid confirmation)
panic: regexp: Compile(`\>[^#\_\>\^\*\=\@\\{{--]+[A-Za-z0-9][^#\_\>\^\*\=\@\\{{--]+[^#\_\>\^\*\=\@\\{{--]\<\/(.*)\>`): error parsing regexp: invalid character class range: `{--`

goroutine 1 [running]:
regexp.MustCompile({0xc000220000, 0x5b})
        /usr/local/go/src/regexp/regexp.go:317 +0xbb
github.com/MaestroError/html-strings-affixer/parsehtml.(*Parsehtml).generateRegex(0xc000063e68)
        /home/maestroerror/Desktop/html-strings-affixer/parsehtml/parsehtml.go:309 +0x176
github.com/MaestroError/html-strings-affixer/parsehtml.(*Parsehtml).ExtractText(0xc000063e68)
        /home/maestroerror/Desktop/html-strings-affixer/parsehtml/parsehtml.go:127 +0x85
github.com/MaestroError/html-strings-affixer/parsehtml.(*Parsehtml).ParseFile(0xc000063e68, {0xc00001c2c0?, _}, {{0xc000016210, 0x18}, {0xc000112140, 0x1, 0x4}, {0x654630, 0x0, ...}, ...})
        /home/maestroerror/Desktop/html-strings-affixer/parsehtml/parsehtml.go:49 +0x9a
github.com/MaestroError/html-strings-affixer/app.runReplaceCommand()
        /home/maestroerror/Desktop/html-strings-affixer/app/app.go:180 +0x325
github.com/MaestroError/html-strings-affixer/app.Start()
        /home/maestroerror/Desktop/html-strings-affixer/app/app.go:61 +0x96
main.main()
        /home/maestroerror/Desktop/html-strings-affixer/main.go:19 +0x25

Regex parsed it as regexp: invalid character class range: '{--'.

{{-- Comment --}} is a blade comment syntax. It'll be good to update regex to parse correctly and ignore it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions