]> sipb.mit.edu Git - ikiwiki.git/commitdiff
not only markdown adds gunk, so remove it in the main htmlize function
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 9 Jan 2008 19:41:28 +0000 (14:41 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 9 Jan 2008 19:41:28 +0000 (14:41 -0500)
IkiWiki.pm
IkiWiki/Plugin/mdwn.pm
debian/changelog

index d001760a205864aad7ce78c6d799d06444ffbc2a..230170d859e4ec948314b1e1099abe92186f5610 100644 (file)
@@ -624,12 +624,22 @@ sub htmlize ($$$) { #{{{
                error("htmlization of $type not supported");
        }
 
+       my $oneline = $content !~ /\n/;
+
        run_hooks(sanitize => sub {
                $content=shift->(
                        page => $page,
                        content => $content,
                );
        });
+       
+       if ($oneline) {
+               # hack to get rid of enclosing junk added by markdown
+               # and other htmlizers
+               $content=~s/^<p>//i;
+               $content=~s/<\/p>$//i;
+               chomp $content;
+       }
 
        return $content;
 } #}}}
index 1520b3eecc66d96eb7b0da44a441b01bc3fc5ad1..254ab51d03b078afbbeed1727fdb56b18a6c1a1c 100644 (file)
@@ -41,8 +41,6 @@ sub htmlize (@) { #{{{
                require Encode;
        }
        
-       my $oneline = $content !~ /\n/;
-
        # Workaround for perl bug (#376329)
        $content=Encode::encode_utf8($content);
        eval {$content=&$markdown_sub($content)};
@@ -52,13 +50,6 @@ sub htmlize (@) { #{{{
        }
        $content=Encode::decode_utf8($content);
 
-       if ($oneline) {
-               # hack to get rid of enclosing junk added by markdown
-               $content=~s!^<p>!!;
-               $content=~s!</p>$!!;
-               chomp $content;
-       }
-
        return $content;
 } # }}}
 
index ee2ecc4d5cb41e6932853a075b7361f3462d8aae..d115efafcad9601df6923980978d7315bb658f20 100644 (file)
@@ -17,10 +17,10 @@ ikiwiki (2.20) UNRELEASED; urgency=low
   * template: Remove bogus htmlize pass added in 2.16.
   * template: Htmlize template variables, but also provide a raw version
     via `<TMPL_VAR raw_variable>`.
-  * mdwn: When htmlizing text, if it's a single line with no newline,
-    remove the enclosing paragraph and newline markdown wraps it in.
-    This allows removing several hacks around this markdown behavior from
-    other plugins that htmlize fragements of pages.
+  * When htmlizing text, if the input is a single line with no newline,
+    and the htmlizer (such as markdown and textile) generates a html
+    paragraph, remove it. This allows removing several hacks around this
+    markdown behavior from other plugins that htmlize fragements of pages.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 09 Jan 2008 00:34:46 -0500