Skip to content

Commit

Permalink
Merge pull request #562 from humanmade/spyc-problem
Browse files Browse the repository at this point in the history
Ensure Spyc is available
  • Loading branch information
mikelittle authored Mar 7, 2024
2 parents 2a6d687 + 6ba5945 commit 33e574e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ function parse_file( string $file, string $root ) : Page {
$meta = [];
preg_match( '#^---(.+)---\n+#Us', $raw, $yaml_matches );
if ( $yaml_matches ) {
// This library seems to have problems with its autoload configuration
// sometimes so we need to ensure it's available.
if ( ! class_exists( 'Spyc' ) ) {
require_once Altis\ROOT_DIR . '/vendor/mustangostang/spyc/Spyc.php';
}
$meta = Spyc::YAMLLoadString( $yaml_matches[1] );
// Strip YAML doc from the header.
$raw = substr( $raw, strlen( $yaml_matches[0] ) );
Expand Down

0 comments on commit 33e574e

Please sign in to comment.