<! -- More --> How is the output summary intercepted?

Source: Internet
Author: User
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 ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.