diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-17 06:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-17 06:08:59 +0300 |
commit | 38c3d3255398d615cf93867cb82902c3d2cb65a5 (patch) | |
tree | 5cc74f663afedac5125a59f81e2a4a571c61cb49 /lib/gitlab/kroki.rb | |
parent | 668e319631855d6d9396a203ded1fa5bcb986f1f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/kroki.rb')
-rw-r--r-- | lib/gitlab/kroki.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab/kroki.rb b/lib/gitlab/kroki.rb index 8c5652fb766..38090786836 100644 --- a/lib/gitlab/kroki.rb +++ b/lib/gitlab/kroki.rb @@ -13,9 +13,7 @@ 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' } @@ -28,10 +26,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 |