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

@ -85,11 +85,11 @@ def crawl_topics
begin
if start == 1 && find("h2").text == "Error 403"
exit_with_error(<<~MSG.red.bold)
exit_with_error(<<~TEXT.red.bold)
Unable to find topics. Try running the script with the "--domain example.com"
option if you are a G Suite user and your group's URL contains a path with
your domain that looks like "/a/example.com".
MSG
TEXT
end
rescue Selenium::WebDriver::Error::NoSuchElementError
# Ignore this error. It simply means there wasn't an error.
@ -151,10 +151,10 @@ def crawl_message(url, might_be_deleted)
@first_message_checked = true
if content.match?(/From:.*\.\.\.@.*/i) && !@force_import
exit_with_error(<<~MSG.red.bold)
exit_with_error(<<~TEXT.red.bold)
It looks like you do not have permissions to see email addresses. Aborting.
Use the --force option to import anyway.
MSG
TEXT
end
end

View File

@ -114,28 +114,28 @@ class ImportScripts::IpboardSQL < ImportScripts::Base
rescue Exception => e
puts '=' * 50
puts e.message
puts <<EOM
Cannot log in to database.
puts <<~TEXT
Cannot log in to database.
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
You should set these variables:
You should set these variables:
export DB_HOST="localhost"
export DB_NAME="ipboard"
export DB_PW="ipboard"
export DB_USER="ipboard"
export TABLE_PREFIX="ipb_"
export IMPORT_AFTER="1970-01-01"
export URL="http://example.com"
export UPLOADS=
export USERDIR="user"
export DB_HOST="localhost"
export DB_NAME="ipboard"
export DB_PW="ipboard"
export DB_USER="ipboard"
export TABLE_PREFIX="ipb_"
export IMPORT_AFTER="1970-01-01"
export URL="http://example.com"
export UPLOADS=
export USERDIR="user"
Exiting.
EOM
Exiting.
TEXT
exit
end
end

View File

@ -43,25 +43,25 @@ class ImportScripts::Modx < ImportScripts::Base
rescue Exception => e
puts '=' * 50
puts e.message
puts <<EOM
Cannot connect in to database.
puts <<~TEXT
Cannot connect in to database.
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
Edit the script or set these environment variables:
Edit the script or set these environment variables:
export DB_HOST="localhost"
export DB_NAME="modx"
export DB_PW="modx"
export DB_USER="modx"
export TABLE_PREFIX="modx_"
export ATTACHMENT_DIR '/path/to/your/attachment/folder'
export DB_HOST="localhost"
export DB_NAME="modx"
export DB_PW="modx"
export DB_USER="modx"
export TABLE_PREFIX="modx_"
export ATTACHMENT_DIR '/path/to/your/attachment/folder'
Exiting.
EOM
Exiting.
TEXT
exit
end
@ -446,12 +446,12 @@ FROM #{TABLE_PREFIX}discuss_users
# keep track of closed topics
closed_topic_ids = []
topics = mysql_query <<-MYSQL
topics = mysql_query <<-SQL
SELECT t.threadid threadid, firstpostid, open
FROM #{TABLE_PREFIX}thread t
JOIN #{TABLE_PREFIX}post p ON p.postid = t.firstpostid
ORDER BY t.threadid
MYSQL
SQL
topics.each do |topic|
topic_id = "thread-#{topic["threadid"]}"
closed_topic_ids << topic_id if topic["open"] == 0

View File

@ -58,27 +58,27 @@ class ImportScripts::MylittleforumSQL < ImportScripts::Base
rescue Exception => e
puts '=' * 50
puts e.message
puts <<EOM
Cannot log in to database.
puts <<~TEXT
Cannot log in to database.
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
You should set these variables:
You should set these variables:
export DB_HOST="localhost"
export DB_NAME="mylittleforum"
export DB_PW=""
export DB_USER="root"
export TABLE_PREFIX="forum_"
export IMPORT_AFTER="1970-01-01"
export IMAGE_BASE="http://www.example.com/forum"
export BASE="forum"
export DB_HOST="localhost"
export DB_NAME="mylittleforum"
export DB_PW=""
export DB_USER="root"
export TABLE_PREFIX="forum_"
export IMPORT_AFTER="1970-01-01"
export IMAGE_BASE="http://www.example.com/forum"
export BASE="forum"
Exiting.
EOM
Exiting.
TEXT
exit
end
end

View File

@ -26,10 +26,10 @@ module ImportScripts::PhpBB3
require_relative 'database_3_1'
Database_3_1.new(@database_client, @database_settings)
else
raise UnsupportedVersionError, <<~MSG
raise UnsupportedVersionError, <<~TEXT
Unsupported version (#{version}) of phpBB detected.
Currently only version 3.0, 3.1 and 3.2 are supported by this importer.
MSG
TEXT
end
end

View File

@ -53,25 +53,25 @@ class ImportScripts::VBulletin < ImportScripts::Base
rescue Exception => e
puts '=' * 50
puts e.message
puts <<EOM
Cannot connect in to database.
puts <<~TEXT
Cannot connect in to database.
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
Hostname: #{DB_HOST}
Username: #{DB_USER}
Password: #{DB_PW}
database: #{DB_NAME}
Edit the script or set these environment variables:
Edit the script or set these environment variables:
export DB_HOST="localhost"
export DB_NAME="vbulletin"
export DB_PW=""
export DB_USER="root"
export TABLE_PREFIX="vb_"
export ATTACHMENT_DIR '/path/to/your/attachment/folder'
export DB_HOST="localhost"
export DB_NAME="vbulletin"
export DB_PW=""
export DB_USER="root"
export TABLE_PREFIX="vb_"
export ATTACHMENT_DIR '/path/to/your/attachment/folder'
Exiting.
EOM
Exiting.
TEXT
exit
end
@ -674,12 +674,12 @@ EOM
# keep track of closed topics
closed_topic_ids = []
topics = mysql_query <<-MYSQL
topics = mysql_query <<-SQL
SELECT t.threadid threadid, firstpostid, open
FROM #{TABLE_PREFIX}thread t
JOIN #{TABLE_PREFIX}post p ON p.postid = t.firstpostid
ORDER BY t.threadid
MYSQL
SQL
topics.each do |topic|
topic_id = "thread-#{topic["threadid"]}"
closed_topic_ids << topic_id if topic["open"] == 0