Class: PostsHelper::PostTitleScrubber

Inherits:
Rails::HTML::PermitScrubber
  • Object
show all
Defined in:
/var/apps/qpixel/app/helpers/posts_helper.rb

Instance Method Summary collapse

Constructor Details

#initializePostTitleScrubber

Returns a new instance of PostTitleScrubber.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File '/var/apps/qpixel/app/helpers/posts_helper.rb', line 88

def initialize
  super

  attrs = []
  tags = []

  allowed_types = SiteSetting['AllowedPostTitleFormattingTypes'] || ['code', 'italic', 'keyboard']
  tags.push('del', 'strike') if allowed_types.include?('strikethrough')
  tags << 'code' if allowed_types.include?('code')
  tags << 'kbd' if allowed_types.include?('keyboard')
  tags << 'em' if allowed_types.include?('italic')
  tags << 'strong' if allowed_types.include?('bold')
  tags << 'sub' if allowed_types.include?('subscript')
  tags << 'sup' if allowed_types.include?('superscript')

  self.tags = tags
  self.attributes = attrs
end

Instance Method Details

#skip_node?(node) ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
# File '/var/apps/qpixel/app/helpers/posts_helper.rb', line 107

def skip_node?(node)
  node.text?
end