mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:21:04 +08: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:
@ -22,7 +22,7 @@ def html_for_section(group)
|
||||
" {{replace-emoji \":#{icon['name']}:\" (hash lazy=true#{class_attr})}}"
|
||||
end
|
||||
|
||||
<<~SECTION
|
||||
<<~HTML
|
||||
<div class="section" data-section="#{group["name"]}">
|
||||
<div class="section-header">
|
||||
<span class="title">{{i18n "emoji_picker.#{group["name"]}"}}</span>
|
||||
@ -31,14 +31,14 @@ def html_for_section(group)
|
||||
#{icons.join("\n").strip}
|
||||
</div>
|
||||
</div>
|
||||
SECTION
|
||||
HTML
|
||||
end
|
||||
|
||||
def write_template(path, task_name, template)
|
||||
header = <<~HEADER
|
||||
header = <<~JS
|
||||
// DO NOT EDIT THIS FILE!!!
|
||||
// Update it by running `rake javascript:#{task_name}`
|
||||
HEADER
|
||||
JS
|
||||
|
||||
basename = File.basename(path)
|
||||
output_path = "#{Rails.root}/app/assets/javascripts/#{path}"
|
||||
@ -50,10 +50,10 @@ def write_template(path, task_name, template)
|
||||
end
|
||||
|
||||
def write_hbs_template(path, task_name, template)
|
||||
header = <<~HEADER
|
||||
header = <<~HBS
|
||||
{{!-- DO NOT EDIT THIS FILE!!! --}}
|
||||
{{!-- Update it by running `rake javascript:#{task_name}` --}}
|
||||
HEADER
|
||||
HBS
|
||||
|
||||
basename = File.basename(path)
|
||||
output_path = "#{Rails.root}/app/assets/javascripts/#{path}"
|
||||
@ -244,11 +244,11 @@ task 'javascript:update_constants' => :environment do
|
||||
groups_json = JSON.parse(File.read("lib/emoji/groups.json"))
|
||||
|
||||
emoji_buttons = groups_json.map do |group|
|
||||
<<~BUTTON
|
||||
<<~HTML
|
||||
<button type="button" data-section="#{group["name"]}" {{action onCategorySelection "#{group["name"]}"}} class="btn btn-default category-button emoji">
|
||||
{{replace-emoji ":#{group["tabicon"]}:"}}
|
||||
</button>
|
||||
BUTTON
|
||||
HTML
|
||||
end
|
||||
|
||||
emoji_sections = groups_json.map { |group| html_for_section(group) }
|
||||
|
Reference in New Issue
Block a user