File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -294,9 +294,9 @@ protected function update_post_from_markdown_source( $post_id ) {
294294}
295295
296296$ title = null ;
297- if ( preg_match ( '/^\n*#\s(. +)/ ' , $ markdown , $ matches ) ) {
297+ if ( preg_match ( '/^\n*#\s([^\n] +)/ ' , $ markdown , $ matches ) ) {
298298$ title = $ matches [1 ];
299- $ markdown = preg_replace ( '/^\n*#\s(. +)/ ' , '' , $ markdown );
299+ $ markdown = preg_replace ( '/^\n*#\s([\n] +)/ ' , '' , $ markdown );
300300}
301301// Allow YAML override.
302302if ( isset ( $ yaml ['title ' ] ) ) {
@@ -306,9 +306,8 @@ protected function update_post_from_markdown_source( $post_id ) {
306306
307307// Steal the first sentence as the excerpt
308308$ excerpt = '' ;
309- if ( preg_match ( '/^(.+)/ ' , $ markdown , $ matches ) ) {
310- $ excerpt = $ matches [1 ];
311- $ markdown = preg_replace ( '/^(.+)/ ' , '' , $ markdown );
309+ if ( preg_match ( '/^([^\.]+)[\s$]/m ' , $ markdown , $ matches ) ) {
310+ $ excerpt = $ matches [1 ];
312311}
313312
314313// Transform to HTML and save the post
You can’t perform that action at this time.
0 commit comments