小编kee*_*ron的帖子

使用nokogiri剥离样式属性

我正在使用nokogiri删除一个html页面,我想删除所有样式属性.
我怎样才能做到这一点?(我不使用rails所以我不能使用它的清理方法,我不想使用sanitize gem'因为我想黑名单删除而不是白名单)

html = open(url)
doc = Nokogiri::HTML(html.read)
doc.css('.post').each do |post|
puts post.to_s
end

=> <p><span style="font-size: x-large">bla bla <a href="http://torrentfreak.com/netflix-is-killing-bittorrent-in-the-us-110427/">statistica</a> blabla</span></p>
Run Code Online (Sandbox Code Playgroud)

我想要它

=> <p><span>bla bla <a href="http://torrentfreak.com/netflix-is-killing-bittorrent-in-the-us-110427/">statistica</a> blabla</span></p>
Run Code Online (Sandbox Code Playgroud)

html sanitize nokogiri

16
推荐指数
2
解决办法
1万
查看次数

如何将封闭的源库发布到jCenter?

是否可以将私有SDK发布到jCenter?我已经设置了所有内容,上传到bintray工作正常,但我想发布.aar库,但不是java文档和java源代码.

我已经看到一些库上传了一个空的javadoc.jar和sources.jar,我如何用gradle实现这一点?

maven android-gradle-plugin jcenter

7
推荐指数
1
解决办法
1279
查看次数