diff options
author | Nick Thomas <nick@gitlab.com> | 2016-10-06 23:01:42 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-10-07 02:54:26 +0100 |
commit | 9920551536bb4f78dffeaaf3a194b92f54c34a47 (patch) | |
tree | dad5b2d5f1b725e66d29d355c5095b6899546427 /lib | |
parent | dd159a750b294ee89cb8a4143284ff9788b639fc (diff) | |
download | gitlab-ce-9920551536bb4f78dffeaaf3a194b92f54c34a47.tar.gz |
Enable CacheMarkdownField for the remaining models
This commit alters views for the following models to use the markdown cache if
present:
* AbuseReport
* Appearance
* ApplicationSetting
* BroadcastMessage
* Group
* Issue
* Label
* MergeRequest
* Milestone
* Project
At the same time, calls to `escape_once` have been moved into the `single_line`
Banzai pipeline, so they can't be missed out by accident and the work is done
at save, rather than render, time.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/html_entity_filter.rb | 12 | ||||
-rw-r--r-- | lib/banzai/pipeline/single_line_pipeline.rb | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/banzai/filter/html_entity_filter.rb b/lib/banzai/filter/html_entity_filter.rb new file mode 100644 index 00000000000..4ef8b3b6dcf --- /dev/null +++ b/lib/banzai/filter/html_entity_filter.rb @@ -0,0 +1,12 @@ +require 'erb' + +module Banzai + module Filter + # Text filter that escapes these HTML entities: & " < > + class HTMLEntityFilter < HTML::Pipeline::TextFilter + def call + ERB::Util.html_escape(text) + end + end + end +end diff --git a/lib/banzai/pipeline/single_line_pipeline.rb b/lib/banzai/pipeline/single_line_pipeline.rb index ba2555df98d..30bc035d085 100644 --- a/lib/banzai/pipeline/single_line_pipeline.rb +++ b/lib/banzai/pipeline/single_line_pipeline.rb @@ -3,6 +3,7 @@ module Banzai class SingleLinePipeline < GfmPipeline def self.filters @filters ||= FilterArray[ + Filter::HTMLEntityFilter, Filter::SanitizationFilter, Filter::EmojiFilter, |