Excludes some files from linting and deletes redundancies (#6275)
This commit is contained in:
parent
239ab4022c
commit
dea823b6ec
8 changed files with 20 additions and 12 deletions
|
|
@ -30,4 +30,13 @@ linters:
|
|||
Rails/OutputSafety:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- '**/app/views/articles/_block.html.erb'
|
||||
- '**/app/views/feedback_messages/index.html.erb'
|
||||
- '**/app/views/layouts/_styles.html.erb'
|
||||
- '**/app/views/liquid_embeds/show.html.erb'
|
||||
- '**/app/views/moderations/mod.html.erb'
|
||||
- '**/app/views/pages/live.html.erb'
|
||||
- '**/app/views/pages/onboarding.html.erb'
|
||||
- '**/app/views/partnerships/show.html.erb'
|
||||
- '**/app/views/partnerships/index.html.erb'
|
||||
- '**/app/views/pro_memberships/show.html.erb'
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def sanitize_rendered_markdown(processed_html)
|
||||
ActionController::Base.helpers.sanitize processed_html.html_safe,
|
||||
ActionController::Base.helpers.sanitize processed_html,
|
||||
scrubber: RenderedMarkdownScrubber.new
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class MarkdownParser
|
|||
allowed_tags = %w[strong abbr aside em p h1 h2 h3 h4 h5 h6 i u b code pre
|
||||
br ul ol li small sup sub img a span hr blockquote kbd]
|
||||
allowed_attributes = %w[href strong em ref rel src title alt class]
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content).html_safe,
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content),
|
||||
tags: allowed_tags,
|
||||
attributes: allowed_attributes
|
||||
end
|
||||
|
|
@ -58,7 +58,7 @@ class MarkdownParser
|
|||
markdown = Redcarpet::Markdown.new(renderer, REDCARPET_CONFIG)
|
||||
allowed_tags = %w[strong i u b em p br code]
|
||||
allowed_attributes = %w[href strong em ref rel src title alt class]
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content).html_safe,
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content),
|
||||
tags: allowed_tags,
|
||||
attributes: allowed_attributes
|
||||
end
|
||||
|
|
@ -70,7 +70,7 @@ class MarkdownParser
|
|||
markdown = Redcarpet::Markdown.new(renderer, REDCARPET_CONFIG)
|
||||
allowed_tags = %w[strong i u b em code]
|
||||
allowed_attributes = %w[href strong em ref rel src title alt class]
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content).html_safe,
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content),
|
||||
tags: allowed_tags,
|
||||
attributes: allowed_attributes
|
||||
end
|
||||
|
|
@ -83,7 +83,7 @@ class MarkdownParser
|
|||
allowed_tags = %w[strong abbr aside em p h4 h5 h6 i u b code pre
|
||||
br ul ol li small sup sub a span hr blockquote kbd]
|
||||
allowed_attributes = %w[href strong em ref rel src title alt class]
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content).html_safe,
|
||||
ActionController::Base.helpers.sanitize markdown.render(@content),
|
||||
tags: allowed_tags,
|
||||
attributes: allowed_attributes
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,11 +26,10 @@ class DisplayAd < ApplicationRecord
|
|||
renderer = Redcarpet::Render::HTMLRouge.new(hard_wrap: true, filter_html: false)
|
||||
markdown = Redcarpet::Markdown.new(renderer)
|
||||
initial_html = markdown.render(body_markdown)
|
||||
|
||||
# Temporarily disable the sanitisation in order to launch the SheCoded Campaign.
|
||||
# TODO: [@thepracticaldev/cool] find an alternate solution.
|
||||
|
||||
# stripped_html = ActionController::Base.helpers.sanitize initial_html.html_safe,
|
||||
# stripped_html = ActionController::Base.helpers.sanitize initial_html,
|
||||
# tags: %w[a em i b u br img h1 h2 h3 h4 div style],
|
||||
# attributes: %w[href target src height width style]
|
||||
stripped_html = initial_html.html_safe
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ xml.rss version: "2.0" do
|
|||
xml.pubDate article.published_at.to_s(:rfc822) if article.published_at
|
||||
xml.link "https://dev.to#{article.path}"
|
||||
xml.guid "https://dev.to#{article.path}"
|
||||
xml.description sanitize article.processed_html.html_safe,
|
||||
xml.description sanitize article.processed_html,
|
||||
tags: %w[strong em a table tbody thead tfoot th tr td col colgroup del p h1 h2 h3 h4 h5 h6 blockquote iframe time div span i em u b ul ol li dd dl dt q code pre img sup cite center br small],
|
||||
attributes: %w[href strong em class ref rel src title alt colspan height width size rowspan span value start data-conversation data-lang id]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
<% if @commentable.processed_html.present? %>
|
||||
<% if @commentable.processed_html.size < 350 %>
|
||||
<div class="body">
|
||||
<%= sanitize_rendered_markdown(@commentable.processed_html.html_safe) %>
|
||||
<%= sanitize_rendered_markdown(@commentable.processed_html) %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="body">
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
<%= sanitize comment.processed_html.html_safe,
|
||||
<%= sanitize comment.processed_html,
|
||||
tags: %w[strong em p h1 h2 h3 h4 h5 h6 i u b code pre br ul ol li small sup img a span hr blockquote],
|
||||
attributes: %w[href strong em ref rel src title alt class] %>
|
||||
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@
|
|||
<div class="container">
|
||||
<div class="body">
|
||||
<% if @episode.podcast.feed_url.include?("soundcloud") %>
|
||||
<%= simple_format((@episode.processed_html || @episode.body).html_safe, sanitize: true) %>
|
||||
<%= simple_format((@episode.processed_html || @episode.body), sanitize: true) %>
|
||||
<% else %>
|
||||
<%= sanitize (@episode.processed_html || "").html_safe,
|
||||
<%= sanitize (@episode.processed_html || ""),
|
||||
tags: %w[strong br em a table tbody thead tfoot th tr td col colgroup del p h1 h2 h3 h4 h5 h6 blockquote time div span i em u b ul ol li dd dl dt q code pre img sup cite center small],
|
||||
attributes: %w[href strong em class ref rel src title alt colspan height width size rowspan span value start data-conversation data-lang id] %>
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue