mirror of
https://ghproxy.net/https://github.com/wp-cli/scaffold-package-command.git
synced 2025-10-04 20:37:33 +08:00
Render Mustache templates at remote URLs
This commit is contained in:
parent
3725e76989
commit
bfd80eb2d3
1 changed files with 8 additions and 1 deletions
|
@ -286,7 +286,14 @@ class ScaffoldPackageCommand {
|
|||
$v = $composer_obj['extras']['readme'][ $section][ $k ];
|
||||
if ( false !== stripos( $v, '://' ) ) {
|
||||
$response = Utils\http_request( 'GET', $v );
|
||||
$v = $response->body;
|
||||
if ( preg_match( $ext_regex, $v ) ) {
|
||||
$m = new \Mustache_Engine( array(
|
||||
'escape' => function ( $val ) { return $val; }
|
||||
) );
|
||||
$v = $m->render( $response->body, $readme_args );
|
||||
} else {
|
||||
$v = $response->body;
|
||||
}
|
||||
} else if ( preg_match( $ext_regex, $v ) ) {
|
||||
$v = $package_dir . '/' . $v;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue