strip syntax for meta description tag
This commit is contained in:
@@ -323,6 +323,24 @@ class DText
|
|||||||
html.join("").html_safe
|
html.join("").html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.strip(s)
|
||||||
|
s.gsub!(/[\r\n]+/m, " ")
|
||||||
|
s.gsub!(/\[\/?(?:b|i|s|u|tn|tr|td|th|thead|tbody|quote|code|spoilers|spoiler|expand|table)\]/, "")
|
||||||
|
s.gsub!(/\[\[([^\|\]]+)\|([^\]]+)\]\]/m, '\2')
|
||||||
|
s.gsub!(/\[\[([^\]]+)\]\]/, '\1')
|
||||||
|
s.gsub!(/\{\{([^\}]+)\}\}/, '\1')
|
||||||
|
s.gsub!(/("[^"]+":(https?:\/\/|\/)[^\s\r\n<>]+|https?:\/\/[^\s\r\n<>]+|"[^"]+":\[(https?:\/\/|\/)[^\s\r\n<>\]]+\])+/) do |url|
|
||||||
|
if url =~ /^"([^"]+)":\[(.+)\]$/
|
||||||
|
$1
|
||||||
|
elsif url =~ /^"([^"]+)":(.+)$/
|
||||||
|
$1
|
||||||
|
else
|
||||||
|
url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
s
|
||||||
|
end
|
||||||
|
|
||||||
def self.sanitize(text)
|
def self.sanitize(text)
|
||||||
text.gsub!(/<( |-|3|:|>|\Z)/, "<\\1")
|
text.gsub!(/<( |-|3|:|>|\Z)/, "<\\1")
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ class WeeklyMaintenance
|
|||||||
def run
|
def run
|
||||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||||
UserPasswordResetNonce.prune!
|
UserPasswordResetNonce.prune!
|
||||||
JanitorPruner.new.prune!
|
# JanitorPruner.new.prune!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class WikiPagePresenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def blurb
|
def blurb
|
||||||
excerpt.try(:gsub, /<.+?>/, "")
|
DText.strip(excerpt.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def consequent_tag_aliases
|
def consequent_tag_aliases
|
||||||
|
|||||||
Reference in New Issue
Block a user