mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Correctly tag heredocs (#16061)
This allows text editors to use correct syntax coloring for the heredoc sections. Heredoc tag names we use: languages: SQL, JS, RUBY, LUA, HTML, CSS, SCSS, SH, HBS, XML, YAML/YML, MF, ICS other: MD, TEXT/TXT, RAW, EMAIL
This commit is contained in:
@@ -45,14 +45,14 @@ class PostsController < ApplicationController
|
||||
opts[:limit] = MARKDOWN_TOPIC_PAGE_SIZE
|
||||
topic_view = TopicView.new(params[:topic_id], current_user, opts)
|
||||
content = topic_view.posts.map do |p|
|
||||
<<~HEREDOC
|
||||
<<~MD
|
||||
#{p.user.username} | #{p.updated_at} | ##{p.post_number}
|
||||
|
||||
#{p.raw}
|
||||
|
||||
-------------------------
|
||||
|
||||
HEREDOC
|
||||
MD
|
||||
end
|
||||
render plain: content.join
|
||||
end
|
||||
|
||||
@@ -247,7 +247,7 @@ class SessionController < ApplicationController
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
|
||||
if SiteSetting.verbose_discourse_connect_logging
|
||||
Rails.logger.warn(<<~EOF)
|
||||
Rails.logger.warn(<<~TEXT)
|
||||
Verbose SSO log: Record was invalid: #{e.record.class.name} #{e.record.id}
|
||||
#{e.record.errors.to_h}
|
||||
|
||||
@@ -256,7 +256,7 @@ class SessionController < ApplicationController
|
||||
|
||||
SSO Diagnostics:
|
||||
#{sso.diagnostics}
|
||||
EOF
|
||||
TEXT
|
||||
end
|
||||
|
||||
text = nil
|
||||
|
||||
@@ -303,11 +303,11 @@ module Jobs
|
||||
# Simulate the args being dumped/parsed through JSON
|
||||
parsed_opts = JSON.parse(JSON.dump(opts))
|
||||
if opts != parsed_opts
|
||||
Discourse.deprecate(<<~MSG.squish, since: "2.9", drop_from: "3.0")
|
||||
Discourse.deprecate(<<~TEXT.squish, since: "2.9", drop_from: "3.0")
|
||||
#{klass.name} was enqueued with argument values which do not cleanly serialize to/from JSON.
|
||||
This means that the job will be run with slightly different values than the ones supplied to `enqueue`.
|
||||
Argument values should be strings, booleans, numbers, or nil (or arrays/hashes of those value types).
|
||||
MSG
|
||||
TEXT
|
||||
end
|
||||
opts = parsed_opts
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class ReviewableSerializer < ApplicationSerializer
|
||||
def self.create_attribute(name, field)
|
||||
attribute(name)
|
||||
|
||||
class_eval <<~GETTER
|
||||
class_eval <<~RUBY
|
||||
def #{name}
|
||||
#{field}
|
||||
end
|
||||
@@ -67,7 +67,7 @@ class ReviewableSerializer < ApplicationSerializer
|
||||
def include_#{name}?
|
||||
#{name}.present?
|
||||
end
|
||||
GETTER
|
||||
RUBY
|
||||
end
|
||||
|
||||
# This is easier than creating an AMS method for each attribute
|
||||
|
||||
@@ -11,7 +11,7 @@ class UserActionManager
|
||||
end
|
||||
|
||||
[:notification, :post, :topic, :post_action].each do |type|
|
||||
self.class_eval(<<~METHODS)
|
||||
self.class_eval(<<~RUBY)
|
||||
def self.#{type}_created(*args)
|
||||
return if @disabled
|
||||
#{type}_rows(*args).each { |row| UserAction.log_action!(row) }
|
||||
@@ -20,7 +20,7 @@ class UserActionManager
|
||||
return if @disabled
|
||||
#{type}_rows(*args).each { |row| UserAction.remove_action!(row) }
|
||||
end
|
||||
METHODS
|
||||
RUBY
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user