Author | SHA1 | Message | Date |
---|---|---|---|
Masayoshi Sekimura | e80b6debba | added discount.patch and call mkd_shlib_destructor if with_html5 option is disabled | 11 years ago |
Masayoshi Sekimura | 2fd73a236a | API desigin review for with_html5 option | 11 years ago |
@ -0,0 +1,27 @@ | |||
--- discount/html5.c.orig 2013-08-05 12:24:40.000000000 -0700 | |||
+++ discount/html5.c 2013-08-05 12:25:02.000000000 -0700 | |||
@@ -3,11 +3,11 @@ | |||
#include "tags.h" | |||
void | |||
-mkd_with_html5_tags() | |||
+mkd_with_html5_tags(int force) | |||
{ | |||
static int populated = 0; | |||
- if ( populated ) return; | |||
+ if ( populated && !force ) return; | |||
populated = 1; | |||
mkd_define_tag("ASIDE", 0); | |||
--- discount/tags.c.orig 2013-08-05 12:24:40.000000000 -0700 | |||
+++ discount/tags.c 2013-08-05 12:25:02.000000000 -0700 | |||
@@ -26,6 +26,8 @@ | |||
* either the standard or extra tag tables. | |||
*/ | |||
if ( !(p = mkd_search_tags(id, strlen(id))) ) { | |||
+ if ( S(extratags) == 0 ) | |||
+ CREATE(extratags); | |||
p = &EXPAND(extratags); | |||
p->id = id; | |||
p->size = strlen(id); |
@ -0,0 +1,35 @@ | |||
use strict; | |||
use warnings; | |||
use utf8; | |||
use Test::More tests => 6; | |||
use Text::Markdown::Discount; | |||
is( | |||
strip(Text::Markdown::Discount::markdown("<section>foo</section>", undef, {with_html5 => 0})), | |||
"<p><section>foo</section></p>"); | |||
is( | |||
strip(Text::Markdown::Discount::markdown("<section>foo</section>", undef, {with_html5 => 1})), | |||
"<section>foo</section>"); | |||
is( | |||
strip(Text::Markdown::Discount::markdown("<section>foo</section>", undef, {with_html5 => 0})), | |||
"<p><section>foo</section></p>"); | |||
is( | |||
strip(Text::Markdown::Discount->new()->markdown("<section>foo</section>", undef, {with_html5 => 0})), | |||
"<p><section>foo</section></p>"); | |||
is( | |||
strip(Text::Markdown::Discount->new()->markdown("<section>foo</section>", undef, {with_html5 => 1})), | |||
"<section>foo</section>"); | |||
is( | |||
strip(Text::Markdown::Discount->new()->markdown("<section>foo</section>", undef, {with_html5 => 0})), | |||
"<p><section>foo</section></p>"); | |||
sub strip { | |||
my $str = shift; | |||
$str =~ s/\s*//g; | |||
return $str; | |||
} |