Skip to content

Blade comment syntax not supported. #5

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
dima2306 opened this issue Mar 22, 2023 · 2 comments
Closed

Blade comment syntax not supported. #5

dima2306 opened this issue Mar 22, 2023 · 2 comments

Comments

@dima2306
Copy link

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.

@MaestroError
Copy link
Owner

Thank you @dima2306 for the feedback, I will note and fix it for the new release 👍

@MaestroError
Copy link
Owner

In the ignore and warnings configuration isn't allowed a group of characters, as it seems, it works only with the single characters. Already noted in Docs ✔️

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants