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:
Jarek Radosz
2022-02-28 20:50:55 +01:00
committed by GitHub
parent 7c4be7f649
commit 2fc70c5572
59 changed files with 392 additions and 392 deletions

View File

@ -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) }