def post_get_description(s): """Return description of a content.""" content_bbcode = BBCodeParser(s) if len(content_bbcode.get_all_paragraphs()) > 0: content_bbcode = content_bbcode.bbcode_to_html( content_bbcode.get_all_paragraphs()[0]) content_bbcode = '<p>' + content_bbcode + '</p>' elif len(content_bbcode.get_all_pictures()) > 0: content_bbcode = content_bbcode.get_all_pictures()[0] content_bbcode = '<p>' + '<img src="' + content_bbcode[ 1] + '" alt="' + content_bbcode[0] + '">' + '</p>' elif len(content_bbcode.get_all_youtube()) > 0: video_id = content_bbcode.get_all_youtube()[0] content_bbcode = '<div class="video-wrapper"><div class="video-container">' content_bbcode += '<iframe src="http://www.youtube.com/embed/' + video_id content_bbcode += '" width="600" height="361" frameborder="0" allowFullScreen></iframe>' content_bbcode += '</div></div>' elif len(content_bbcode.get_all_vimeo()) > 0: video_id = content_bbcode.get_all_vimeo()[0] content_bbcode = '<div class="video-wrapper"><div class="video-container">' content_bbcode += '<iframe src="http://player.vimeo.com/video/' + video_id content_bbcode += '?byline=0&portrait=0" width="600" height="361" frameborder="0" allowFullScreen></iframe>' content_bbcode += '</div></div>' else: content_bbcode = '<p><em>There isn\'t description for this blog post.</em></p>' return content_bbcode
def post_get_description(s): """Return description of a content.""" content_bbcode = BBCodeParser(s) if len(content_bbcode.get_all_paragraphs()) > 0: content_bbcode = content_bbcode.bbcode_to_html(content_bbcode.get_all_paragraphs()[0]) content_bbcode = '<p>' + content_bbcode + '</p>' elif len(content_bbcode.get_all_pictures()) > 0: content_bbcode = content_bbcode.get_all_pictures()[0] content_bbcode = '<p>' + '<img src="' + content_bbcode[1] + '" alt="' + content_bbcode[0] + '">' + '</p>' elif len(content_bbcode.get_all_youtube()) > 0: video_id = content_bbcode.get_all_youtube()[0] content_bbcode = '<div class="video-wrapper"><div class="video-container">' content_bbcode += '<iframe src="http://www.youtube.com/embed/' + video_id content_bbcode += '" width="600" height="361" frameborder="0" allowFullScreen></iframe>' content_bbcode += '</div></div>' elif len(content_bbcode.get_all_vimeo()) > 0: video_id = content_bbcode.get_all_vimeo()[0] content_bbcode = '<div class="video-wrapper"><div class="video-container">' content_bbcode += '<iframe src="http://player.vimeo.com/video/' + video_id content_bbcode += '?byline=0&portrait=0" width="600" height="361" frameborder="0" allowFullScreen></iframe>' content_bbcode += '</div></div>' else: content_bbcode = '<p><em>There isn\'t description for this blog post.</em></p>' return content_bbcode