Skip to content

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

Closed
nylen wants to merge 4 commits intoNordth:masterfrom
nylen:add/php-blocks
Closed

Support specifying both PHP and JS code in code blocks#5
nylen wants to merge 4 commits intoNordth:masterfrom
nylen:add/php-blocks

Conversation

@nylen
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
Author

nylen commented Jul 6, 2017

@Nordth
Copy link
Copy Markdown
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