mirror of
https://github.com/captn3m0/news.git
synced 2024-09-20 00:57:02 +00:00
Fix sanitizer to drop <b>
This commit is contained in:
parent
513810453e
commit
d1bf7108d2
@ -5,6 +5,18 @@ require 'net/http'
|
|||||||
require 'set'
|
require 'set'
|
||||||
require 'date'
|
require 'date'
|
||||||
|
|
||||||
|
SANITIZE_CONFIG = {
|
||||||
|
:elements => ['a', 'span', 'p', 'i', 'br'],
|
||||||
|
|
||||||
|
:attributes => {
|
||||||
|
'a' => ['href', 'title']
|
||||||
|
},
|
||||||
|
|
||||||
|
:protocols => {
|
||||||
|
'a' => {'href' => ['http', 'https']}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class PageWithoutAFile < Jekyll::Page
|
class PageWithoutAFile < Jekyll::Page
|
||||||
def read_yaml(*)
|
def read_yaml(*)
|
||||||
@data ||= {}
|
@data ||= {}
|
||||||
@ -74,7 +86,7 @@ class BeatrootNews < Jekyll::Generator
|
|||||||
html = "<p><b>#{article['trigger_warning_text']}</b></p>" + html
|
html = "<p><b>#{article['trigger_warning_text']}</b></p>" + html
|
||||||
end
|
end
|
||||||
|
|
||||||
file.content = Sanitize.fragment(html, Sanitize::Config::BASIC)
|
file.content = Sanitize.fragment(html, SANITIZE_CONFIG)
|
||||||
|
|
||||||
date = timestamp(article['updated_on'])
|
date = timestamp(article['updated_on'])
|
||||||
file.data.merge!(
|
file.data.merge!(
|
||||||
|
Loading…
Reference in New Issue
Block a user