Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use md_extra

  • Loading branch information...
commit de3c605be5a2f089f14ca8a9eb20cbc3517dedd8 1 parent a522b2b
Ben Balter authored
Showing with 2 additions and 39 deletions.
  1. +2 −39 jekyll-export.php
41 jekyll-export.php
View
@@ -168,13 +168,12 @@ function convert_terms( $post ) {
function convert_posts() {
foreach ( $this->get_posts() as $postID ) {
- $md = new Markdownify( null, false, $this->extra_html_include );
+ $md = new Markdownify_Extra( null, false, $this->extra_html_include );
$post = get_post( $postID );
$meta = array_merge( $this->convert_meta( $post ), $this->convert_terms( $postID ) );
$output = Spyc::YAMLDump($meta);
$output .= "---\n";
- $body = $md->parseString( apply_filters( 'the_content', $post->post_content ) );
- $output .= $this->convert_links( $body );
+ $output .= $md->parseString( apply_filters( 'the_content', $post->post_content ) );
$this->write( $output, $post );
}
@@ -414,42 +413,6 @@ function copy_recursive($source, $dest) {
}
- /**
- * Manually convert links to markdown because markdownify does it in a really strange way
- */
- function convert_links( $body ) {
-
- //disabeled for now
- return $body;
-
- //links = in body, footnotes = below body
- preg_match_all( '/\[([^\]]+?)\]\[([0-9]+)\]/', $body, $links, PREG_SET_ORDER );
- preg_match_all( '/\[([0-9]+)\]: (.+)/', $body, $footnotes, PREG_SET_ORDER );
-
- $find = array();
- $replace = array();
-
- //build find and replace array
- foreach ( $links as $key => $link ) {
-
- $find[] = '#' . preg_quote( $link[0], '#' ) . '#';
- $replace[] = "[{$link[1]}]({$footnotes[$key][2]})";
- }
-
- //clear out footnotes
- foreach ( $footnotes as $footnote ) {
-
- $find[] = '#' . preg_quote( $footnote[0], '#' ) . '#';
- $replace[] = '';
-
- }
-
- $body = trim( preg_replace( $find, $replace, $body ) );
-
- return $body;
-
- }
-
}
Please sign in to comment.
Something went wrong with that request. Please try again.