Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use alternative {{ ... }} syntax

Oliver Güntherc3e57f79eafa
diff --git a/app/seeders/seeder.rb b/app/seeders/seeder.rb
index d53b702c0f7..56004ee706f 100644
--- a/app/seeders/seeder.rb
+++ b/app/seeders/seeder.rb
@@ -66,7 +66,7 @@ class Seeder
# Translate the given string with the fixed interpolation for base_url
# Deep interpolation is required in order for interpolations on hashes to work!
def translate_with_base_url(string)
- I18n.t(string, deep_interpolation: true, base_url: "opSetting:base_url")
+ I18n.t(string, deep_interpolation: true, base_url: "{{opSetting:base_url}}")
end
def edition_data_for(key)
diff --git a/config/settings.yml b/config/settings.yml
index 023185f2627..23b9782bd61 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -317,7 +317,7 @@ emails_footer:
default:
en: |-
You have received this notification because you have either subscribed to it, or are involved in it.
- To change your notification preferences, please click here: opSetting:base_url/my/notifications
+ To change your notification preferences, please click here: {{opSetting:base_url/my/notifications}}
start_of_week:
default: ''
first_week_of_year:
diff --git a/lib/open_project/text_formatting/matchers/setting_macros.rb b/lib/open_project/text_formatting/matchers/setting_macros.rb
index 671d0a8c3f4..4d1fe466604 100644
--- a/lib/open_project/text_formatting/matchers/setting_macros.rb
+++ b/lib/open_project/text_formatting/matchers/setting_macros.rb
@@ -32,7 +32,7 @@ module OpenProject::TextFormatting
module Matchers
# OpenProject macros for inserting setting values
# Examples:
- # opSetting:host_name # Outputs the Setting.host_name
+ # {{opSetting:host_name}} # Outputs the Setting.host_name
class SettingMacros < RegexMatcher
ALLOWED_SETTINGS = %w[
host_name
@@ -41,14 +41,14 @@ module OpenProject::TextFormatting
def self.regexp
%r{
- opSetting:(#{ALLOWED_SETTINGS.join("|")})
+ \{\{opSetting:(#{ALLOWED_SETTINGS.join("|")})\}\}
}x
end
##
# Faster inclusion check before the regex is being applied
def self.applicable?(content)
- content.include?('opSetting:')
+ content.include?('{{opSetting:')
end
def self.process_match(match, matched_string, _context)
diff --git a/spec/features/homescreen/index_spec.rb b/spec/features/homescreen/index_spec.rb
index f52c1cd929e..31ea17306de 100644
--- a/spec/features/homescreen/index_spec.rb
+++ b/spec/features/homescreen/index_spec.rb
@@ -39,7 +39,7 @@ describe 'Homescreen index', type: :feature do
describe 'with a dynamic URL in the welcome text',
with_settings: {
- welcome_text: "With [a link to the public project](opSetting:base_url/projects/public-project)",
+ welcome_text: "With [a link to the public project]({{opSetting:base_url}}/projects/public-project)",
welcome_on_homescreen?: true
} do
it 'renders the correct link' do
diff --git a/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb b/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb
index 2bb6db7eda8..2b7a10e00d9 100644
--- a/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb
@@ -37,15 +37,15 @@ describe OpenProject::TextFormatting,
it_behaves_like 'format_text produces' do
let(:raw) do
<<~RAW
- Inline reference to variable setting: opSetting:host_name
+ Inline reference to variable setting: {{opSetting:host_name}}
- Inline reference to base_url variable: opSetting:base_url
+ Inline reference to base_url variable: {{opSetting:base_url}}
- [Link with setting](opSetting:base_url/foo/bar)
+ [Link with setting]({{opSetting:base_url}}/foo/bar)
- Inline reference to invalid variable: opSetting:smtp_password
+ Inline reference to invalid variable: {{opSetting:smtp_password}}
- Inline reference to missing variable: opSetting:does_not_exist
+ Inline reference to missing variable: {{opSetting:does_not_exist}}
RAW
end