zoukankan      html  css  js  c++  java
  • rails过滤html

    strip_links(html)

    Strips all link tags from text leaving just the link text.

    Examples

      strip_links('<a href="http://www.rubyonrails.org">Ruby on Rails</a>')
      # => Ruby on Rails
    
      strip_links('Please e-mail me at <a href="mailto:me@email.com">me@email.com</a>.')
      # => Please e-mail me at me@email.com.
    
      strip_links('Blog: <a href="http://www.myblog.com/" class="nav" target=\"_blank\">Visit</a>.')
      # => Blog: Visit
    strip_tags(html)

    Strips all HTML tags from the html, including comments. This uses the html-scanner tokenizer and so its HTML parsing ability is limited by that of html-scanner.

    Examples

      strip_tags("Strip <i>these</i> tags!")
      # => Strip these tags!
    
      strip_tags("<b>Bold</b> no more!  <a href='more.html'>See more here</a>...")
      # => Bold no more!  See more here...
    
      strip_tags("<div id='top-bar'>Welcome to my website!</div>")
      # => Welcome to my website!

  • 相关阅读:
    spring注入原型bean
    按时间间隔查询
    Qconf安装文档
    HttpEnum
    MyIfmHttpClient
    enum StatCode
    Linux修改war包中文件
    maven settings.xml windows
    maven settings.xml linux
    docker报错
  • 原文地址:https://www.cnblogs.com/lexus/p/1885768.html
Copyright © 2011-2022 走看看