@@ -168,13 +168,12 @@ function convert_terms( $post ) {
168
168
function convert_posts () {
169
169
170
170
foreach ( $ this ->get_posts () as $ postID ) {
171
- $ md = new Markdownify ( null , false , $ this ->extra_html_include );
171
+ $ md = new Markdownify_Extra ( null , false , $ this ->extra_html_include );
172
172
$ post = get_post ( $ postID );
173
173
$ meta = array_merge ( $ this ->convert_meta ( $ post ), $ this ->convert_terms ( $ postID ) );
174
174
$ output = Spyc::YAMLDump ($ meta );
175
175
$ output .= "--- \n" ;
176
- $ body = $ md ->parseString ( apply_filters ( 'the_content ' , $ post ->post_content ) );
177
- $ output .= $ this ->convert_links ( $ body );
176
+ $ output .= $ md ->parseString ( apply_filters ( 'the_content ' , $ post ->post_content ) );
178
177
$ this ->write ( $ output , $ post );
179
178
}
180
179
@@ -414,42 +413,6 @@ function copy_recursive($source, $dest) {
414
413
415
414
}
416
415
417
- /**
418
- * Manually convert links to markdown because markdownify does it in a really strange way
419
- */
420
- function convert_links ( $ body ) {
421
-
422
- //disabeled for now
423
- return $ body ;
424
-
425
- //links = in body, footnotes = below body
426
- preg_match_all ( '/\[([^\]]+?)\]\[([0-9]+)\]/ ' , $ body , $ links , PREG_SET_ORDER );
427
- preg_match_all ( '/\[([0-9]+)\]: (.+)/ ' , $ body , $ footnotes , PREG_SET_ORDER );
428
-
429
- $ find = array ();
430
- $ replace = array ();
431
-
432
- //build find and replace array
433
- foreach ( $ links as $ key => $ link ) {
434
-
435
- $ find [] = '# ' . preg_quote ( $ link [0 ], '# ' ) . '# ' ;
436
- $ replace [] = "[ {$ link [1 ]}]( {$ footnotes [$ key ][2 ]}) " ;
437
- }
438
-
439
- //clear out footnotes
440
- foreach ( $ footnotes as $ footnote ) {
441
-
442
- $ find [] = '# ' . preg_quote ( $ footnote [0 ], '# ' ) . '# ' ;
443
- $ replace [] = '' ;
444
-
445
- }
446
-
447
- $ body = trim ( preg_replace ( $ find , $ replace , $ body ) );
448
-
449
- return $ body ;
450
-
451
- }
452
-
453
416
}
454
417
455
418
0 commit comments