Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /lib/gitlab/kroki.rb
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'lib/gitlab/kroki.rb')
-rw-r--r--lib/gitlab/kroki.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/gitlab/kroki.rb b/lib/gitlab/kroki.rb
index 8c5652fb766..2948b6ebd5b 100644
--- a/lib/gitlab/kroki.rb
+++ b/lib/gitlab/kroki.rb
@@ -13,11 +13,8 @@ module Gitlab
packetdiag
rackdiag
].freeze
- # Diagrams that require a companion container are disabled for now
- DIAGRAMS_FORMATS = ::AsciidoctorExtensions::Kroki::SUPPORTED_DIAGRAM_NAMES
- .reject { |diagram_type| diagram_type == 'mermaid' || diagram_type == 'bpmn' || BLOCKDIAG_FORMATS.include?(diagram_type) }
- DIAGRAMS_FORMATS_WO_PLANTUML = DIAGRAMS_FORMATS
- .reject { |diagram_type| diagram_type == 'plantuml' }
+ DIAGRAMS_FORMATS = (::AsciidoctorExtensions::Kroki::SUPPORTED_DIAGRAM_NAMES - %w(mermaid)).freeze
+ DIAGRAMS_FORMATS_WO_PLANTUML = (DIAGRAMS_FORMATS - %w(plantuml)).freeze
# Get the list of diagram formats that are currently enabled
#
@@ -28,10 +25,18 @@ module Gitlab
# If PlantUML is enabled, PlantUML diagrams will be processed by the PlantUML server.
# In other words, the PlantUML server has precedence over Kroki since both can process PlantUML diagrams.
- if current_settings.plantuml_enabled
- DIAGRAMS_FORMATS_WO_PLANTUML
- else
- DIAGRAMS_FORMATS
+ diagram_formats = if current_settings.plantuml_enabled
+ DIAGRAMS_FORMATS_WO_PLANTUML
+ else
+ DIAGRAMS_FORMATS
+ end
+
+ # No additional diagram formats
+ return diagram_formats unless current_settings.kroki_formats.present?
+
+ # Diagrams that require a companion container must be explicitly enabled from the settings
+ diagram_formats.select do |diagram_type|
+ current_settings.kroki_format_supported?(diagram_type)
end
end
end