Browse Source

Merge pull request #394 from bluebirch/fig_captions

Fig captions by @bluebirch
pull/400/head
Dan 5 years ago
committed by GitHub
parent
commit
8ca4b3b625
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      system/includes/functions.php

+ 5
- 0
system/includes/functions.php View File

@ -360,6 +360,11 @@ function get_posts($posts, $page = 1, $perpage = 0)
// Get the contents and convert it to HTML
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
// Convert image tags to figures
if (config('fig.captions') == 'true') {
$post->body = preg_replace( '/<p>(<img .*?alt="(.*?)"\s*\/>)<\/p>/', '<figure>$1<figcaption>$2</figcaption></figure>', $post->body );
}
if (config('views.counter') == 'true') {
$post->views = get_views($post->file);
} else {


Loading…
Cancel
Save