Skip to content

Inline value is not fully #120

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

Closed
alexander-akait opened this issue Feb 21, 2018 · 3 comments
Closed

Inline value is not fully #120

alexander-akait opened this issue Feb 21, 2018 · 3 comments
Assignees

Comments

@alexander-akait
Copy link
Collaborator

Seems it is bug. Inline value don't contain first newline which following after ?> tag
Input:

function bar() {
  ?>
  <span>Hello World!</span>
  <?php
}

Contain: value: ' <span>Hello World!</span>\n '. BAD (should be value: '\n <span>Hello World!</span>\n ')

Input:

function inline() {
  ?><span>Hello World!</span><?php
}

Contain: value: '<span>Hello World!</span>'. GOOD

Input:

function foo() {
    ?>
    <span>Hello World!</span>
    <?php
}

Contain: value: ' <span>Hello World!</span>\n '. BAD (should be value: '\n <span>Hello World!</span>\n ')

@ichiriac
Copy link
Member

Hi, it's not really a bug, as it mimics PHP output behavior based on lexer tokens (strictly the same as php token_get_all).

I'm not sure to understand why PHP do this (maybe something related with indenting outputs), but I'm totally agree with you, it introduce information loss.

I will not change the lexer as it's supposed to work as PHP, but I could fix it from AST and revert back the missing line break.

@alexander-akait
Copy link
Collaborator Author

@ichiriac

I will not change the lexer as it's supposed to work as PHP, but I could fix it from AST and revert back the missing line break.

Will be great!

@ichiriac ichiriac self-assigned this Feb 26, 2018
ichiriac added a commit that referenced this issue Mar 5, 2018
@ichiriac
Copy link
Member

ichiriac commented Mar 5, 2018

fixed with the raw attribute

@ichiriac ichiriac closed this as completed Mar 5, 2018
@ichiriac ichiriac added this to the 3.0.0 milestone Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants