slartyblartfast (slartyblartfast) wrote in changelog,
slartyblartfast
slartyblartfast
changelog

[ljcom] r7135: LJGI-33: Don't cut off some tags.

Committer: mchernyshev
LJGI-33: Don't cut off some tags.

U   trunk/htdocs/gadgets/friends.bml
Modified: trunk/htdocs/gadgets/friends.bml
===================================================================
--- trunk/htdocs/gadgets/friends.bml	2009-03-18 04:46:03 UTC (rev 7134)
+++ trunk/htdocs/gadgets/friends.bml	2009-03-18 08:58:54 UTC (rev 7135)
@@ -56,10 +56,36 @@
             }
         }
 
-        # Remove all tags.
-        $h{text} =~ s!\<[^/]*/\>! !ig;  # <tag />
-        $h{text} =~ s!\<[^\>]*\>! !ig;  # <tag> </tag>
+        my @tags_close = qw(
+            a sub sup xmp bdo q span
+            b i u tt s strike big small font
+            abbr acronym cite code dfn em kbd samp strong var del ins
+            h1 h2 h3 h4 h5 h6 div blockquote address pre center
+            ul ol li dl dt dd
+            colgroup caption
+            marquee area map form textarea blink
+            img br hr p col
+        );
 
+        my @tags_eat = qw(head title style layer iframe applet object xml param
+            table tr td th tbody tfoot thead
+        );
+
+        my @tags_remove = qw(table bgsound embed object link body meta noscript plaintext noframes
+        );
+
+        LJ::CleanHTML::clean(\$h{text}, {
+            'linkify' => 1,
+            'wordlength' => 40,
+            'eat' => \@tags_eat,
+            'undefined_tags' => 'eat',
+            'remove' => \@tags_remove,
+            'autoclose' => \@tags_close,
+            'cleancss' => 1,
+            'noearlyclose' => 1,
+            'tablecheck' => 1,
+        });
+
         # trim text
         my $trunc = LJ::text_trim($h{text}, 640, 320);
         if ($h{text} ne $trunc) {

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments