HTMLFilter. ¼øÀ§ ¹× ¿ä¾à
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://github.com/samueladam/
HTMLFilter. ű×
HTMLFilter. ¼³¸í
Èò»ö ¸ñ·Ï HTML ÇÊÅÍ HTMLFilter´Â ¸Å¿ì °£´ÜÇÑ Èò»ö ¸ñ·Ï HTML ÇÊÅÍÀÔ´Ï´Ù. Ŭ¶óÀ̾ðÆ® Ãø¸é¿¡¼ WYSIWYG ÆíÁý±â·Î »ç¿ëÇϽʽÿÀ. yousage ::: HTMLFilter °¡Á® ¿À±â htmlfilter htmlter () cleaned_html = hf.filter (dirty_html) ±ÔÄ¢ ÇÊÅÍ´Â ¹Ì¸® Á¤ÀÇ µÈ °ÍÀ¸·Î ³ªÅ¸³³´Ï´Ù. ±ÔÄ¢ÀÇ ÁýÇÕ. http://github.com/samueladam/htmlfilter/blob/master/htmlfilter/rules.pyyou ÀÚ½ÅÀÇ ±ÔÄ¢ ÆÄÀÏÀ» ¸¸µé ¼ö ÀÖ½À´Ï´Ù. # file : my_rules.pytags = { 'a': ( 'href,'name) , 'p': ( 'class',) # ¼Ó¼º µ¥ÀÌÅÍ (tag_attr) def p_class (µ¥ÀÌÅÍ)¿¡¼ ÇÊÅÍ Á¤ÀÇ : µ¥ÀÌÅÍ°¡ ¾Æ´Ñ °æ¿ì ( 'class1', 'class2',) µ¥ÀÌÅÍ = ''¹Ýȯ µ¥ÀÌÅÍ ¹× »ç¿ë ÀÌ ¹æ¹ýÀ¸·Î : HTMLFilter °¡Á® ¿À±â htmlfilterimport my_ruleshf = htmlfilter (rules = my_rules) cleaned_html = hf.filter (dirty_html) ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽ã
HTMLFilter. °ü·Ã ¼ÒÇÁÆ®¿þ¾î