Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Classic raw rule bug #12

Closed
EmranMR opened this issue Jul 3, 2023 · 5 comments
Closed

Classic raw rule bug #12

EmranMR opened this issue Jul 3, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@EmranMR
Copy link
Owner

EmranMR commented Jul 3, 2023

There is bug that the parser does not pick up $._classic_raw

<?php

echo 'test'

?>
@EmranMR EmranMR added the bug Something isn't working label Jul 3, 2023
@calebdw
Copy link
Contributor

calebdw commented Jul 5, 2023

I don't think this parser should worry about raw PHP tags...anything that uses raw php can be updated to use what blade uses:

@php(...)

// or

@php
...
@endphp

@EmranMR EmranMR closed this as completed in b3f1845 Jul 5, 2023
@EmranMR
Copy link
Owner Author

EmranMR commented Jul 5, 2023

I don't think this parser should worry about raw PHP tags...anything that uses raw php can be updated to use what blade uses:

@php(...)

// or

@php
...
@endphp

@calebdw I do agree with you , but considering that technically it is possible to still write php inside <?php ?> in the .blade.php, I thought to just add the support anyways to cover all the bases.

As much as I hope no one ever need to use this feature, you never know what people get up to out there 😂 🤷‍♂️

@calebdw
Copy link
Contributor

calebdw commented Jul 5, 2023

I see your point, but at the same time 1) I think it's going to add unnecessary complexity and 2) this a Blade parser and the Blade templating engine does not do anything with raw php.

Once you open that can of worms then you would also need to support echo tags (<?= ?>), and short tags (<? ?>)

The best thing would probably be to update the html node to just be text (like the php parser) and then update the injection to inject php instead of html, the php parser will take care of parsing the tags and html:

((html) @injection.content
    (#set! injection.combined)
    (#set! injection.language html))

; would be

((text) @injection.content
    (#set! injection.combined)
    (#set! injection.language php))

It's up to you, but I would not support it myself...

@EmranMR
Copy link
Owner Author

EmranMR commented Jul 5, 2023

I see your point, but at the same time 1) I think it's going to add unnecessary complexity and 2) this a Blade parser and the Blade templating engine does not do anything with raw php.

Once you open that can of worms then you would also need to support echo tags (<?= ?>), and short tags (<? ?>)

The best thing would probably be to update the html node to just be text (like the php parser) and then update the injection to inject php instead of html, the php parser will take care of parsing the tags and html:

((html) @injection.content
    (#set! injection.combined)
    (#set! injection.language html))

; would be

((text) @injection.content
    (#set! injection.combined)
    (#set! injection.language php))

It's up to you, but I would not support it myself...

@calebdw That is actually a superb idea!! 🙏
Never thought about it this way, I am still stuck confused with the idea of html vs php injection!

The beauty is we can even go ahead and just do this, while waiting for the split parser.

@EmranMR EmranMR reopened this Jul 5, 2023
@EmranMR
Copy link
Owner Author

EmranMR commented Jul 5, 2023

merging to #16

@EmranMR EmranMR closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants