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

Support specifying both PHP and JS code in code blocks #5

Closed
wants to merge 4 commits into from

Conversation

nylen
Copy link

@nylen nylen commented Jun 13, 2017

The original php-pegjs requires specifying all code inside code blocks as PHP. However, for WordPress/gutenberg we want to use the same PEG in both PHP and JS code (see WordPress/gutenberg#1086).

Accordingly, this PR adds the capability to specify both PHP and JS code in the same code block, using a syntax that is ignored by normal PEG.js, as follows:

{
  /** <?php return $a; ?> **/
  return a;
}

This PR also fixes an instance of void 0 being inserted into the generated PHP code. Elsewhere in generate-bytecode-php.js this is null instead, so the same change has been made here.

@nylen
Copy link
Author

nylen commented Jun 14, 2017

@Nordth I am interested in maintaining this library because we'd like to use it in the WordPress project referenced above. Thoughts on this PR and on subsequent changes we will need? (Currently, add an option to avoid PHP namespaces; see WordPress/gutenberg#1152 for details)

@nylen
Copy link
Author

nylen commented Jul 6, 2017

I've proceeded with this work at https://github.com/nylen/phpegjs.

@Nordth
Copy link
Owner

Nordth commented Aug 10, 2017

Thanks for sharing! I will recomend to use your fork, because have no time to maintain this project for now

@nylen nylen closed this Aug 10, 2017
@nylen nylen deleted the add/php-blocks branch August 10, 2017 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants