From 24d4fdea24e4e0d9637d4606b9631fe7f4388480 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 4 Dec 2018 14:43:28 -0800 Subject: [PATCH] Allow for readme.md file to have a title different than readme.txt --- class-wordpress-readme-parser.php | 2 +- generate-markdown-readme | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/class-wordpress-readme-parser.php b/class-wordpress-readme-parser.php index d334479..26c5e94 100644 --- a/class-wordpress-readme-parser.php +++ b/class-wordpress-readme-parser.php @@ -173,7 +173,7 @@ function ( $tag ) { // Render metadata $markdown = "\n"; - $markdown .= sprintf( "# %s\n", $this->title ); + $markdown .= sprintf( "# %s\n", empty( $params['title'] ) ? $this->title : $params['title'] ); $markdown .= "\n"; if ( file_exists( $params['assets_dir'] . '/banner-1544x500.png' ) ) { $markdown .= "![Banner]({$params['assets_dir']}/banner-1544x500.png)"; diff --git a/generate-markdown-readme b/generate-markdown-readme index e7269d1..da99c4d 100755 --- a/generate-markdown-readme +++ b/generate-markdown-readme @@ -75,6 +75,9 @@ try { } } + if ( isset( $env_vars['README_MD_TITLE'] ) ) { + $md_args['title'] = $env_vars['README_MD_TITLE']; + } if ( isset( $env_vars['COVERALLS_BADGE'] ) ) { $coveralls_badge = $env_vars['COVERALLS_BADGE']; }