When the output is saved in html format, & amp; lt ;! -- More -- & amp; gt; ends the output and only outputs the abstract. This & amp; lt ;! -- More -- & amp; gt; how to integrate it... when the article is saved in html format
In this case Only the abstract is output.
When the document is saved in Markdown format
You can use Python Markdown to save the original user input data. How should we integrate it into the output? when this mark is output, it is terminated and only the abstract is output.
I hope someone can explain to me how this principle is implemented? What function methods are required?
Reply content: when the document is saved in html format
In this case Only the abstract is output.
When the document is saved in Markdown format
You can use Python Markdown to save the original user input data. How should we integrate it into the output? when this mark is output, it is terminated and only the abstract is output.
I hope someone can explain to me how this principle is implemented? What function methods are required?
Let's show you the nasty wordpress code.
function get_extended($post) {//Match the new style more linksif ( preg_match('/
/', $post, $matches) ) {list($main, $extended) = explode($matches[0], $post, 2);$more_text = $matches[1];} else {$main = $post;$extended = '';$more_text = '';}// Strip leading and trailing whitespace$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);$more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );}
Wordpress code @ kankana has been pasted, so some implementation methods are provided.
Javascript version
'Body content
Truncation more content '. split ('
') [0];
Return 'body content'
Php
$ Errrr = explode ('
',' Body content
Truncation more content '); echo $ errrr [0]
Output 'body content'
Lz is want to use jekyll, you can try postmore. rb this plugin, create a Liquid filter to filter out do not need realistic content, details please slam the https://github.com/tokkonopapa/jekyll ....